JUnitPerf icon indicating copy to clipboard operation
JUnitPerf copied to clipboard

JUnitPerfInterceptorSuite is this really hooks to suite only or to any test case

Open nagkumar opened this issue 2 years ago • 2 comments

image

I see this hooking onto every test case.

hence I see the report all these methods are not part of any suite as I am running zero suites in this case

image

nagkumar avatar Jun 10 '23 05:06 nagkumar

The branch you're testing on is still a proof of concept as to how suite level annotation support might be added.

Suite level lifecycle hooks in junit5 seem to be very limited.

I do not currently see a simple way of hooking in extensions to all classes in a test suite without using the global extension mechanism (i.e. org.junit.jupiter.api.extension.Extension)

That means the extension is applied to all tests when junit.jupiter.extensions.autodetection.enabled=true is set.

I have updated the branch associated with #89 to add a filtering mechanism for classes/tests not in the suite, so the extension will not be applied to these tests.

That should resolve the issue you see above.

However that branch is still a work in progress.

noconnor avatar Jun 10 '23 11:06 noconnor

Like JUnit, you must not have any logic specific to the suite, just think of loading and testing any test method, the way the suite happens to be multiple test cases that run with each suite. So even naming any annotation as JunitPerfSuite etc also mislead ..

So, any class or method Annotated with JUnitPerfTest can accept the load parameters and simply run that many times.

nagkumar avatar Jun 13 '23 02:06 nagkumar