Partial order for test classes/methods? #5725
Replies: 2 comments
|
See related issues and discussions: |
|
#48 does share implementation aspects obviously, but it is conceptually unrelated as it's about having a test that consists of a series of subtests. (In fact I believe that #48 might already be covered and could be closed, but I'm not 100% sure; I added a comment there.) #607 and #1767 seem to be talking about the same idea, yes. I can't comment on #3099, so I say it here: |
Uh oh!
There was an error while loading. Please reload this page.
I'd like to specify test interdependencies, so that a test will be run only after some other test succeeded.
E.g. in a batch program where each step depends on the output of the previous step, so if an early step fails its tests, the later steps cannot be reasonably run, let alone tested.
Or if a test for command-line option processing in a module integration test fails, it makes no sense to test that the option is correctly interpreted during processing.
Signature processing tests that can't sensibly run if testing the crypto library reveals bugs.
I know it's possible to use mocks to decouple tests that depend on each other, but mocks come with their own set of problems, tend to be overspecific, can be hard and time-consuming to write, and usually become a never-ending story in maintenance.
I know
ClassOrdererandMethodOrdererdo test sorting, but they impose total orders and hence are overspecific.These orderers could be used to complete the partial order imposed by interdependencies into a total one though.
I'm not sure what the best way to determine test interdependencies would be.
One could do call chain analysis, or use some library that calculates a dependency graph, but I don't know if these are options in JUnit.
Or maybe a manual specification using an annotation, such as
@DependsOnTest(<name of other test that must succeed before running this one>)(maybe the name can be improved).All reactions