2016-08-01 3 views
0

Jenkins에서 cobertura 플러그인을 설치하고 아래 명령으로 유닛 테스트를 실행했습니다. #go test -cover -p 1 $PKGS | go-junit-report > report.xml. report.xml이 코드 적용 범위로 생성 된 것을 볼 수는 있지만 Jenkins 콘솔에서는 아래 오류가 표시됩니다. 문제가 무엇인지, 문제를 해결하는 방법을 알려 주시기 바랍니다.cobertura 플러그인을 사용하여 Jenkins의 코드 커버리지 보고서

/bin/sh -xe /tmp/hudson1811800402022775798.sh 
[Cobertura] Publishing Cobertura coverage report... 
FATAL: Unable to find coverage results 
java.io.IOException: <workspace>/report.xml is not a cobertura coverage report, please check your report pattern 
    at hudson.plugins.cobertura.CoberturaPublisher$ParseReportCallable.invoke(CoberturaPublisher.java:566) 
    at hudson.plugins.cobertura.CoberturaPublisher$ParseReportCallable.invoke(CoberturaPublisher.java:536) 
    at hudson.FilePath.act(FilePath.java:1018) 
    at hudson.FilePath.act(FilePath.java:996) 
    at hudson.plugins.cobertura.CoberturaPublisher.perform(CoberturaPublisher.java:343) 
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) 
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) 
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720) 
    at hudson.model.Build$BuildExecution.post2(Build.java:185) 
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665) 
    at hudson.model.Run.execute(Run.java:1766) 
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
    at hudson.model.ResourceController.execute(ResourceController.java:98) 
    at hudson.model.Executor.run(Executor.java:410) 
[Cobertura] No coverage results were found using the pattern '**/report.xml' relative to '<some directory>'. Did you enter a pattern relative to the correct directory? Did you generate the XML report(s) for Cobertura? 
Build step 'Publish Cobertura Coverage Report' changed build result to FAILURE 
Finished: FAILURE 

답변

0

내가 아래 사용 (이동 언어에 대한) 적용 범위 보고서

gocovxml

이 gocov XML을 설치를 생성하는 단계 아래 따랐다 당신이있는 경우

$ go get github.com/axw/gocov/... 
$ go get github.com/AlekSi/gocov-xml 

가 이동 테스트 명령을 실행 명령 다중 패키지

gocov test $PKGS -p 1 | gocov-xml > report.xml 
cobertura 커버리지 보고서 (포스트 젠킨스의 조치를 구축) 게시에

**/report.xml 
report.xml을 제공
관련 문제