diff --git a/.gitignore b/.gitignore index 2201e38a3..7eb5eab99 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,7 @@ package-dev/alias-references.txt # ignore integration test files Samples/IntegrationTest* unity.log +unity-test.log # Ignore package release test-package-release/ diff --git a/Agents.md b/Agents.md index b81241096..8a2583310 100644 --- a/Agents.md +++ b/Agents.md @@ -18,12 +18,19 @@ dotnet msbuild /t:DownloadNativeSDKs src/Sentry.Unity # Build the Unity SDK dotnet build -# Run all tests -./test.sh +# Run all tests (builds SDK first) +pwsh scripts/run-tests.ps1 -# Run specific test targets -dotnet msbuild /t:UnityEditModeTest /p:Configuration=Release test/Sentry.Unity.Editor.Tests -dotnet msbuild /t:UnityPlayModeTest /p:Configuration=Release +# Run specific test types +pwsh scripts/run-tests.ps1 -PlayMode +pwsh scripts/run-tests.ps1 -EditMode + +# Run filtered tests +pwsh scripts/run-tests.ps1 -Filter "TestClassName" +pwsh scripts/run-tests.ps1 -PlayMode -Filter "Throttler" + +# Skip build for faster iteration +pwsh scripts/run-tests.ps1 -SkipBuild -Filter "MyTest" # Integration testing (local) ./test/Scripts.Integration.Test/integration-test.ps1 -Platform "macOS" -UnityVersion "2021.3.45f2" @@ -482,7 +489,14 @@ Key options: ### Running All Tests ```bash -./test.sh +# Run all tests (builds SDK first) +pwsh scripts/run-tests.ps1 + +# Run with filtering +pwsh scripts/run-tests.ps1 -Filter "TestClassName" + +# Skip build for faster iteration +pwsh scripts/run-tests.ps1 -SkipBuild ``` ### Integration Test Scripts diff --git a/Directory.Build.targets b/Directory.Build.targets index 5e471defd..ba5064f3f 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -398,7 +398,7 @@ Related: https://forum.unity.com/threads/6572-debugger-agent-unable-to-listen-on - + @@ -411,7 +411,7 @@ Related: https://forum.unity.com/threads/6572-debugger-agent-unable-to-listen-on - + @@ -465,104 +465,6 @@ File.WriteAllLines(PackageManifestFile, lines); - - - - - - - - - - - - - 1 ? "s" : "")}."; -Log.LogError(errorMessage); - -Success = false; - -void PrintFailedTests(XElement element) -{ - foreach (var descendant in element.Descendants()) - { - if (descendant.Name != "test-case" - || descendant.Attribute("result")?.Value != "Failed") - { - continue; - } - - if (descendant.Descendants().Any(d => d.Name == "test-case")) - { - PrintFailedTests(descendant); - } - else - { - var sb = new StringBuilder() - .Append("Test ") - .Append(descendant.Attribute("id")?.Value) - .Append(": ") - .AppendLine(descendant.Attribute("name")?.Value); - - var failure = descendant.Descendants("failure") - .Descendants("message") - .FirstOrDefault() - ?.Value; - - var stack = descendant.Descendants("failure") - .Descendants("stack-trace") - .FirstOrDefault() - ?.Value; - - sb.AppendLine(failure) - .Append("Test StackTrace: ") - .AppendLine(stack); - -// MSBuild is breaking each line as if it was an error per line and not a single error. -// So Log.LogError got replaced by Console.WriteLine for now. - Console.WriteLine(sb.ToString()); - } - } -} -]]> - - - -