豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 38292bd

Browse files
dsarnoclaude
andcommitted
fix: SceneView test asserts both environments; workflow checks failure count
- StatsSetSceneDebug_ValidMode test now asserts success when SceneView exists and correctly asserts failure when it doesn't (batch mode), instead of going inconclusive. - Workflow now parses NUnit XML for failed=0 rather than trusting the runner exit code, which returns 2 for inconclusive tests (URP, ProBuilder, Volumes not installed in CI). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f87daad commit 38292bd

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

.github/workflows/unity-tests.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
if: steps.detect.outputs.unity_ok == 'true'
7777
uses: game-ci/unity-test-runner@v4
7878
id: tests
79+
continue-on-error: true
7980
env:
8081
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
8182
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
@@ -86,6 +87,25 @@ jobs:
8687
unityVersion: ${{ matrix.unityVersion }}
8788
testMode: ${{ matrix.testMode }}
8889

90+
- name: Check test results
91+
if: steps.detect.outputs.unity_ok == 'true'
92+
run: |
93+
RESULTS_XML=$(find ${{ steps.tests.outputs.artifactsPath }} -name '*.xml' 2>/dev/null | head -1)
94+
if [ -z "$RESULTS_XML" ]; then
95+
echo "::error::No test results XML found — Unity may have crashed"
96+
exit 1
97+
fi
98+
FAILED=$(grep -oP 'failed="\K[0-9]+' "$RESULTS_XML" | head -1)
99+
PASSED=$(grep -oP 'passed="\K[0-9]+' "$RESULTS_XML" | head -1)
100+
TOTAL=$(grep -oP 'total="\K[0-9]+' "$RESULTS_XML" | head -1)
101+
INCONCLUSIVE=$(grep -oP 'inconclusive="\K[0-9]+' "$RESULTS_XML" | head -1)
102+
SKIPPED=$(grep -oP 'skipped="\K[0-9]+' "$RESULTS_XML" | head -1)
103+
echo "Results: $PASSED passed, $FAILED failed, $INCONCLUSIVE inconclusive, $SKIPPED skipped (total: $TOTAL)"
104+
if [ "$FAILED" != "0" ]; then
105+
echo "::error::$FAILED test(s) failed"
106+
exit 1
107+
fi
108+
89109
- uses: actions/upload-artifact@v4
90110
if: always() && steps.detect.outputs.unity_ok == 'true'
91111
with:

TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageGraphicsTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,13 +586,15 @@ public void StatsGetMemory_ReturnsMemoryInfo()
586586
[Test]
587587
public void StatsSetSceneDebug_ValidMode_Succeeds()
588588
{
589-
Assume.That(_hasSceneView, "No SceneView in batch mode — skipping.");
590589
var result = ToJObject(ManageGraphics.HandleCommand(new JObject
591590
{
592591
["action"] = "stats_set_scene_debug",
593592
["mode"] = "Wireframe"
594593
}));
595-
Assert.IsTrue(result.Value<bool>("success"), result.ToString());
594+
if (_hasSceneView)
595+
Assert.IsTrue(result.Value<bool>("success"), result.ToString());
596+
else
597+
Assert.IsFalse(result.Value<bool>("success"));
596598
}
597599

598600
[Test]

0 commit comments

Comments
 (0)