Hi, I wanted to try out Power-Assert on my Android...
# power-assert
b
Hi, I wanted to try out Power-Assert on my Android project, but it just does not work When I perform the same setup for a random JVM application on IntelliJ Idea it works correctly
b
I wonder if something is special in the android project and test source sets are not being detected properly. Could you try adding source sets to the
includedSourceSets
configuration to see if that helps? Otherwise I will need a sample project to figure out what could be wrong.
b
You're right, good guess. It required me to specify the source set as
releaseUnitTest
(I'm running tests on release, also just
releaseTest
doesn't work) It seems like I'm also having some trouble with assertions. I'm using JUnit4
Assert.assertEquals
for assertions, so I've specified
functions = listOf("org.junit.Assert.assertEquals")
but it also doesn't work. It started to work when I changed the test to use
kotlin.assert
. Am I setting it wrong?
b
Unfortunately, JUnit 4 assert overloads put the message as the first parameter which is unsupported by power-assert. You could use kotlin.test or some other library if you are willing to migrate.
b
Well, thanks for your help. Will migrate if I have time, because this plugin is amazing :/
b
Also, if you wouldn't mind, could you create a ticket (kotl.in/issue) for the Android test source set problem? We should make sure Android projects have their test source sets configured correctly. You are also welcome to create a ticket for the JUnit4 assertion issue as well. It would require some special syntax in the
functions
configuration, but it is been something I've considered adding, just haven't thought much about the exact syntax.
b
Sure Here's for Android sources https://youtrack.jetbrains.com/issue/KT-68534/Power-Assert-Android-sources-support And here's for JUnit4 assertions support https://youtrack.jetbrains.com/issue/KT-68535/Power-Assert-support-for-JUnit4-assertions Thanks for help, this plugin is amazing and can't wait for it to go stable!
thank you color 1