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

More verbosity when no tests are run #2179

Closed
flyhard opened this issue Dec 8, 2020 · 5 comments · Fixed by #2182
Closed

More verbosity when no tests are run #2179

flyhard opened this issue Dec 8, 2020 · 5 comments · Fixed by #2182

Comments

@flyhard
Copy link

flyhard commented Dec 8, 2020

I used a lot of time today trying to find out why my features wouldn't run. I thought cucumber junit engine wasn't been discovered, but it turned out I had my folders messed up.

What I was missing was some output saying "I was looking in folder X for features, but found none" or "couldn't find any class annotated with X" to point me in the right direction.

I think this should be something it should output just like it outputs the publish stuff.

This improvement would be a lot of help to anyone who is new to cucumber or the junit 5 way of setting it up.

mpkorstanje added a commit that referenced this issue Dec 9, 2020
Both Surefire and Gradle assume that tests are contained within a class and
use `ClassSelector` to discover tests in these classes. Cucumber uses plain
text files. By using a class annotated with `@Cucumber` we work around this
behaviour. Cucumber will then scan the package and sub-packages of the
annotated class for feature files.

When using this system, in case of misconfiguration it is not immediately clear
if the test engine is not picked up or if the location of the feature files and
annotated class do not line up.

While we can not generically log a warning in case a discovery selector did not
find any features, we can log a warning in this special case. It is clear that
the intend was to put feature files in the package. Otherwise the annotated
class could/should be removed to suppress this warning.

Fixes: #2179
mpkorstanje added a commit that referenced this issue Dec 9, 2020
Both Surefire and Gradle assume that tests are contained within a class and
use `ClassSelector` to discover tests in these classes. Cucumber uses plain
text files. By using a class annotated with `@Cucumber` we work around this
behaviour. Cucumber will then scan the package and sub-packages of the
annotated class for feature files.

When using this system, in case of misconfiguration it is not immediately clear
if the test engine is not picked up or if the location of the feature files and
annotated class do not line up.

While we can not generically log a warning in case a discovery selector did not
find any features, we can log a warning in this special case. It is clear that
the intend was to put feature files in the package. Otherwise the annotated
class could/should be removed to suppress this warning.

Fixes: #2179
mpkorstanje added a commit that referenced this issue Dec 9, 2020
Both Surefire and Gradle assume that tests are contained within a class and
use `ClassSelector` to discover tests in these classes. Cucumber uses plain
text files. By using a class annotated with `@Cucumber` we work around this
behaviour. Cucumber will then scan the package and sub-packages of the
annotated class for feature files.

When using this system, in case of misconfiguration it is not immediately clear
if the test engine is not picked up or if the location of the feature files and
annotated class do not line up.

While we can not generically log a warning in case a discovery selector did not
find any features, we can log a warning in this special case. It is clear that
the intend was to put feature files in the package. Otherwise the annotated
class could/should be removed to suppress this warning.

Fixes: #2179
@mpkorstanje
Copy link
Contributor

Would this help:

Dec 09, 2020 2:27:50 AM org.junit.platform.launcher.core.LauncherConfigurationParameters loadClasspathResource
INFO: Loading JUnit Platform configuration parameters from classpath resource [file:/home/mpkorstanje/Projects/cucumber/cucumber-jvm/junit-platform-engine/target/test-classes/junit-platform.properties].
Dec 09, 2020 2:27:50 AM org.junit.platform.launcher.core.LauncherConfigurationParameters loadClasspathResource
INFO: Loading JUnit Platform configuration parameters from classpath resource [file:/home/mpkorstanje/Projects/cucumber/cucumber-jvm/junit-platform-engine/target/test-classes/junit-platform.properties].
Dec 09, 2020 2:27:51 AM io.cucumber.junit.platform.engine.FeatureResolver resolvePackageResourceWarnIfNone
WARNING: No features found in package 'io.cucumber.junit.platform.engine.nofeatures'

Depends a bit on your tooling where this ends up.

mpkorstanje added a commit that referenced this issue Dec 9, 2020
Both Surefire and Gradle assume that tests are contained within a class and
use `ClassSelector` to discover tests in these classes. Cucumber uses plain
text files. By using a class annotated with `@Cucumber` we work around this
behaviour. Cucumber will then scan the package and sub-packages of the
annotated class for feature files.

When using this system, in case of misconfiguration it is not immediately clear
if the test engine is not picked up or if the location of the feature files and
annotated class do not line up.

While we can not generically log a warning in case a discovery selector did not
find any features, we can log a warning in this special case. It is clear that
the intend was to put feature files in the package. Otherwise the annotated
class could/should be removed to suppress this warning.

Fixes: #2179
@flyhard
Copy link
Author

flyhard commented Dec 10, 2020

Was a gradle build and I ran with the --info flag. I haven't seen that warning.

@mpkorstanje
Copy link
Contributor

That's expected. I just added it. 😄

I wanted to know if it would have helped or if the message might not be informative enough.

Did you see the INFO log lines anywhere? The error message would be printed in the same place.

@flyhard
Copy link
Author

flyhard commented Dec 15, 2020

Seems like it would be very usefull. And yes, I saw the info messages, I believe.

@mpkorstanje
Copy link
Contributor

Can you try v6.9.1?

This was referenced Mar 15, 2021
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

Successfully merging a pull request may close this issue.

2 participants