Hey guys, the problem that was happening with Andr...
# spek
j
Hey guys, the problem that was happening with AndroidStudio3.0 is still happening?
s
We managed to hack around configuration to work with AS3.0 https://github.com/paulinabls/hangman/pull/4
j
@sngrekov I've downloaded the project and try to run the tests that are into the project but I'm still getting an error.
The stack trace is printing the following message:
Copy code
org.junit.platform.launcher.core.DefaultLauncher handleThrowable
WARNING: TestEngine with ID 'spek' failed to discover tests
org.junit.platform.commons.util.PreconditionViolationException: Could not load class with name: com.example.GameTest
	at org.junit.platform.engine.discovery.ClassSelector.lambda$getJavaClass$0(ClassSelector.java:71)
	at java.util.Optional.orElseThrow(Optional.java:290)
	at org.junit.platform.engine.discovery.ClassSelector.getJavaClass(ClassSelector.java:70)
	at org.jetbrains.spek.engine.SpekTestEngine.resolveSpecs(SpekTestEngine.kt:79)
	at org.jetbrains.spek.engine.SpekTestEngine.discover(SpekTestEngine.kt:50)
	at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:130)
	at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:117)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
	at org.jetbrains.spek.tooling.runner.junit.JUnitPlatformSpekRunner.run(JUnitPlatformSpekRunner.kt:107)
	at org.jetbrains.spek.tooling.MainKt.main(Main.kt:58)
s
This is strange. How do you run it? ./gradlew clean test?
r
The problem is still there,
android-junit5:1.0.11
plugin added a workaround (copying kotlin classes to proper directories so it gets picked up by AS3.0)
j
@sngrekov I've opened a Spek test file and run him using AndroidStudio.
@raniejade can you tell me if the fact that I'm using Kotlin 1.1.51 may be affecting the operation of Spek?
Because event using the code in the repository that @sngrekov send men I'm still unable to run tests using Spek
s
Is "./gradlew clean test" works in your case?
j
Nope
I'm still trying to figure but I'm getting some sort of error involving gradle 3.0.0
s
Kotlin's version is not the case, I tried with 1.1.51 and it's fine
c
hack fix did not work for me either..
j
Hey @codeslubber any progress with this issue? I've tried a lot of stuff since yesterday and nothing work to me too...
@raniejade I had some progress due to Spek and AndroidStudio integration. But now I'm able to run the tests only on terminal by calling
gradle test
task.
Do you know if it is possible to run the tests directly from AndroidStudio? Or should I keep running my tests into terminal by the time being?
r
hey all, I'm looking into this. I'm setting up a working sample repo, so far I've got the gradle part working. I'm currently looking into the issue when you run the a test inside the ide
👍 2
update: found a lead on how to fix the issue on running tests in as3.0 - give me a day or two (it requires a bit of hacking)
👍 1
j
Yes sir, we will anxious wait for this fix 🙂
c
@jackmiras no, I tried several times with @raniejade and then tried this newer version.. I don't even care if underneath it uses 4 or 5 (of junit)...
j
@codeslubber this are my build.gradle files with Spek in him. build.gradle: https://codeshare.io/24P434 app/build.gradle: https://codeshare.io/50V47e Remembering that to run the tests I've executed the
gradle test
task via command line.
c
will try it again, so tests do not work inside the IDE?
r
Hey all, here's a sample working repo https://github.com/spekframework/spek-android-example. To get proper ide support you need to install this plugin https://drive.google.com/file/d/1JpUKuiXGovg0JEtGOsj9rscjQc6YNZ1b/view?usp=sharing. Please help out with the testing 🙂 Once everything is good, I'll publish a new build.
👍 2
downside plugin is now incompatible with AS
2.3
s
Thanks @raniejade Works fine. Except AS don't show test messages if tests were successful, only "All Tests Passed". Is it was supposed to be fixed?
r
there should be a button there that will show all tests that passed.
s
Ah, my bad, you're right
j
@raniejade there is any prediction about when the problem will be definitively solved? Because would be great if all the info in this thread be transcribed to Spek doc in the Android session in case of the solution take a time... If come in handy I can gladly do that and then when the final solution came out all we have to do is remove the notes about AndroidStudio3.0 from the doc.
r
I think the fix to the plugin is the correct way to go, the only problem is I'm not sure if the API I used is final or not. A new version of AS may break the integration again.
c
Finally plugged this in, thanks @raniejade for getting this to work, let's hope it holds..