Are we supposed to use the `check` task to run tes...
# multiplatform
b
Are we supposed to use the
check
task to run tests in kotlin-multiplatform for the common code? I'm running check, and it's succeeded but isn't really doing anything
d
What do you mean is is not doing anything? In my project I have created several unit tests for the common module (my targets are jvm and iOS). Running the
check
task you execute all the unit tests (for iOS you’ll have to add an extra task to run the tests on a simulator)
b
Here's the output:
Copy code
Testing started at 09:50 ...
09:50:56: Executing task 'check'...

> Configure project :
Kotlin Multiplatform Projects are an experimental feature.
> Task :check UP-TO-DATE
BUILD SUCCESSFUL in 0s
09:50:56: Task execution finished 'check'.
And then in another pane it says
Tests passed: 0
I have one test with an assert, and i also added a
println
for good measure
d
I was about to suggest that (make a test fail)
Can you share your build.gradle file?
What is your project structure? By default all the common code goes in the
commonMain
folder and the tests goes in
commonTest
folder
b
screenshot of commonTest with the file with the test
here's my
commonTest
block from `build.gradle`:
Copy code
commonTest {
            dependencies {
                implementation deps.kotlin.test.common
                implementation deps.kotlin.test.annotations
            }
        }
(deps is a dictionary used to organize our deps 🙂)
d
Check you have these two lines in your commonTest dependencies:
Copy code
implementation 'org.jetbrains.kotlin:kotlin-test'
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
In my project I just commented out these lines, run
check
and the build was successful so check you have them both in order to be able to run the tests for common.
b
Still nothing unfortunately. When you run check, it runs tests for you?
d
Yes
b
I'm not building for JDK locally. I'm betting you happen to be though, which is why it's working? unsure though