elastic / apm-agent-java

https://www.elastic.co/guide/en/apm/agent/java/current/index.html
Apache License 2.0
567 stars 320 forks source link

Update all tests to use JUnit 5 #310

Open felixbarny opened 5 years ago

felixbarny commented 5 years ago

Now that testcontains supports JUnit 5, we should be able to update all remaining JUnit 4 tests to 5. The only thing which might be in the way that there is currently no way of having class-level parameters. But that is on JUnit's roadmap

Checklist

apm-agent-plugins/

integration-tests/

yatsenko-julia commented 5 years ago

I’ll work on this one.

videnkz commented 5 years ago

reference: https://github.com/junit-team/junit5/issues/878

SylvainJuge commented 1 year ago

@JonasKunz took the time to remove one of the main blockers we had to make progress on this topic: we can now run our "version integration tests" with JUnit 5 : https://github.com/elastic/apm-agent-java/pull/2962.

I have updated the issue description with a checklist of all the modules that still use Junit4.

JonasKunz commented 1 year ago

The only thing which might be in the way that there is currently no way of having class-level parameters. But that is on JUnit's roadmap

Looks like this is still is open, currently parametrization is only possible on method level (JUnit Issue). I think we should be able to switch to method-level parametrized tests, however there will be problems in cases were we use inheritance to reuse common tests, e.g. AbstractHttpClientInstrumentationTest. Tests inheriting from this class can no longer be parametrized (e.g. our RestTemplate tests). Maybe using Test Templates might be a viable solution here for such general-purpose tests bases.