Using gtest in jenkins

Viewed 39299

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, so what I set is as follows:

Screenshot

But it ends up with errors after a building.

No test report files were found. Configuration error?
Build step 'Publish JUnit test result report' changed build result to FAILURE
Finished: FAILURE

6 Answers

Here is a windows batch version for converting the google-test "notRun" to junit "skipped" via windows batch. I know that there are more elegant ways, but this one only requires windows batch and does the job

rem convert gtest xml to junit compatible format (replace notRun by skipped)
IF EXIST  %INTEXTFILE% (
    IF EXIST %OUTTEXTFILE% (
        del %OUTTEXTFILE%
        waitfor fileSystemToDoItsStuff /t 1
    )
    FOR /f "tokens=1,* delims=¶" %%A IN ( '"type %INTEXTFILE%"') DO (
        ECHO."%%A" | findstr /C:"DISABLED_">nul & IF ERRORLEVEL 1 (
            SET modified=%%A
        ) ELSE (
            SET string=%%A
            SET modified=!string:/^>=^>^<skipped /^>^</testcase^>!
        )
        ECHO !modified!>> %OUTTEXTFILE%
    )
    del %INTEXTFILE%
    waitfor fileSystemToDoItsStuff /t 1
    move %OUTTEXTFILE% %INTEXTFILE%
)
Related