Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command tests #15

Open
5 tasks
damondouglas opened this issue Jan 26, 2015 · 7 comments
Open
5 tasks

Command tests #15

damondouglas opened this issue Jan 26, 2015 · 7 comments

Comments

@damondouglas
Copy link
Contributor

Create unittests for commands:

  • install
  • uninstall
  • fetch
  • spec
  • pull
@seaneagan
Copy link
Owner

Removed completion since all the code for that is in the unscripted package. And unscripted already has tests for it.

@damondouglas
Copy link
Contributor Author

@seaneagan, Instead of hardcoding every testing case, I want to intelligently autogenerate them. I've been working on install first as a model for the others. I want to develop a helper class that performs the combinatorics and auto-generates these testing cases. Pardon anything incorrect in the following as I have no formal math background.

Briefly described, I imagine a σ-algebra set of possible arguments (flags, options and rest) and an expectancy set of outcomes. The testing set is a subset of this σ-algebra.

For example for install,

Let R be the set of rest arguments: prompt, chrome, chrome#0.6.5, git://github.com/seaneagan/unscripted.git, ....

Let O be the set of options: source:hosted, source:git, source:local.

Let F be the set of flags: dev:false, dev:true.

Let E be the expectancy set of pubspec outcomes: yaml contains prompt, yaml contains chrome, ...

The resulting testing set σ-algebra on R, O, and F would be
[prompt, source:hosted], [prompt, source:hosted, dev:true], ...

I don't know how to express this in set theory but I imagine also excluding the following cases, for example, as they are impossible:

[git://github.com/seaneagan/unscripted.git, source:hosted], [prompt, source:local]

@seaneagan
Copy link
Owner

@damondouglas unscripted (which den uses) was designed to allow you to unit test the dart method(s) or class(es) that represent your command-line interface and not have to actually test the command-line interface itself by passing command-line arguments to it. So let's start with that, and then if that doesn't seem sufficient we can look at doing some integration tests that actually run the process. +1 for starting with a single command as a PR.

@seaneagan
Copy link
Owner

So for example you would want to unit test InstallCommand.

@damondouglas
Copy link
Contributor Author

@seaneagan , Next week I will provide my first PR for this. Just letting you know I'm still active and excited to work on this.

@damondouglas
Copy link
Contributor Author

@seaneagan , I'm struggling with executing unittests with async methods. I need to step away for a while and come back with a fresh mind.

@damondouglas
Copy link
Contributor Author

@seaneagan , I finally figured out how to test within an async context. At some point I am going to do another PR. Meanwhile, please see my progress: https://github.com/damondouglas/den/tree/master/test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants