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

Add "only" mode #7

Open
tolmasky opened this issue Jan 11, 2019 · 6 comments
Open

Add "only" mode #7

tolmasky opened this issue Jan 11, 2019 · 6 comments

Comments

@tolmasky
Copy link
Owner

We need a way to specify that you should only be doing one of the tests in the file for quick testing. Perhaps something like [only] in the title, and then require --allow-only as a flag. This way, it won't get accidentally committed.

@noahlt
Copy link

noahlt commented Apr 10, 2019

I think the best solution is for an --only parameter that accepts a regex, and only tests whose titles match the regex get run.

This way, we know nothing gets committed, plus the decision of whether or not to run a given test relies only on that test and the regex (ie, you don't have to know anything about any other tests to make the decision).

This is what the Go testing command does, and I think it works pretty well.

@tolmasky
Copy link
Owner Author

We have to at minimum calculate the path to the test and run all the preceding requirements (previous tests in serial Suites, and parent Suites).

@noahlt
Copy link

noahlt commented Apr 10, 2019

Ah, right, test dependencies (parents, preceding serial tests) do need to be determined and run.

Why do we need to calculate the path to the test?

@tolmasky
Copy link
Owner Author

So that we don't run unecessary tests. For example, if you have Suite A { Suite B { Test 1, Test 2 } }, merely knowing Suite A is the parent to start with isn't sufficient, since you need to know that you SHOULD run Suite B but NOT Test 2, so you'd want, working backwards from the matched regex, A -> B -> 1. If it's Suite A { Suite B { ... } . Suite C (Serial) { Test 1, Test 2 } }, you want A -> C -> 1 -> 2. You then want to merge the paths of all the matches, so that you have have a green-lit set to compare to when walking the test tree as normal.

@noahlt
Copy link

noahlt commented Apr 10, 2019

Oh oh, sorry, I misinterpreted that to mean "the path on the filesystem to the file which contains the test". Got it, yes that makes sense.

@tolmasky
Copy link
Owner Author

This is just conceptually of course, you can imagine just doing getPrunedTree:

getPrunedTree (node)
{
     if (node.title matches regex)
         return node;

     if (node is Suite)
     {
          children = node.children.filter(getPrunedTree);
          if (children.length > 0)
              return Suite({ ...node, children });
         else
              return null;
     }
}

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