test-reporter
test-reporter copied to clipboard
Error: TypeError: Cannot read properties of undefined (reading 'testsuite')
Hi,
my Qt Test generates an junit xml output that cannot be handled by the error reporter:
I always get the following error:
Error: TypeError: Cannot read properties of undefined (reading 'testsuite')
A stripped down version of the generated junit xml report file looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="29" failures="0" tests="7" name="IngDibaBackendTests">
<properties>
<property value="5.15.3" name="QTestVersion"/>
<property value="5.15.3" name="QtVersion"/>
<property value="Qt 5.15.3 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 11.3.0)" name="QtBuild"/>
</properties>
<testcase result="pass" name="initTestCase"/>
<testcase result="pass" name="testIngDibaUtilsConvertTimestampToLocalTimestamp">
<!-- message="dir : "/home/runner/work/harbour-watchlist/harbour-watchlist/test/cpp/IngDibaBackendTest"" type="qdebug" -->
<!-- message="Timezone for test : QTimeZone("Europe/Berlin")" type="qdebug" -->
<!-- message="dt : QDateTime(2020-10-14 20:22:24.000 CEST Qt::TimeZone Europe/Berlin ) using timezone : QTimeZone("Europe/Berlin")" type="qdebug" -->
</testcase>
<testcase result="pass" name="testIngDibaBackendIsValidSecurityCategory">
<!-- message="Initializing Data Backend..." type="qdebug" -->
<!-- message="Initializing Ing Diba Backend..." type="qdebug" -->
<!-- message="Initializing IngDiba News..." type="qdebug" -->
</testcase>
<testcase result="pass" name="testIngDibaBackendProcessSearchResult">
<!-- message="Initializing Data Backend..." type="qdebug" -->
<!-- message="Initializing Ing Diba Backend..." type="qdebug" -->
<!-- message="Initializing IngDiba News..." type="qdebug" -->
<!-- message="IngDibaBackend::processSearchResult" type="qdebug" -->
<!-- message=" sugg : QJsonValue(double, 88)" type="qdebug" -->
</testcase>
<testcase result="pass" name="testIngDibaNewsProcessSearchResult">
<!-- message="dt : QDateTime(2021-06-01 01:00:00.000 CEST Qt::TimeZone Europe/Berlin ) using timezone : QTimeZone("Europe/Berlin")" type="qdebug" -->
<!-- message="dt : QDateTime(2021-05-31 08:21:00.000 CEST Qt::TimeZone Europe/Berlin ) using timezone : QTimeZone("Europe/Berlin")" type="qdebug" -->
</testcase>
<testcase result="pass" name="testIngDibaNewsFilterContent">
<!-- message="Initializing Data Backend..." type="qdebug" -->
<!-- message="Initializing Ing Diba Backend..." type="qdebug" -->
<!-- message="Initializing IngDiba News..." type="qdebug" -->
</testcase>
<testcase result="pass" name="cleanupTestCase"/>
<system-err>
</system-err>
</testsuite>
I am not sure what's the problem here. May it is the fact that there is no enclosing
@andywuest Each test framework usually produces slightly different JUnit XML. I've not used this with the Qt test yet. There will be some nuance in the format causing the parser to fail. I will use the XML you posted to check for the issue. I will try to look into it later this week.
Hi @dorny, I am getting the same error for googletest output. It is created with ctest using the '--output-junit' flag. I am attaching the XML content, with the hope that you would have time to analyse it :) P.S: if all tests are passed, report is generated correctly without a problem.
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="(empty)"
tests="2"
failures="1"
disabled="0"
skipped="0"
hostname=""
time="0"
timestamp="2022-12-15T14:19:38"
>
<testcase name="IntPub_StringUtil.isPositiveDecimal" classname="IntPub_StringUtil.isPositiveDecimal" time="0.0140635" status="run">
<system-out>Running main() from C:\source\out\lib\googletest-src\googletest\src\gtest_main.cc
Note: Google Test filter = IntPub_StringUtil.isPositiveDecimal
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from IntPub_StringUtil
[ RUN ] IntPub_StringUtil.isPositiveDecimal
[ OK ] IntPub_StringUtil.isPositiveDecimal (0 ms)
[----------] 1 test from IntPub_StringUtil (0 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[ PASSED ] 1 test.
</system-out>
</testcase>
<testcase name="IntPub_RunningStats.ElementCount" classname="IntPub_RunningStats.ElementCount" time="0.0078867" status="fail">
<failure message=""/>
<system-out>Running main() from C:\source\out\lib\googletest-src\googletest\src\gtest_main.cc
Note: Google Test filter = IntPub_RunningStats.ElementCount
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from IntPub_RunningStats
[ RUN ] IntPub_RunningStats.ElementCount
C:\source\tests\RunningStats\RunningStatsTest.cpp(12): error: Expected equality of these values:
stats.numDataValues()+1
Which is: 151
elementCount
Which is: 150
150 data values have been pushed to the running stats class.
[ FAILED ] IntPub_RunningStats.ElementCount (0 ms)
[----------] 1 test from IntPub_RunningStats (0 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] IntPub_RunningStats.ElementCount
1 FAILED TEST
</system-out>
</testcase>
</testsuite>
I wrote simple code for ctest-junit reporter. But later it turned out that ctest JUnit reports are absolutely useless. I switched to using Google Test XML report with conversion to JUnit format using xsltproc
.
Hi, I'm trying to use this GitHub Actions for Android JUnit Tests and I get the same error:
Using test report parser 'jest-junit'
Creating test report Unit Tests
Processing test results for check run Unit Tests
Error: Processing test results from app/build/test-results/testDebugUnitTest/TEST-com.example.ExampleUnitTest.xml failed
Error: TypeError: Cannot read properties of undefined (reading 'testsuite')
The TEST-com.example.ExampleUnitTest.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="com.example.ExampleUnitTest" tests="1" skipped="0" failures="0" errors="0" timestamp="2023-02-02T15:25:26" hostname="leinardi-workstation" time="0.007">
<properties/>
<testcase name="addition_isCorrect" classname="com.example.ExampleUnitTest" time="0.007"/>
<system-out><![CDATA[]]></system-out>
<system-err><![CDATA[]]></system-err>
</testsuite>
This is another more complex test example:
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="com.example.feature.account.interactor.account.LogInInteractorImplTest" tests="10" skipped="0" failures="0" errors="0" timestamp="2023-02-02T14:44:50" hostname="leinardi-workstation" time="1.281">
<properties/>
<testcase name="GIVEN remote error Http error not between 400 and 499 WHEN call logInInteractor with password THEN return UnexpectedError" classname="com.example.feature.account.interactor.account.LogInInteractorImplTest" time="0.793"/>
<testcase name="GIVEN remote error IOException WHEN call logInInteractor with SSO THEN return NetworkError" classname="com.example.feature.account.interactor.account.LogInInteractorImplTest" time="0.029"/>
<testcase name="GIVEN remote success WHEN call logInInteractor with SSO THEN return Success " classname="com.example.feature.account.interactor.account.LogInInteractorImplTest" time="0.376"/>
<testcase name="GIVEN remote error any other Exception WHEN call logInInteractor with SSO THEN return UnexpectedError" classname="com.example.feature.account.interactor.account.LogInInteractorImplTest" time="0.007"/>
<testcase name="GIVEN remote error any other Exception WHEN call logInInteractor with password THEN return UnexpectedError" classname="com.example.feature.account.interactor.account.LogInInteractorImplTest" time="0.012"/>
<testcase name="GIVEN remote error Http error between 400 and 499 WHEN call logInInteractor with SSO THEN return BadAuthentication" classname="com.example.feature.account.interactor.account.LogInInteractorImplTest" time="0.013"/>
<testcase name="GIVEN remote success WHEN call logInInteractor with password THEN return Success " classname="com.example.feature.account.interactor.account.LogInInteractorImplTest" time="0.021"/>
<testcase name="GIVEN remote error Http error between 400 and 499 WHEN call logInInteractor with password THEN return BadAuthentication" classname="com.example.feature.account.interactor.account.LogInInteractorImplTest" time="0.014"/>
<testcase name="GIVEN remote error IOException WHEN call logInInteractor with password THEN return NetworkError" classname="com.example.feature.account.interactor.account.LogInInteractorImplTest" time="0.003"/>
<testcase name="GIVEN remote error Http error not between 400 and 499 WHEN call logInInteractor with SSO THEN return UnexpectedError" classname="com.example.feature.account.interactor.account.LogInInteractorImplTest" time="0.008"/>
<system-out><![CDATA[]]></system-out>
<system-err><![CDATA[SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
]]></system-err>
</testsuite>
Any updates on this issue? I am also using Android JUnit Tests with xml very similar to what @leinardi has posted.