I am using Visual Studion 17.12.5 and I am experiencing the following problem.
After upgrading the MSTest-package from 3.7.3 to 3.8.0 and Microsoft.NET.Test.Sdk from 17.12.0 to 17.13.0 the most of my tests are ignored.
More precise: The Test-Explorer of Visual Studion gives a yellow warning-sign with most of the tests, but some ~ 2% are executed OK.
[...]
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="MSTest" Version="3.8.0" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
[...]
Reverting back to 3.7.3 and 17.12.0 all tests are executed normally:
[...]
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest" Version="3.7.3" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
[...]
for Code-Coverage I use Fine-Code-Coverage.
BTW: Isn't it nice(!) that all tests appear green at first glance, only if you look closer you find out that 10152 tests have been skipped, and only 156 have been ok.
See and try code on my GitHub:
e.G: BaseLibTests, ...
It happens to all targets 4.6.2 - 4.8.1 and 6.0 - 9.0
Does anybody experience the same behavior or knows a solution ?
[Edit:] With some investigation I found out that tests with "[DataRow(...)]"-attribute are skipped e.G:
/// <summary>
/// Test EnumMember-Helper function
/// </summary>
/// <param name="name">The name.</param>
/// <param name="peExp">The expected result</param>
[DataTestMethod()]
[DataRow(nameof(intProp), PropEnum.intProp)]
[DataRow(nameof(boolProp), PropEnum.boolProp)]
[DataRow(nameof(enumProp), PropEnum.enumProp)]
[DataRow(nameof(objectProp), PropEnum.objectProp)]
[DataRow(nameof(stringProp), PropEnum.stringProp)]
[DataRow("BlaBla", null)]
public void EnumMemberTest(string name, PropEnum? peExp)
{
Assert.AreEqual(peExp, typeof(PropEnum).EnumMember(name));
}
"normal" tests are executes ok. e.G:
/// <summary>
/// Test EnumMemberTest, to thow exception.
/// </summary>
[TestMethod()]
public void EnumMemberTest2()
{
Assert.ThrowsException<ArgumentException>(() => typeof(string).EnumMember("Hallo"));
}
I am using Visual Studion 17.12.5 and I am experiencing the following problem.
After upgrading the MSTest-package from 3.7.3 to 3.8.0 and Microsoft.NET.Test.Sdk from 17.12.0 to 17.13.0 the most of my tests are ignored.
More precise: The Test-Explorer of Visual Studion gives a yellow warning-sign with most of the tests, but some ~ 2% are executed OK.
[...]
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="MSTest" Version="3.8.0" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
[...]
Reverting back to 3.7.3 and 17.12.0 all tests are executed normally:
[...]
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest" Version="3.7.3" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
[...]
for Code-Coverage I use Fine-Code-Coverage.
BTW: Isn't it nice(!) that all tests appear green at first glance, only if you look closer you find out that 10152 tests have been skipped, and only 156 have been ok.
See and try code on my GitHub: https://github/joecare99/CSharp/tree/master/CSharpBible/Libraries
e.G: BaseLibTests, ...
It happens to all targets 4.6.2 - 4.8.1 and 6.0 - 9.0
Does anybody experience the same behavior or knows a solution ?
[Edit:] With some investigation I found out that tests with "[DataRow(...)]"-attribute are skipped e.G:
/// <summary>
/// Test EnumMember-Helper function
/// </summary>
/// <param name="name">The name.</param>
/// <param name="peExp">The expected result</param>
[DataTestMethod()]
[DataRow(nameof(intProp), PropEnum.intProp)]
[DataRow(nameof(boolProp), PropEnum.boolProp)]
[DataRow(nameof(enumProp), PropEnum.enumProp)]
[DataRow(nameof(objectProp), PropEnum.objectProp)]
[DataRow(nameof(stringProp), PropEnum.stringProp)]
[DataRow("BlaBla", null)]
public void EnumMemberTest(string name, PropEnum? peExp)
{
Assert.AreEqual(peExp, typeof(PropEnum).EnumMember(name));
}
"normal" tests are executes ok. e.G:
/// <summary>
/// Test EnumMemberTest, to thow exception.
/// </summary>
[TestMethod()]
public void EnumMemberTest2()
{
Assert.ThrowsException<ArgumentException>(() => typeof(string).EnumMember("Hallo"));
}
Share
Improve this question
edited Feb 16 at 21:43
Joe Care
asked Feb 16 at 21:11
Joe CareJoe Care
1138 bronze badges
8
- Same here, just noticed this. Struggling for a while and without any solution. – Wiktor Zychla Commented Feb 17 at 12:17
- My current workaround is the downgrade to 3.7.3/17.12.0. Bumping any of the two breaks it. – Wiktor Zychla Commented Feb 17 at 13:18
- Downgrading is also my workaround, (as I mentioned above) but this can be only a temporary solution. – Joe Care Commented Feb 17 at 20:16
- BTW: There is already a GitHub-Issue on this topic. Stating a short workaround, and promise a fix for MSTest 3.8.1 – Joe Care Commented Feb 17 at 20:57
- I tried part of your code, including the EnumMember method you uploaded and some of my own tests using DataRow. I wasn't able to reproduce your issue. However, I found a post on GitHub about the same problem, and a Microsoft engineer there mentioned that a fix will be released in version 3.8.1. If you have any further questions about this, you can continue to follow up through the link below or open a new case on GitHub. statics.teams.cdn.office/evergreen-assets/safelinks/1/… – Zhenning Zhang Commented Feb 18 at 1:38
1 Answer
Reset to default 2This has been fixed. Update the MsTest.TestAdapter and the MsTest.Sdk version if using that, or the integrated MSTest Package at least to Version 3.8.2 And don‘t fet to update the Microsoft.NET.Test.Sdk to the related version.