-
Notifications
You must be signed in to change notification settings - Fork 10
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
tag filtering ignores "failed to init" test classes #77
Comments
Hi, thank you very much for the detailed report, I will release a fixed version in about a week. |
Thanks a lot! |
Hey @giurim, any update on this ? |
Hi @shrey-ghost, I apologise for the delay I was traveling and the fix also needed some research (if the class is not initialized I have no Thank you again for the report! In my opinion class initialization errors are the weakest part of the Junit 5 systems so far. |
Thanks a lot for the fix! |
Describe the bug
If a scala test class fails to be constructed (for e.g., a
NullPointerException
), it is ignored when tests are filtered with junit tags, specifically, the flagincludeTags
. This should instead be reported as a failure (similar behavior to what happens without a tag filter)To Reproduce
Steps to reproduce the behavior:
./gradlew test
. This will fail because 2/4 test classes have an initialization error (NullPointerException
)@MyNewTag
. The command to run the filtered tests is./gradlew test -DincludeTags=tags.MyNewTag
. This command will pass. However, this should have failed because the classfoo.bar.InvalidTestWithTag
has aNullPointerException
during construction and also has the tag@MyNewTag
annotated.Expected behavior
Ideally, the last step above should have failed. In the current implementation, the "failed to init" test class is just skipped. However, the failed to init class should also have run and reported a failure.
I looked at the code and I think I know where the bug is. The original scala test class can be wrapped in one of these two descriptors
Since the
ScalatestFailedInitDescriptor
does not have tags (returns empty tags from the super class), any classes that failed to construct, will never pass theincludeTags
filtering done by JUnit. I think theScalatestFailedInitDescriptor
should also have the tags from the actual scala test class just likeScalatestTestDescriptor
Screenshots
includeTags
We can clearly see (
INFO
line) that 3 test classes were skipped because they do not match tag expression. Ideally, only two should have been skipped and we should have run two test classes (out of which one will pass and one will fail)Build/Test environment:
Let me know if you guys have the time to work on this or else I am happy to provide a patch for this (using the bug description I put above)
The text was updated successfully, but these errors were encountered: