Skip to content

JUnit5 generates a negative execution time for test case unexpectedly #363

Description

@ZzhengSyna

This should be a rare scenario, I haven't seen it before.
Basically I was running a JUnit5 test on an android S device, using ./gradlew connectedDebugAndroid. Inside my test project, there are 9 cases, each is run with @RepeatedTest(9), so if everything goes well, there should be 81 cases in total.

Now I ran this suite for multiple times, and met twice of the below issue:
During my test, something goes wrong(should be a bug in the android system), from the console log of the android device, I can see the android system crashed with a Kernel panic. So the test suite was terminated, somehow, an invalid test duration was generated: time="-1.73649439603E9".

From the generated xml test report, I can see something like this:

<testcase classname="com.xxx.MainTest" name="testFrameDropTunnelModeEnabled: repetition 1 of 9" time="109.09"/>
<testcase classname="com.xxx.MainTest" name="testFrameDropTunnelModeEnabled: repetition 2 of 9" time="107.962"/>
<testcase classname="com.xxx.MainTest" name="testFrameDropTunnelModeEnabled: repetition 3 of 9" time="107.832"/>
<testcase classname="com.xxx.MainTest" name="testFrameDropTunnelModeEnabled: repetition 4 of 9" time="108.991"/>
<testcase classname="com.xxx.MainTest" name="testFrameDropTunnelModeEnabled: repetition 5 of 9" time="107.835"/>
<testcase classname="com.xxx.MainTest" name="testFrameDropTunnelModeEnabled: repetition 6 of 9" time="107.884"/>
<testcase classname="com.xxx.MainTest" name="testFrameDropTunnelModeEnabled: repetition 7 of 9" time="107.725"/>
<testcase classname="com.xxx.MainTest" name="testFrameDropTunnelModeEnabled: repetition 8 of 9" time="-1.73649439603E9"/>
<testcase classname="com.xxx.MainTest" name="testVerticalTunnelModeEnabled: repetition 1 of 9" time="21.424"/>
<testcase classname="com.xxx.MainTest" name="testVerticalTunnelModeEnabled: repetition 2 of 9" time="20.345"/>
<testcase classname="com.xxx.MainTest" name="testVerticalTunnelModeEnabled: repetition 3 of 9" time="-1.736494169664E9"/>

Note the two special execution time: time="-1.73649439603E9" and time="-1.736494169664E9".
This is unexpected, I think JUnit should set them as failure or error?

The plugins I'm using:

// In project level build.grale
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'de.mannodermaus.gradle.plugins:android-junit5:1.6.0.0'
// In app level build.gradle
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArgument "runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder"

...

androidTestRuntimeOnly "de.mannodermaus.junit5:android-test-runner:1.2.0"

If additional info is required, please kindly let me know.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions