-
Notifications
You must be signed in to change notification settings - Fork 121
Add filterable sequential test groups #448
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
Changes from 5 commits
52e7ef7
0787b80
dab0ef7
8068be2
e9c0d44
080f405
cadb9e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,9 +18,12 @@ module Test.Tasty.Core | |||||||||||||||||||||
| , ResourceError(..) | ||||||||||||||||||||||
| , DependencyType(..) | ||||||||||||||||||||||
| , ExecutionMode(..) | ||||||||||||||||||||||
| , Parallel(..) | ||||||||||||||||||||||
| , TestTree(..) | ||||||||||||||||||||||
| , testGroup | ||||||||||||||||||||||
| , sequentialTestGroup | ||||||||||||||||||||||
| , dependentTestGroup | ||||||||||||||||||||||
| , inOrderTestGroup | ||||||||||||||||||||||
| , after | ||||||||||||||||||||||
| , after_ | ||||||||||||||||||||||
| , TreeFold(..) | ||||||||||||||||||||||
|
|
@@ -264,19 +267,26 @@ data DependencyType | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| -- | Determines mode of execution of a 'TestGroup' | ||||||||||||||||||||||
| data ExecutionMode | ||||||||||||||||||||||
| = Sequential DependencyType | ||||||||||||||||||||||
| -- ^ Execute tests one after another | ||||||||||||||||||||||
| | Parallel | ||||||||||||||||||||||
| -- ^ Execute tests in parallel | ||||||||||||||||||||||
| = Dependent DependencyType | ||||||||||||||||||||||
| -- ^ Test have dependencies | ||||||||||||||||||||||
| | Independent Parallel | ||||||||||||||||||||||
| -- ^ Test have no dependencies | ||||||||||||||||||||||
| deriving (Show, Read) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| data Parallel | ||||||||||||||||||||||
| = Parallel | ||||||||||||||||||||||
| -- ^ Tests can be run in parallel | ||||||||||||||||||||||
| | NonParallel | ||||||||||||||||||||||
| -- ^ Tests should not be parallelized | ||||||||||||||||||||||
| deriving (Show, Read) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| -- | Determines mode of execution of a 'TestGroup'. Note that this option is | ||||||||||||||||||||||
| -- not exposed as a command line argument. | ||||||||||||||||||||||
| instance IsOption ExecutionMode where | ||||||||||||||||||||||
| defaultValue = Parallel | ||||||||||||||||||||||
| defaultValue = Independent Parallel | ||||||||||||||||||||||
| parseValue = readMaybe | ||||||||||||||||||||||
| optionName = Tagged "execution-mode" | ||||||||||||||||||||||
| optionHelp = Tagged "Whether to execute tests sequentially or in parallel" | ||||||||||||||||||||||
| optionHelp = Tagged "Whether tests have dependencies or not" | ||||||||||||||||||||||
| optionCLParser = mkOptionCLParser internal | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| -- | The main data structure defining a test suite. | ||||||||||||||||||||||
|
|
@@ -322,15 +332,40 @@ data TestTree | |||||||||||||||||||||
| testGroup :: TestName -> [TestTree] -> TestTree | ||||||||||||||||||||||
| testGroup = TestGroup | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| -- | Create a named group of test cases or other groups. Tests are executed in | ||||||||||||||||||||||
| -- order. For parallel execution, see 'testGroup'. | ||||||||||||||||||||||
| {-# DEPRECATED sequentialTestGroup "Use dependentTestGroup instead" #-} | ||||||||||||||||||||||
| -- | Legacy name for dependentTestGroup. | ||||||||||||||||||||||
| -- | ||||||||||||||||||||||
| -- @since 1.5 | ||||||||||||||||||||||
| sequentialTestGroup :: TestName -> DependencyType -> [TestTree] -> TestTree | ||||||||||||||||||||||
| sequentialTestGroup nm depType = setSequential . TestGroup nm . map setParallel | ||||||||||||||||||||||
| sequentialTestGroup = dependentTestGroup | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| -- | Create a named group of test cases or other groups. Tests are executed in | ||||||||||||||||||||||
| -- order, all dependencies will be run (overriding filter). | ||||||||||||||||||||||
| -- For parallel execution, see 'testGroup'. | ||||||||||||||||||||||
|
||||||||||||||||||||||
| -- | Create a named group of test cases or other groups. Tests are executed in | |
| -- order, all dependencies will be run (overriding filter). | |
| -- For parallel execution, see 'testGroup'. | |
| -- | Create a named group of test cases or other groups. Tests are executed in | |
| -- order and each test is considered a dependency of the next one. If a filter | |
| -- is applied, any dependencies are run too, even if they would otherwise not | |
| -- match the filter's criteria. | |
| -- | |
| -- For parallel execution, see 'testGroup'. For ordered test execution, but | |
| -- without dependencies, see 'inOrderTestGroup'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not quite resolves #443, I think. What happens if one of sequential tests fails? Does it stop execution of subsequent ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that was covered by DependencyType, but after reading it I'm still not really sure what's going on. Do you think this PR should be blocked on that? I'm happy to open a new PR tackling the problem after merging this one -- I feel it's a problem I introduced to begin with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that in a AllSucceed block, you will have the behaviour described by @Bodigrim (but not in an AllFinish one).
I'm not sure there is actually a use-case for this (but I might be lacking imagination !). I think users are more likely to need a "stop at the first failed test" (disregarding any dependency and / or order) flag for the whole runner, which I don't think Tasty offer and would be a neat addition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think this PR should be blocked on that? I'm happy to open a new PR tackling the problem after merging this one -- I feel it's a problem I introduced to begin with.
Sure, no problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to open a new PR tackling the problem after merging this one -- I feel it's a problem I introduced to begin with.
@martijnbastiaan just a kind reminder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is on my stack, but the stack is big at the moment..
Uh oh!
There was an error while loading. Please reload this page.