Closed yurii-hunter closed 5 years ago
@yurii-hunter could you please share a piece of code how your test looks like which causes this issue?
Microsoft.NET.Test.Sdk Version=16.2.0 xunit Version = 2.4.1 xunit.runner.visualstudio Version = 2.4.1 Project Type - Class Library (.net core)
[Fact]
public void TestMethod()
{
Assert.True(false);
}
@nvborisenko vstest logger creates test launch bat can not report any test there
Thanks, will take a look in 1 week when get back to PC.
A little bit more details:
if DisplayName is not specfified - then FullyQualifiedName
equals DisplayName
if DisplayName is specified [Fact(DisplayName = "Test.Method")]
- then DisplayName
shows specified display name "Test.Method"
Right, got the same results. This behavior is specific only foe xunit tests. Not sure whether this should be resolved on our side or xunit adapter side.
Some variants:
fq: ExampleUnitTests.XUnitTests.UnitTest3.Test4, dn: ExampleUnitTests.XUnitTests.UnitTest3.Test4(a: "1.postfix")
fq: ExampleUnitTests.XUnitTests.UnitTest3.Test4, dn: ExampleUnitTests.XUnitTests.UnitTest3.Test4(a: "2.postfix")
fq: ExampleUnitTests.XUnitTests.UnitTest3.Test3, dn: Dot.Test3
fq: ExampleUnitTests.XUnitTests.UnitTest3.Test2, dn: OverriddenTest2
fq: ExampleUnitTests.XUnitTests.UnitTest3.Test1, dn: ExampleUnitTests.XUnitTests.UnitTest3.Test1
where fq
is fully qualified name, dn
- Display Name.
I don't see how to understand what is namespace and name of test based on this information :(.
We don't meet this behavior in mstest and nunit adapters.
@nvborisenko i've created PR that fixes this problem for xUnit. But I have not tested it with another frameworks. The result looks like this
This works for xunit, but doesn't work for nunit. You can play with example-net-vstest
repository to verify your package.
@nvborisenko will do. Thanks for a feedback
https://github.com/reportportal/agent-net-vstest/blob/a6d01fae68f5c7e231fce21782a58a26e5a78fbc/src/ReportPortal.VSTest.TestLogger/ReportPortalLogger.cs#L124
In case user uses xUnit.net the
e.Result.TestCase.DisplayName
is equal toe.Result.TestCase.FullyQualifiedName
. It causes exception on line number 129 because logger tries to get substring with length -1it will became
Looks like the fastest solution is to try to get test name from the DisplayName, but i'm not sure about this.