Reputation: 973
I'm attempting to use TestCaseSource to re-use the test with different data. Here I'm trying to give my tests their own name with the 'setName' property which works fine. My issue is that the original test also shows up in the testexplorer. It doesn't seem possible to run. How can I get rid of it in the test explorer?
Simple reproduction:
[TestFixture]
public class Tests
{
[TestCaseSource(nameof(MyTestData))]
[Category(name: "MyCategory")]
public void OriginalTest(string first, string second)
{
Assert.IsTrue(true);
}
private static IEnumerable<TestCaseData> MyTestData
{
get
{
yield return new TestCaseData("firstString", "secondString").SetName("FirstTest");
yield return new TestCaseData("firstString", "secondString").SetName("SecondTest");
}
}
}
My test explorer looks like this
Upvotes: 4
Views: 2269
Reputation: 26
This seemed to be a problem with the adapter.
I was having this same issue, using SetArgDisplayNames
instead, which, while not providing the expected visual result, was the best fit for this kind of usage until the problem was fixed.
Updating NUnit3TestAdapter to v3.16.0 the problem no longer occurred:
Upvotes: 1