JetBrains / JetBrains/TeamCity.VSTest.TestAdapter

Unable to retrieve test parameters from parameterized xunit tests

Open
#46 1 comment 0 reactions 1 assignee Claimed by @mchechulnikov View on GitHub
Dominant language
C#
Stars
32
Forks
13
PR merge metrics
No merged PRs in 30d

Description

xunit works correctly when the test parameter has a primitive type - string, int, etc. These parameters are displayed in the _displayName_ attribute:

```c#
[Theory]
[MemberData(nameof(GetParameters1))]
public void Parametrized1(string param1, int param2)
{
}

public static IEnumerable GetParameters1()
{
for (var i = 0; i < 1; i++)
{
yield return new object[]
{
$"Abc {i}",
i
};
}
}
```

![image](https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/assets/11720017/b6b0881f-e212-40e2-aa8a-a13976d5949e)

If at least one of the attributes is not of primitive type, all parameters disappear from _displayName_:

```c#
[Theory]
[MemberData(nameof(GetParameters2))]
public void Parametrized2(string param1, int param2, IReadOnlyCollection param3)
{
}

public static IEnumerable GetParameters2()
{
for (var i = 0; i < 1; i++)
{
yield return new object[]
{
$"Abc {i}",
i,
ImmutableArray.Create(
new Data2("str 1", 33),
new Data2("str 2", 99))
};
}
}

public record Data2(string StrVal, double DoubleVal);
```

![image](https://github.com/JetBrains/TeamCity.VSTest.TestAdapter/assets/11720017/1e793bd7-3b18-46a6-b96e-831d66269a0c)

It would be useful to add a resultDisplayName attribute that contains the correct value - with all parameters. For example, this is necessary for correct generation of allure test reports

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.