문제

I want to integrate the Specs2 test results with Jenkins.

I was added the below properties in sbt:

resolver:

"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 below command, it is not generating any specs reports in the above mentioned directory("/target/specs2-reports").

sbt> test

If I run the below command, it is asking for the directory as shown in the below error message:

sbt> test-only -- junitxml

[error] Could not run test code.model.UserSpec: java.lang.IllegalArgumentException: junitxml requires directory to be specified, example: junitxml(directory="xxx")

And it is working only if I give the directory as shown below:

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

But sometimes its not generating all the specs report xmls (some times generating only one report, sometimes only two reports etc.).

If I give test-only -- junitxml(directory="\target\specs-reports") in the jenkins it is giving the below error.

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

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

Best Regards,

Hari

도움이 되었습니까?

해결책

The option 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 could just instruct Jenkins to grab the xml files from "target/test-reports" which is what I usually do.

Also you might have to enclose your sbt commands in Jenkins with quotes. This is what I typically do:

"test-only -- html junitxml console"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top