Using gtest in jenkins

前端 未结 6 1887
情话喂你
情话喂你 2020-12-24 12:35

I successfully run my unit test with google test in Jenkins, but I don\'t know how to show the .xml file generated by gtest. It is said that gtest satisfies the JUnit format

6条回答
  •  伪装坚强ぢ
    2020-12-24 13:09

    Jenkins has xunit plugin that converts googletest xml to junit format: https://plugins.jenkins.io/xunit/.

    Example of pipeline

    pipeline {
        agent any
        stages {
            stage('Test'){
                steps {
                    sh "run_tests.bash"
                }
            }
        }
        post {
            always{
                xunit (
                    thresholds: [ skipped(failureThreshold: '0'), failed(failureThreshold: '0') ],
                    tools: [ GoogleTest(pattern: 'reports/*.xml') ])
                )
            }
        }
    }
    

    Other useful links:

    • https://jenkins.io/doc/pipeline/steps/xunit/
    • https://jenkins.io/blog/2016/10/31/xunit-reporting/

提交回复
热议问题