How to fix "Test reports were found but none of them are new. Did tests run?" in Jenkins

Solution 1:

You could try updating the timestamps of the test reports as a build step ("Execute shell script"). E.g.

cd path/to/test/reports
touch *.xml

Solution 2:

mvn clean test 

via terminal or jenkins. This generates new tests reports.

The other answer that says cd path/to/test/reports touch *.xml didn't work for me, but mvn clean test yes.

Solution 3:

Updating the last modified date can also be achieved in gradle itself is desired:

task jenkinsTest{
    inputs.files test.outputs.files
    doLast{
        def timestamp = System.currentTimeMillis()
        test.testResultsDir.eachFile { it.lastModified = timestamp }
    }
}

build.dependsOn(jenkinsTest)

As mentioned here: http://www.practicalgradle.org/blog/2011/06/incremental-tests-with-jenkins/