2016-08-01 12 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 

が行くtestコマンドを実行するコマンド複数のパッケージ

gocov test $PKGS -p 1 | gocov-xml > report.xml 

でreport.xmlを提供Coberturaのカバレッジレポートを公開(ポストジェンキンスでアクションを構築する)

**/report.xml 
関連する問題