How To Run A Junit5 Test With Android Dependencies And Robolectric
I am trying to run a unit test like that: @org.junit.jupiter.api.Test void junit5codeCoverage() { final int result = new Foo().junit5(); Assert.assertEqual
Solution 1:
I am trying to do this too, but it seems that at the time of this writing, Robolectric simply does not support junit5.
See the discussion here: https://github.com/robolectric/robolectric/issues/2996
Some workarounds are described in that discussion, but for now I am just going to stick to junit4.
Solution 2:
You can use junit-vintage-engine
to run test with runners from JUnit4.
Just add org.junit.vintage:junit-vintage-engine
to your dependencies, thus you can org.junit.runner.RunWith
annotation to your tests.
Post a Comment for "How To Run A Junit5 Test With Android Dependencies And Robolectric"