Closed nicodn closed 5 years ago
@ndinoia yes, for sure.
@akoltochihin could you plz share example?
The new implementation of agent-java-junit
based on JUnit Foundation makes this super easy. This new agent currently lives in the v4
branch, but I'm understanding this will be merged into master
any day now. Find the details of hooking up JUnit run listeners via JUnit Foundation here:
https://github.com/Nordstrom/JUnit-Foundation/blob/master/README.md#support-for-standard-junit-runlistener-providers
The new implementation of
agent-java-junit
based on JUnit Foundation makes this super easy. This new agent currently lives in thev4
branch, but I'm understanding this will be merged intomaster
any day now. Find the details of hooking up JUnit run listeners via JUnit Foundation here: https://github.com/Nordstrom/JUnit-Foundation/blob/master/README.md#support-for-standard-junit-runlistener-providers
Thanks @sbabcoc! We've decided to hold off adopting ReportPortal for now due to conflicts with our custom jUnit parameterized runners but I'll make a note to take a look at this down the road.
You're in luck! The new JUnit agent will work with your parameterized runner, because it hooks in via a Java agent instead of requiring a custom runner. Give it a try to see how it works for you. https://github.com/Nordstrom/JUnit-Foundation#how-to-enable-notifications JUnit Foundation hooks into the test execution flow by intercepting core JUnit methods:
ReflectiveCallable.runReflectiveCall()
ParentRunner.createTestClass()
ParentRunner.run()
BlockJUnit4ClassRunner.createTest()
BlockJUnit4ClassRunner.runChild()
JUnit Foundation provides run-time access to core objects and classes that would otherwise be unavailable. For example, LifecycleHooks.getRunnerFor(TestClass)
returns the test runner that owns the specified test class object. In your example, this would be your custom parameterized runner.
BTW - I never provided a link to the v4
agent: https://github.com/reportportal/agent-java-junit/tree/v4
@nicodn Another bonus for your parameterized tests! You can record the test parameters with your results by implementing the ArtifactParams interface. Take a look at ParameterizedTest for an example of how this works.
In your README.md you have this maven pom setup:
Is it possible to do this with gradle?
Thanks