Google Test XML report processing fails on Windows but not macOS when no reports are generated

TeamCity Professional 2024.07.3 (build 160765)

I have two build configurations that are identical except for the agent OS (one macOS, one Windows). Both use XML Report Processing, Google Test. These are triggered via PR.

I run tests depending on the PR branch. For example, if the branch is “release”, I run tests in a build step and generate an xml report. If the branch is “development”, I skip these tests and no report is generated.

On MacOS, when I run the tests, I see the xml reporting as expected. And when I do not run the tests, I simple see “success”. In the build log I see the following when the tests have not been run:

16:58:33 Google Test report watcher
16:58:33   No reports found for paths:
16:58:33   /Users/robot/TeamCity/buildAgent/work/pull_request_development/tests/test_results.xml

This is not the case on Windows. When the tests are not run, the XML reporter causes the build to fail. In the build log, I see this:

17:11:14 Google Test report watcher
17:11:14   No reports found for paths:
17:11:14   Error message: No reports found for paths:
17:11:14   D:\BuildAgent\work\pull_request2_development\tests


The xml reporting build feature looks like this for both projects (the id is different):

        xmlReport {
            id = "BUILD_EXT_26"
            reportType = XmlReport.XmlReportType.GOOGLE_TEST
            rules = "tests/test_results.xml"
        }

It would be nice if I could get the same behavior as what is happening on the mac agent, that is, if XML Reporting fails, it does not fail the build. Alternatively, some configurable options for this behavior on this build feature would be most welcome.

0
1 comment

Hi Luis,

I tried to reproduce this issue using the latest TeamCity version 2024.11.2, but I was not able to reproduce it.

If there is no report generated in the monitored path, TeamCity will not produce any related XML Report Processing logs in the build log, which matches the expected behavior.

If possible, we recommend upgrading to the latest TeamCity version.

You can refer to the official upgrade guide here

To instead of using the XML Report Processing build feature, you can also import test reports explicitly using a TeamCity service message in the following format:

##teamcity[importData type='typeID' path='<path to the xml file>']

For your reference, below is a Windows PowerShell example that conditionally imports Google Test reports based on the branch name:

# TeamCity variable replacement
$branch = "%teamcity.build.branch%"
Write-Host "Current branch is: $branch" 
# You can match according to your branch name.
if ($branch -match "release") {
    Write-Host "[INFO] Release branch detected. Running tests..."
    # Insert your test execution command here, e.g.:
    # ./run_tests.exe --gtest_output="xml:tests/test_results.xml"
    Write-Host "##teamcity[importData type='googleTest' path='tests/test_results.xml']"
} else {
    Write-Host "[INFO] Branch is $branch. Skipping reporting to prevent failures."
}
0

Please sign in to leave a comment.