testfx icon indicating copy to clipboard operation
testfx copied to clipboard

Filtering from the CLI using /TestCaseFilter is not supported on extensions to TestPropertyAttribute

Open pvlakshm opened this issue 8 years ago • 1 comments

Here is an example of an extention to TestPropertyAttribute (RFC):

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MSTestV2Ex;

namespace MSTestV2Ex
{
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class SmokeTest : TestPropertyAttribute
    {
        public SmokeTest()
            : base("SmokeTest", null)
        {
        }
    }
}

namespace UnitTestProject20
{
   [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        [SmokeTest]
        public void TestMethod1()
        {
        }

        [TestMethod]
        public void TestMethod2()
        {
        }
    }
}

Filtering and Grouping from within the Visual Studio IDE’s TestExplorer works.

However, filtering using the /TestCaseFilter switch on the CLI is not working. It ought to be supported in a manner similar to how I am able to filter on TestProperty.

pvlakshm avatar Jun 20 '17 06:06 pvlakshm

Here is where we have a list of supported properties today

pvlakshm avatar Jul 20 '17 10:07 pvlakshm

@engyebrahim Can you double check that your PR also fixes this case?

Evangelink avatar May 29 '24 13:05 Evangelink

@Evangelink it's not working, I'm debugging it

engyebrahim avatar Jun 03 '24 10:06 engyebrahim

https://learn.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests?pivots=mstest#:~:text=dotnet%20test%20%2D%2Dfilter%20Method --filter SmokeTest as for the link the default if user filtered value without key will be filtered by fullyQualifiedName and --filter SmokeTest=null it's not valid filter by the new fix here https://github.com/microsoft/testfx/pull/3015 you can filter like that but you have to add a value to the TestProperty e.g. base("SmokeTest", "test")

engyebrahim avatar Jun 03 '24 10:06 engyebrahim