diff --git a/Editor/Tools/RunTestsTool.cs b/Editor/Tools/RunTestsTool.cs index d186c19b..08757ef5 100644 --- a/Editor/Tools/RunTestsTool.cs +++ b/Editor/Tools/RunTestsTool.cs @@ -114,6 +114,12 @@ public void TestStarted(ITestAdaptor test) // Called when a test finishes public void TestFinished(ITestResultAdaptor result) { + // Skip test suites (tests with children) + if (result.Test.HasChildren) + { + return; + } + _testResults.Add(new TestResult { Name = result.Test.Name, @@ -136,8 +142,11 @@ public void RunFinished(ITestResultAdaptor result) // Create test results summary var summary = new JObject { - ["testCount"] = _testResults.Count, - ["passCount"] = _testResults.FindAll(r => r.Passed).Count, + ["testCount"] = result.PassCount + result.FailCount + result.SkipCount + result.InconclusiveCount, + ["passCount"] = result.PassCount, + ["failCount"] = result.FailCount, + ["skipCount"] = result.SkipCount, + ["inconclusiveCount"] = result.InconclusiveCount, ["duration"] = result.Duration, ["success"] = result.ResultState == "Passed", ["status"] = "completed", @@ -166,7 +175,13 @@ public void RunFinished(ITestResultAdaptor result) { ["success"] = true, ["type"] = "text", - ["message"] = summary["message"].Value() + ["message"] = summary["message"].Value(), + ["testCount"] = summary["testCount"], + ["passCount"] = summary["passCount"], + ["failCount"] = summary["failCount"], + ["skipCount"] = summary["skipCount"], + ["inconclusiveCount"] = summary["inconclusiveCount"], + ["results"] = summary["results"] }); } catch (Exception ex) diff --git a/Server/build/tools/runTestsTool.js b/Server/build/tools/runTestsTool.js index 5adcbd21..cd2c00d0 100644 --- a/Server/build/tools/runTestsTool.js +++ b/Server/build/tools/runTestsTool.js @@ -57,6 +57,9 @@ async function toolHandler(mcpUnity, params) { const testResults = response.results || []; const testCount = response.testCount || 0; const passCount = response.passCount || 0; + const failCount = response.failCount || 0; + const inconclusiveCount = response.inconclusiveCount || 0; + const skipCount = response.skipCount || 0; // Format the result message let resultMessage = `${passCount}/${testCount} tests passed`; if (testCount > 0 && passCount < testCount) { @@ -69,14 +72,16 @@ async function toolHandler(mcpUnity, params) { content: [ { type: 'text', - text: response.message || resultMessage + text: resultMessage || response.message }, { type: 'text', text: JSON.stringify({ testCount, passCount, - failCount: testCount - passCount, + failCount, + inconclusiveCount, + skipCount, results: testResults }, null, 2) } diff --git a/Server/src/tools/runTestsTool.ts b/Server/src/tools/runTestsTool.ts index b7b7ed12..b8de19a3 100644 --- a/Server/src/tools/runTestsTool.ts +++ b/Server/src/tools/runTestsTool.ts @@ -75,6 +75,9 @@ async function toolHandler(mcpUnity: McpUnity, params: any): Promise