diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 174062a..6a64b20 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -129,8 +129,8 @@ When you need to search the unity API, you can use : # Build dotnet build .\src\Microsoft.Unity.Analyzers.slnx -# Run tests -dotnet test .\src\Microsoft.Unity.Analyzers.slnx --filter FullyQualifiedName!~ConsistencyTests +# Run tests with Microsoft Testing Platform +dotnet .\src\Microsoft.Unity.Analyzers.Tests\bin\Debug\net10.0\Microsoft.Unity.Analyzers.Tests.dll --retry-failed-tests 3 --filter-not-class Microsoft.Unity.Analyzers.Tests.ConsistencyTests ``` Indeed we want to skip ConsistencyTests when developping new diagnostics because those tests are doing http-requests on documentation. diff --git a/.github/workflows/ci-matrix.yml b/.github/workflows/ci-matrix.yml index 9e30691..049e6fb 100644 --- a/.github/workflows/ci-matrix.yml +++ b/.github/workflows/ci-matrix.yml @@ -14,6 +14,7 @@ on: env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: 1 + TESTINGPLATFORM_TELEMETRY_OPTOUT: 1 UNITY_HASH: '1c7db571dde0' UNITY_FULL_VERSION: '6000.3.8f1' HUSKY: 0 @@ -89,14 +90,14 @@ jobs: - name: Test context (main) if: github.ref == 'refs/heads/main' - run: echo "TEST_FILTER=." >> $GITHUB_ENV + run: echo "TEST_ARGUMENTS=--retry-failed-tests 3" >> "$GITHUB_ENV" shell: bash - name: Test context (feature) if: github.ref != 'refs/heads/main' - run: echo "TEST_FILTER=FullyQualifiedName!~ConsistencyTests" >> $GITHUB_ENV + run: echo "TEST_ARGUMENTS=--retry-failed-tests 3 --filter-not-class Microsoft.Unity.Analyzers.Tests.ConsistencyTests" >> "$GITHUB_ENV" shell: bash - name: Test - run: dotnet test -c Debug ./src/Microsoft.Unity.Analyzers.Tests --filter ${{env.TEST_FILTER}} + run: dotnet ./src/Microsoft.Unity.Analyzers.Tests/bin/Debug/net10.0/Microsoft.Unity.Analyzers.Tests.dll $TEST_ARGUMENTS shell: bash diff --git a/README.md b/README.md index 5cfd097..f14d44e 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ For unit-testing, we require Unity to be installed. We recommend using the lates Compiling the solution: `dotnet build .\src\Microsoft.Unity.Analyzers.slnx` -Running the unit tests: -`dotnet test .\src\Microsoft.Unity.Analyzers.slnx` +Running the unit tests with Microsoft Testing Platform and retrying failures up to three times: +`dotnet .\src\Microsoft.Unity.Analyzers.Tests\bin\Debug\net10.0\Microsoft.Unity.Analyzers.Tests.dll --retry-failed-tests 3` You can open `.\src\Microsoft.Unity.Analyzers.slnx` in your favorite IDE to work on the analyzers and run/debug the tests. @@ -92,5 +92,3 @@ Example for creating `CustomSuppressor` and `CustomSuppressorTests` classes : This project welcomes contributions and suggestions. Please have a look at our [Guidelines](CONTRIBUTING.md) for contributing. - - diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 16db788..d76816c 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -18,9 +18,10 @@ + - - + + diff --git a/src/Microsoft.Unity.Analyzers.Tests/Microsoft.Unity.Analyzers.Tests.csproj b/src/Microsoft.Unity.Analyzers.Tests/Microsoft.Unity.Analyzers.Tests.csproj index 60e8bfe..43f5976 100644 --- a/src/Microsoft.Unity.Analyzers.Tests/Microsoft.Unity.Analyzers.Tests.csproj +++ b/src/Microsoft.Unity.Analyzers.Tests/Microsoft.Unity.Analyzers.Tests.csproj @@ -5,12 +5,14 @@ net10.0 enable NU1608;VSTHRD200 + true +