Filtering tests with any "PropertyAttribute"
See original GitHub issueHi,
vstest.console.exe has /TestCaseFilter
switch (and in IVsTestConsoleWrapper
API there’s TestCaseFilter
in RunSettings
, in dotnet test
it’s --filter
AFAIK).
But it seems it’s not possible to run only tests which has specific PropertyAttribute. For example given following:
[Property("Bug", "12345")]
[Test]
public void Test2()
{
Assert.Pass();
}
I would like to be able run something like this: vstest.console.exe NUnitTestProject1.dll /TestCaseFilter:Bug=12345
. But it does not seems to work - no test is executed. Am I doing it wrong, or is there no support for this?
According to https://github.com/microsoft/testfx/issues/731 it must be supported by test adapter (it is supported by xUnit, not supported by MSTest).
If it is not supported by NUnit, I’d like to ask to add such support.
Please see the above issue for some more details and simple solution with 3 UT projects (mstest, xunit, nunit): ClassLibrary1.zip I have tested this with vstest.console.exe from microsoft.testplatform.16.7.0 nuget package, with NUnit3TestAdapter 3.15.1.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (4 by maintainers)
Hello @OsirisTerje, That package fixes it for me. Thanks, that’s a very useful feature.
@pkruk2 I need to check this out (aka debug) to see what happens here. I can confirm it doesn’t work, and I see there is an exception (using the 4.0.0-alpha.1 adapter) that says it doesn’t find the “Bug” in the selection criteria. We should be able to fix this, given the vstest guys says they’re sending the correct stuff down to us. Also, from earlier posts I see this have been working earlier, but I am not sure when this stopped working, so - we do have a regression bug here.
I also see it works in Visual Studio:
So there is something in the way that vstest and dotnet test sends the arguments.