Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nunit test failure message is missing #355

Closed
mikz opened this issue Sep 21, 2022 · 5 comments
Closed

Nunit test failure message is missing #355

mikz opened this issue Sep 21, 2022 · 5 comments

Comments

@mikz
Copy link

mikz commented Sep 21, 2022

Given the following example XML:

<?xml version="1.0" encoding="utf-8"?>
<test-run id="2" testcasecount="352" result="Failed(Child)" total="352" passed="349" failed="3" inconclusive="0" skipped="0" asserts="0" engine-version="3.5.0.0" clr-version="4.0.30319.42000" start-time="2022-09-20 21:16:48Z" end-time="2022-09-20 21:31:37Z" duration="888.5251836">
    <test-suite type="TestSuite" id="1000" name="workspace" fullname="workspace" runstate="Runnable" testcasecount="3688" result="Failed" site="Child" start-time="2022-09-20 21:16:48Z" end-time="2022-09-20 21:31:37Z" duration="888.525184" total="352" passed="349" failed="3" inconclusive="0" skipped="0" asserts="0">
        <properties>
            <property name="isRoot" value="True" />
        </properties>
        <failure>
            <message><![CDATA[One or more child tests had errors]]></message>
        </failure>
        <test-suite type="Assembly" id="1361" name="MafiaPigs.EditorTests.dll" fullname="/github/workspace/Library/ScriptAssemblies/MafiaPigs.EditorTests.dll" runstate="Runnable" testcasecount="352" result="Failed" site="Child" start-time="2022-09-20 21:16:48Z" end-time="2022-09-20 21:31:37Z" duration="888.385199" total="352" passed="349" failed="3" inconclusive="0" skipped="0" asserts="0">
            <properties>
                <property name="_PID" value="1140" />
                <property name="_APPDOMAIN" value="Unity Child Domain" />
                <property name="platform" value="EditMode" />
                <property name="isAssembly" value="True" />
                <property name="EditorOnly" value="True" />
                <property name="RequiresPlayMode" value="False" />
            </properties>
            <failure>
                <message><![CDATA[One or more child tests had errors]]></message>
            </failure>
            <test-suite type="TestSuite" id="1362" name="MP" fullname="MP" runstate="Runnable" testcasecount="352" result="Failed" site="Child" start-time="2022-09-20 21:16:48Z" end-time="2022-09-20 21:31:37Z" duration="888.339072" total="352" passed="349" failed="3" inconclusive="0" skipped="0" asserts="0">
                <properties />
                <failure>
                    <message><![CDATA[One or more child tests had errors]]></message>
                </failure>
                <test-suite type="TestSuite" id="1363" name="Tests" fullname="MP.Tests" runstate="Runnable" testcasecount="352" result="Failed" site="Child" start-time="2022-09-20 21:16:48Z" end-time="2022-09-20 21:31:37Z" duration="888.307736" total="352" passed="349" failed="3" inconclusive="0" skipped="0" asserts="0">
                    <properties />
                    <failure>
                        <message><![CDATA[One or more child tests had errors]]></message>
                    </failure>
                    <test-suite type="TestFixture" id="1003" name="AssetValidatorTest" fullname="MP.Tests.AssetValidatorTest" classname="MP.Tests.AssetValidatorTest" runstate="Runnable" testcasecount="351" result="Failed" site="Child" start-time="2022-09-20 21:16:48Z" end-time="2022-09-20 21:31:36Z" duration="887.960312" total="351" passed="348" failed="3" inconclusive="0" skipped="0" asserts="0">
                        <properties />
                        <failure>
                            <message><![CDATA[One or more child tests had errors]]></message>
                        </failure>
                        <output/>
                        <test-suite type="ParameterizedMethod" id="1062" name="ValidateSceneContainer" fullname="MP.Tests.AssetValidatorTest.ValidateSceneContainer" classname="MP.Tests.AssetValidatorTest" runstate="Runnable" testcasecount="56" result="Failed" site="Child" start-time="2022-09-20 21:24:21Z" end-time="2022-09-20 21:28:24Z" duration="242.562296" total="56" passed="53" failed="3" inconclusive="0" skipped="0" asserts="0">
                            <properties />
                            <failure>
                                <message><![CDATA[One or more child tests had errors]]></message>
                            </failure>
                            <test-case id="1017" name="ValidateSceneContainer(&quot;Assets/Scenes/Grid/GridTest.unity&quot;)" fullname="MP.Tests.AssetValidatorTest.ValidateSceneContainer(&quot;Assets/Scenes/Grid/GridTest.unity&quot;)" methodname="ValidateSceneContainer" classname="MP.Tests.AssetValidatorTest" runstate="Runnable" seed="78278819" result="Failed" label="Error" start-time="2022-09-20 21:25:49Z" end-time="2022-09-20 21:25:51Z" duration="2.117365" asserts="0">
                                <properties />
                                <failure>
                                    <message><![CDATA[Zenject.ZenjectException : Zenject Validation Failed!  See errors below for details.]]></message>
                                    <stack-trace><![CDATA[  at Zenject.Internal.ZenUnityEditorUtil.ValidateCurrentSceneSetup () [0x0009c] in /github/workspace/Assets/ThirdParty/Zenject/Source/Editor/ZenUnityEditorUtil.cs:82
  at MP.Tests.AssetValidatorTest.ValidateSceneContainer (System.String scenePath) [0x00009] in /github/workspace/Assets/Tests/EditorMode/AssetValidatorTest.cs:58
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <b67d2f60bf2548a58dc569b37fe71c3d>:0 ]]></stack-trace>
                                </failure>
                            </test-case>
                        </test-suite>
                    </test-suite>
                </test-suite>
            </test-suite>
        </test-suite>
    </test-suite>
</test-run>

The GitHub check should show Zenject.ZenjectException : Zenject Validation Failed! See errors below for details. plus the stack trace. But it just shows the stack trace.

The junit <failure message="" should be set correctly with this transform:

<failure message="{./message}">
<xsl:value-of select="./stack-trace"/>
</failure>

But somehow it still does not appear on GitHub.

@mikz
Copy link
Author

mikz commented Sep 21, 2022

Traced it to

message = case.message if case.result in ['skipped', 'disabled'] else case.content

@EnricoMi
Copy link
Owner

Right, that was some special logic coming from JUnit files. Maybe this should be generalized and case.message and case.content should always be used.

@mikz
Copy link
Author

mikz commented Sep 22, 2022

@EnricoMi
Copy link
Owner

EnricoMi commented Oct 4, 2022

I think this has to be fixed in a different place. That message is used to identify identical test cases. The message used in the annotations is defined elsewhere, and should be changed there.

I have created a fix, please test the fix as follows (includes fix for #354):

uses: EnricoMi/publish-unit-test-result-action/composite@branch-stdout-and-stderr

@EnricoMi
Copy link
Owner

This has been fixed in #358.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants