-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Feature: Fail when no scenarios found #2296
Comments
As mentioned in slack, this is "likely" something that would fit into the "not-cucumber" category. If this was something you wanted to make as an off-shoot plugin, then go ahead. But I'm not really sure of the need in a ubiquitous spec for cucumber. If cucumber-js wanted to deviate and maintain this, then that's up to the maintainers here. Primarily @davidjgoss - but it's not something that would be welcome across all flavours of cucumber |
I have just noticed that Jest actually implements this feature: When having no tests found it fails with error code 1 and optionally can have a flag that disables this. Actually when we think about it having 0 tests is never OK. If you have no tests implemented just don't put a test framework, other ways it means something went bad and you should fail.
|
For Cucumber JVM I generally find it prudent to follow the ecosystems conventions. For Java that comes down to treating the set of empty tests as passing by default. |
Hello @mpkorstanje I did not understand what you mean to say by "ecosystem conventions" and what Java empty sets has to do with simple validating that a test framework works. Talk about conventions it seems a lot more logical to have a convention saying that a test's job is to validate that a system is working properly and this covers the use case illustrated in this issue. PS: Another test framework that I am using has a proper detection of "0 tests found" - ArchUnit: ArchUnit Log: java.lang.AssertionError: Rule 'classes that are annotated with @te should have simple name ending with 'Entity'' failed to check any classes. This means either that no classes have been passed to the rule at all, or that no classes passed to the rule matched the |
@sashokbg The phrase "proper" implies that cucumber reporting 0 tests is incorrect. This isn't the case. Cucumber isn't a testing framework. Furthermore, it is correct to grab 0 tests as we want to cover use cases where for instance tag filtering or folder filtering is working correctly. Within a testing framework you could also argue about 0 being correct/incorrect. I have a cucumber framework (Which also uses rspec), and I ran
|
@sashokbg in the Java ecosystem I would consider JUnit 5, Maven and Gradle to be representative. But I don't think we need to have a discussion about Java here. Ideally, since you're advancing this argument for cucumber-js, you could provide examples from the JS ecosystem that treat the set of empty tests as a failure. |
Maybe just a config setting (like |
If this is a common custom in the majority of JS frameworks @vitalets (such as mocha / chai / jest ....) then I don't see any argument against it. But I don't have enough knowledge of JS, if it seems as though lots of people are asking for this thing and it aligns nicely then push some work up and have one the JS contributors review it. I think by now we've resolved the "how" it would need to work, given that we've explained by and large cucumber reporting 0 scenarios ran shouldn't be considered (for now), as erroneous. |
Current state:
Desired functionality:
There is a discussion in slack and some people proposed
--minimum-tests 1
or--expect-tests
The text was updated successfully, but these errors were encountered: