Integrating Specs2 Results with Jenkins

I want to integrate Specs2 test results with Jenkins.

I added the following properties to sbt:

recognizer:

"maven specs2" at "http://mvnrepository.com/artifact" 

libraryDependencies:

 "org.specs2" %% "specs2" % "2.0-RC1" % "test", 

System property:

 testOptions in Test += Tests.Setup(() => System.setProperty("specs2.outDir", "/target/specs2-reports")) //Option1 //testOptions in Test += Tests.Setup(() => System.setProperty("specs2.junit.outDir", "/target/specs2-reports")) //Option2 testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "console", "junitxml") 

If I run the command below, it does not generate any specification reports in the above directory ("/ target / specs2-reports").

sbt> test

If I run the command below, it requests a directory, as shown in the error message below:

sbt> test-only - junitxml

[error] Failed to run test code .model.UserSpec: java.lang.IllegalArgumentException: junitxml requires specifying a directory, for example: junitxml (directory = "xxx")

And it only works if I provide a directory as shown below:

sbt> test-only - junitxml (directory = "\ target \ specs-reports")

But sometimes it does not generate all specifications, xmls reports (sometimes it generates only one report, sometimes only two reports, etc.).

If I give test-only - junitxml (directory = "\ target \ specs-reports") in jenkins, it gives the following error.

 [error] Not a valid key: junitxml (similar: ivy-xml) [error] junitxml( [error] ^ 

My main goal: I want to generate consolidated test reports in junit xml format and integrate with Jenkins. Please help me solve my problem.

Best wishes,

Hari

+7
jenkins sbt specs2
source share
1 answer

The parameter for the junitxml output directory is "specs2.junit.outDir", and the default value is "target / test-reports".

So, if you don't change anything, you can just give Jenkins the ability to capture xml files from the β€œtarget / test reports”, which I usually do.

Also, you may have to enclose your sbt commands in Jenkins with quotes. This is what I usually do:

 "test-only -- html junitxml console" 
+8
source share

All Articles