Skip to content
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

Fix kotlin unit tests #513

Merged
merged 7 commits into from
Nov 1, 2019

Conversation

chrisgresty
Copy link
Contributor

@chrisgresty chrisgresty commented Nov 1, 2019

Kotlin tests are run by a JUnit 5 test runner. The styx-proxy component has Kotlin unit tests as well as TestNG unit tests, but the Maven Surefire plugin does not, by default, run both JUnit and TestNG tests in the same project.

The surefire plugin needs to be configured with two executions - one each for JUnit5 and TestNG - and the default execution disabled.

Surefire determines which test framework to use by examining the test classpath. If it finds the appropriate dependency ("junit:junit", "org.junit.platform:junit-platform-engine" or "org.testng:testng" for JUnit4, JUnit5 and TestNG respectively) it executes that framework.

The two custom executions defined here disable the unwanted frameworks for each case, leaving only one that will run. It does this by changing the name of the dependency artifacts that the surefire plugin is looking for. (i.e. by setting the TestNG artifact name to "none:none", surefire will not find that on the test classpath and so will not try to run TestNG tests in that execution.)

The config parameters used are testNgArtifactName, junitArtifactName and junitPlatformArtifactName - as listed here: http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html

The original inspiration for this approach came from here: https://issues.apache.org/jira/browse/SUREFIRE-377

Copy link
Contributor

@mikkokar mikkokar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a quick comment in the POM file explaining how the TestNG and JUnit5 activation works.

@chrisgresty chrisgresty merged commit 14c15e7 into ExpediaGroup:master Nov 1, 2019
@chrisgresty
Copy link
Contributor Author

Please add a quick comment in the POM file explaining how the TestNG and JUnit5 activation works.

I added details in the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants