On Spek 1.x and Android, if I run my regular JUnit...
# spek
d
On Spek 1.x and Android, if I run my regular JUnit4 tests, I get
Empty test suite
, is this a known issue? Is there some kind of workaround?
r
Have you annotated your class with
@RunWith(JUnitPlatform::class)
?
d
I didn't see that documented anywhere, is that required when running both Spek and regular JUnit tests? The default is Spek, so the compiler needs to know there's another type of test to find? A bit funny, since I used the JUnit configuration in AndroidStudio to run that test (the green arrow), not the Spek configuration (run specs in...). I'll try when I get back to work later on, thanks!
r
I would suggest not to use it and treat Spek and JUnit tests separately - meaning you can't run them at the same time with a single run configuration.
@RunWith(...)
just works because JUnit 5 implemented a support for JUnit 4. Pros is you can run tests for the two frameworks at the same time, but you lose the ability to run a specific group within a Spek test.
just an fyi. When you have
@RunWith(...)
it's not the spek plugin that's doing the execution but the built-in JUnit 4 support IJ has.
d
How could I set that up? I'm currently just running them from the ide's green arrows or the right click menu on the source tree. Even when running an only-junit test it tells me that error...
r
Do you have the plugin installed? Can you grab a screenshot from IJ on the test you're trying to execute?
d
The plugin is installed, it was working before... i'm not in front of my computer now, but it's a regular junit4 test class. Just once in a while I get this error...
I just updated junitPlatform and android junit to 1.2.0.0, with all new deps, and Android Studio 3.2 with plugin 3.2.0... I removed all
junitPlatform { install/installEngine 'spek' }
from Gradle, did an invalidate cache/restart on AS, but still have Spek 1.x running specs, and JUnit doesn't work... is there any current example for this? I've spent about 2 days looking all over for answers and trying different things... @raniejade
I wouldn't mind splitting up the tests on different configurations, but I'm not sure how to go about it...
t
I solved same problem, but in my case it was with
kotlintest
. I updated all junit platform, vintage-engine and jupiter-engine to max version, also amped up gradle and android plugin
d
Thanks, which versions did you use?
r
Hmmm, can you test out with a proj with only junit 4 tests? Want to make sure if Spek is causing your issue.