Android Build with Mockk BehaviorSpec Unit Test Fails

testing
android
#1

Bitrise Build Issue Report template

Description of the issue

We have written our unit tests using the Mockk Framework:
testImplementation "io.mockk:mockk:1.9.1"

This is the testImplementation section of our gradle file as it stands today:
testImplementation “androidx.test.espresso:espresso-core:3.3.0”
testImplementation “androidx.test.ext:junit:1.1.2”
testImplementation ‘androidx.test:core-ktx:1.3.0’
testImplementation ‘androidx.test.espresso:espresso-core:3.3.0’
testImplementation ‘androidx.test.ext:junit:1.1.2’
testImplementation ‘androidx.test:runner:1.3.0’
testImplementation(“com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0”)
testImplementation “com.squareup.okhttp3:mockwebserver:4.2.1”
testImplementation “com.willowtreeapps.assertk:assertk-jvm:0.20”
testImplementation “io.kotlintest:kotlintest-runner-junit5:3.4.2”
testImplementation “io.mockk:mockk:1.9.1”
testImplementation “org.assertj:assertj-core:3.13.2”
testImplementation “org.hamcrest:hamcrest-library:2.2”
testImplementation group: ‘org.jetbrains.kotlinx’, name: ‘kotlinx-serialization-runtime-common’, version: ‘0.4.1’
testImplementation(“org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0”)
testImplementation(“org.jetbrains.kotlin:kotlin-reflect:$coroutines_version”)
testImplementation “org.mockito:mockito-core:3.1.0”
testImplementation “org.robolectric:robolectric:4.4”
testImplementation “org.slf4j:slf4j-simple:1.7.28”

For the sake of troubleshooting on Bitrise, I have removed all except for a single unit test. The unit test is failing on Bitrise. The symptoms are similar to this thread. I followed the suggestions provided in that thread to no prevail.

This is the error that I received:
* What went wrong:

    Execution failed for task ':tradesy:testDevDebugUnitTest'.
    > Received a completed event for test with unknown id '7.4'. Registered test ids: '[7.2, 7.1, :tradesy:testDevDebugUnitTest]'

If you have access, a link to the most recent log is located here.

Environment:

Where did the issue happen?

If on Bitrise.io: which stack? If not on Bitrise.io: on what operating system? (Plus any other information you can share)
The failure occurred on Bitrise, Android + Docker on Ubuntu 16.04

Which build Step causes the issue and which version of the step?
android-unit-test

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : Every time
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : I created this app today, and pointed to a particular branch, which contains the latest source code changes exclusively for Bitrise.

Local reproduction

Can it be reproduced on your own Mac/PC by following our local debug guide? Please follow at least the first section (“Testing with a full clean git clone”) to make sure to test the state of the code what bitrise.io will get when it does a git clone in the clean environment! If possible please note which sections you tried.

Local reproduction: Linux / Android (docker based) stack builds

Can it be reproduced by running the build locally, after doing a new git clone of the repository into the /tmp directory and running the build from there with the Bitrise CLI ( https://www.bitrise.io/cli )? If no, can it be reproduced with Docker (using the same docker images / environment we use on bitrise.io)? Related guide: http://devcenter.bitrise.io/docker/run-your-build-locally-in-docker/ .

Build log

0 Likes

#2

I see that the JVM on Bitrise differs from that on my local machine:
+ /bitrise/src/gradlew tasks --v
------------------------------------------------------------
Gradle 7.0
------------------------------------------------------------
Build time: 2021-04-09 22:27:31 UTC
Revision: d5661e3f0e07a8caff705f1badf79fb5df8022c4
Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant™ version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_282 (Private Build 25.282-b08)
OS: Linux 4.4.0-57-generic amd64

Is it possible to change the JVM on Bitrise?

0 Likes