Skip to content

When I run NUnit tests in VSTest in the pipeline it goes ok, but when I want to rerun failed once there is a filter from MSTest "ClassName" #1202

Open

Description

@Misieqj
  • NUnit -> 4.1.0
  • NUnit3TestAdapter -> 4.5.0
  • VS -> Professional 2022 64bit
  • .NET 7.0

Issue description

When I run tests in Azure DevOps VSTest in pipeline all tests are ok.
But when I want to set rerun of failed tests in the same VSTest task there is info: No test matches the given testcase filter. When I checked filter details there is filter syntax of MSTest with ClassName

Preview of VSTest task input:

  • testFiltercriteria: 'FullyQualifiedName~Namespace.ClassName' / or 'TestCategory=CategoryName'
  • rerunFailedTests: true
  • rerunmaxAttempts: 3
  • rerunType: 'basedOnTestFailureCount'
  • rerunFailedTestCasesMaxLimit: 1

Details of first run from the pipeline:

  • Test filter criteria : TestCategory=CategoryName
    => And works OK

Details of rerun from the pipeline when FailedTestName failed in a first run:

  • vstest.console.exe /TestCaseFilter:"(ClassName=NameSpace.ClassName&Name=FailedTestName)"
    => No test matches the given testcase filter

Any ideas why?

Activity

  1. stevenaw commented on Aug 16, 2024

    @stevenaw
    Member

    Thanks for raising this @Misieqj
    I'm not 100% certain, but this could also be related to a framework filtering issue we've fixed for the upcoming NUnit 4.2 release.
    There is a preview available on MyGet. Could you see if upgrading to that helps solve your issue?

    The package itself can be found here: https://www.myget.org/feed/nunit/package/nuget/NUnit
    With instructions on how to to add the feed here: https://docs.nunit.org/articles/nunit/Towards-NUnit4.html#myget

  2. stevenaw commented on Aug 16, 2024

    @stevenaw
    Member

    The issue I suspect you could be hitting is nunit/nunit#4651

  3. Misieqj commented on Aug 19, 2024

    @Misieqj
    Author

    I will stay in this thread with the answer because it is related to the filter after rerun tests.

    Thx @stevenaw for those tips, I tried with NUnit 3.14.0 and also 4.2 alpha but still in the tests rerun a filter not changed
    No test matches the given testcase filter "(ClassName=...&Name=...)"

  4. OsirisTerje commented on Oct 26, 2026

    @OsirisTerje
    Member

    @Misieqj Still fails with adapter 6.3.1 and 6.4.0-alpha. The repro is in Issue1202.

    (ClassName=Issue1202.Tests&Name=FailedTestName) gives No test matches the given testcase filter, while FullyQualifiedName=Issue1202.Tests.FailedTestName runs the test. The adapter supports the filter properties FullyQualifiedName, Name, TestCategory, Category and Priority, but not ClassName, which is an MSTest property. The Azure DevOps rerun uses ClassName, so the adapter needs to support it to make the rerun work.

    🤖 Made by @OsirisTerje with Claude

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions