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,
Error: Test events were not received android
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)
That’s actually more a JUnit question, than a Gradle question.
You are simply using JUnit wrongly I’d say.
You annotate your class with @RunWith(JUnitPlatform::class).
By doing so, you are saying “I will run this test through JUnit 4”.
If you run it through JUnit 4, the RunWith uses the JUnitPlatform runner to actually execute the test with the JUnit 5 platform.
But by stating that you will use JUnit 4 to start that test, JUnit 5 ignores it.
If you remove the @RunWith annotation, your test will probably be discovered by Jupiter.
Test classes and suites annotated with @RunWith(JUnitPlatform.class)cannot be executed directly on the JUnit Platform (or as a “JUnit 5” test as documented in some IDEs). Such classes and suites can only be executed using JUnit 4 infrastructure.
Well, then either your IDE has a bug, or you didn’t set up the class correctly I’d say.
Does it work from command line after you removed the annotation?
If not I guess your class is not set up correctly.
But I don’t use JUnit Jupiter and this is a Gradle forum, so at least me I cannot help further then.