Skip to content

Junit5 testSuite with SelectClasses not working in android unit test #2686

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

Closed
TheReprator opened this issue Aug 12, 2021 · 10 comments
Closed

Comments

@TheReprator
Copy link

TheReprator commented Aug 12, 2021

  • JUnit5: 5.7.1
  • JUnit Platform : 1.7.2
  • IDE: Android Studio

I am trying to create a test suite for Unit test of android application, but it always fails with different kinds of configuration error, one among that is as follows,

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':appModules:factList:testDebugUnitTest'.
No tests found for given includes: [reprator.wipro.factlist.FactListTestSuite]
(filter.includeTestsMatching)

RepoDetails: https://github.com/TheReprator/Wipro/tree/junit5
Branch: junit5

TestSuite Class: https://github.com/TheReprator/Wipro/blob/junit5/appModules/factList/src/test/kotlin/reprator/wipro/factlist/FactListTestSuite.kt

My whole code works perfectly with junit4 in master branch.

@sormuras
Copy link
Member

@TheReprator
Copy link
Author

@sormuras Can we have the solution, for above

@juliette-derancourt
Copy link
Member

@TheReprator Suites are not yet supported in 5.7.1, you still need JUnit 4 for that (see this paragraph of the user guide).

If you try to add the junit-vintage dependency, does it work?

@TheReprator
Copy link
Author

@juliette-derancourt yes, i had tried those as well, but didn't worked

@juliette-derancourt
Copy link
Member

juliette-derancourt commented Aug 13, 2021

Ah, my bad, I believe that you can only run JUnit 4 tests that way, so it won't work if you migrated those tests to Jupiter (which seems to be the goal of your branch).

I think you will have to wait for the release of 5.8 to use the new suite support (see #744, which is already included in 5.8-M1).

@sormuras
Copy link
Member

@TheReprator
Copy link
Author

@sormuras Yes, i am doing the same

@TheReprator
Copy link
Author

@juliette-derancourt now from the #744 , i also think, i had to wait for the releaseof 5.8-M1

@TheReprator
Copy link
Author

TheReprator commented Aug 22, 2021

finally suite is accomplished with,

    testImplementation("org.junit.platform:junit-platform-suite:1.8.0-RC1")
    testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.0-RC1")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.0-RC1")

Repo:
https://github.com/TheReprator/Wipro/blob/master/appModules/factList/src/test/kotlin/reprator/wipro/factlist/FactListTestSuite.kt

@sbrannen
Copy link
Member

Thanks for the feedback, @TheReprator!

Glad that the new @Suite engine works for you. 👍

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

No branches or pull requests

4 participants