I have an implementation for ITestDiscoverer as follows:
class MyClass : ITestDiscoverer
{
public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
{
discoverySink.SendTestCase(new TestCase(
"My.Namespace.MyType.MyMember.MyMember(1)",
new Uri("executor://myexecutor/v1"),
"path\\to\\my.test.assembly.dll"));
}
}
Furtmerore my test-project has this class:
namespace My.Namespace
{
[TestFixture]
public class MyType
{
[TestCase(1)
public void MyMember(int n) { ... }
}
}
However VS TestExplorer cannot interpret the testcase's name and allways just assumes My.Namespace.MyType to be the namespace, instead of My.Namespace.
I omited the very first level of hierarchy, which applies to the assembly.
So there's no way to indicate where the namespace for a particular testcase ends and where its member starts.
Furthermore the test appears twice in TestExplorer. I assume this is because some default (?) test-discoverer also running.
Steps to reproduce
Create a new adapter and add it to your test-project as a reference. Then use TestExplorer to see the testcase appearing twice: once with namespace being My.Namespace.MyType and once with My.Namespace.
Using VS2022.
Expected behavior
TestCase should only appear once, with second hierarchy (=namespace) My.Namespace and third hierarchy (=type) MyType.
Actual behavior
TestCase appears twice, once with namespace being My.Namespace.MyType and once with My.Namespace
Description
I have an implementation for
ITestDiscoverer
as follows:Furtmerore my test-project has this class:
However VS TestExplorer cannot interpret the testcase's name and allways just assumes
My.Namespace.MyType
to be the namespace, instead ofMy.Namespace
.Steps to reproduce
Create a new adapter and add it to your test-project as a reference. Then use TestExplorer to see the testcase appearing twice: once with namespace being
My.Namespace.MyType
and once withMy.Namespace
.Using VS2022.
Expected behavior
TestCase should only appear once, with second hierarchy (=namespace)
My.Namespace
and third hierarchy (=type)MyType
.Actual behavior
TestCase appears twice, once with namespace being
My.Namespace.MyType
and once withMy.Namespace
Environment
running VS2022 on Windows and NUnit 4.1