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

Tests do not run when using maven-surefire-plugin version 3.0.0-M7 #90

Closed
anatolyra opened this issue Sep 22, 2022 · 5 comments · Fixed by #92
Closed

Tests do not run when using maven-surefire-plugin version 3.0.0-M7 #90

anatolyra opened this issue Sep 22, 2022 · 5 comments · Fixed by #92
Assignees
Labels
bug Something isn't working

Comments

@anatolyra
Copy link

When using maven-surefire-plugin version 3.0.0-M7 tests do not run from command-line.

Steps to reproduce the behavior:

  1. git clone scalatest-junit-runner
  2. Changed the version of maven-surefire-plugin to 3.0.0-M7
  3. Run in command-line: mvn clean test -Dtest=SomeCodeTest
  4. See output: Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

Expected behavior
Two tests in 'SomeCodeTest' should run and succeed.

Build/Test environment:

  • Maven 3.8.6
  • Scala version - 2.13.1/2.13.8
  • Scalatest version: 3.2.0-M3/3.2.13
  • maven-surefire-plugin version 3.0.0-M7
  • Java versions 1.8 and 17
@anatolyra
Copy link
Author

anatolyra commented Sep 22, 2022

Two more things that I have noticed:

The highest version which still works is 3.0.0-M3. When running with versions 3.0.0-M4 and 3.0.0-M5 I get an error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project scalatest-junit-runner-maven-example: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]

But when running with versions 3.0.0-M6/7 I don't get any error:

CustomListener: execution FINISHED: SomeCodeTest with result: SUCCESSFUL
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.069 s - in co.helmethair.scalatest.example.SomeCodeTest
CustomListener: execution FINISHED: scalatest with result: SUCCESSFUL
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.620 s
[INFO] Finished at: 2022-09-22T21:56:15+03:00
[INFO] ------------------------------------------------------------------------

@giurim giurim self-assigned this Sep 26, 2022
@giurim giurim added the bug Something isn't working label Sep 26, 2022
@giurim
Copy link
Contributor

giurim commented Sep 26, 2022

Thank you for the report and the patience!

The highest version which still works is 3.0.0-M3. When running with versions 3.0.0-M4 and 3.0.0-M5 I get an error:

The cause of this is that there is no really good way (or I did not figured out) to report tests which are not strictly functions:

executionFinished(TestIdentifier [uniqueId = '[engine:scalatest]/[suite:co.helmethair.scalatest.example.SomeCodeTest]/[test:someFunc in SomeCode calculates square]', parentId = '[engine:scalatest]/[suite:co.helmethair.scalatest.example.SomeCodeTest]', displayName = 'someFunc in SomeCode calculates square', legacyReportingName = 'someFunc in SomeCode calculates square', source = MethodSource [className = 'co.helmethair.scalatest.example.SomeCodeTest', methodName = 'someFunc in SomeCode calculates square', methodParameterTypes = null], tags = [], type = TEST], TestExecutionResult [status = SUCCESSFUL, throwable = null])

The important part here is the methodParameterTypes which is null because when create the TestSource object I call MethodSource.from(containingSuite.getSuiteId(), testName)); which sets the methodParameterTypes to null. Passing a third parameter (an empty string) seems to solved the problem for M4, M5, M6 and M7.

It is unfortunate that M6/M7 even swallowed the exception, thank you very much for the additional report it helped to track down the problem a lot.

Expect a minor version released with the fix soon.

@anatolyra
Copy link
Author

@giurim thank you! I appreciate that.

@giurim
Copy link
Contributor

giurim commented Sep 26, 2022

0.1.12 released, should be available on Maven Central soon

@anatolyra
Copy link
Author

Thank you! This solves the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants