Closed HardNorth closed 3 years ago
Yes, I didn't add support for "theories". JUnit Foundation
currently only supports the @Test
annotation. I'll see how much work will be required to add support for "theories".
I'm adding support for the Theories runner. There's a significant issue with the core JUnit implementation of this runner, though - it doesn't report each individual iteration of the "theory" methods it runs. It reports each "theory" as a single test, regardless of how many applicable assumptions there are. Also, iteration terminates if a failure is encountered, even if there are data points that have yet to be evaluated. JUnit Foundation reports the invocation of each iteration of the "theory" method separately to all MethodWatcher listeners, so this can be worked around to some extent. However, I'm not sure it's worth the effort.
@HardNorth - Release 12.4.0 has been published.
@HardNorth - I'm working on a PR that adds lifecycle events for Theory method permutations: #80 To make this work, I need to generate method Descriptions with unique IDs that incorporate the values of the invocation arguments. These are hashed and appended to the display name as hexadecimal. This enables event subscribers to get the class runner that invoked them, which retains the arguments. This also enables you to differentiate between Theories runner method events and TheoryAnchor method permutation events.
@HardNorth - Pull request #80 has been merged, and new release 12.4.1 has been published. I think you'll be pleased.
@sbabcoc Sure, thank you very much!
@sbabcoc Verified. I’ve updated our JUnit agent with new JUnit Foundation. Theories look great! I’ve implemented several tests and haven’t met any issues.
Excellent news! Thanks for the feedback! I was pretty pleased with the sleight-of-hand Statement
shuffle I came up with to get this to produce the full complement of lifecycle events.
Despite the fact that it's marked as 'experimental' 'Theories' framework is a pretty old feature. I can track it up to JUnit 4.6, the earliest version available on github. But if I try to run even a simplest test with
@Theory
annotation JUnit Foundation fails with a NullPointerException:I've prepared a pack of tests to reproduce the issue, they are located here: https://github.com/reportportal/agent-java-junit/tree/develop/src/test/java/com/epam/reportportal/junit/features/theory
Here is an example of a simple test which fails: