[feature] introduce subtests #3946
Labels
status: wontfix
typically a feature which won't be added, or a "bug" which is actually intended behavior
type: feature
enhancement proposal
Is your feature request related to a problem or a nice-to-have?? Please describe.
I often run into the decision between writing short tests with a lot of boilerplate and larger tests where its hard to describe which part specifically failed.
Consider the following scenario:
this is good because I can test these two calls individually, if one fails I know exactly what went wrong based on the test names. However, if I want to test that these two objects are in fact equal, then I can rewrite the test like so:
however, now if this test fails it is harder to tell exactly what went wrong.
Describe the solution you'd like
I would like to see the idea of subtests in pytest or node-tap. In mocha, we like the idea of completely independent tests, this is great because we can run one test and iterate quickly. However, I still think there is value to be added in adding more metadata to individual tests. What I am proposing is creating sub sections in a test that cannot be ran separately, the whole test still needs to be ran, but now we have more information on where a test failed.
Here is the syntax I imagine:
Describe alternatives you've considered
currently I just use plenty of comments in my tests, but that information isnt immediately useful when reading test failures on CI and doesnt necessarily section out tests well. The other other alternative I already described, which is simply breaking up tests further, but this means its harder to combine testing different but related pieces of code without writing more overlapping tests.
The text was updated successfully, but these errors were encountered: