Hi,
I found a mismatch in the execution of DataRow tests between MsTestRunner and NCrunch.
In detail it seems like NCrunch simply ignores the last parameter of the DataRowAttribute if it is null, which leads to a failing test with the following message: "Test parameter count mismatch".
We are currently using MsTest.TestFramework & MsTest.TestFramework in version 1.2.0.
Reproduction:
The TestMethod takes two parameters.
First one is an enum value, the second one is a nullable enum value.
When we set the second parameter to null, the test fails, whereas MsTestRunner runs fine.
If we add a third dummy parameter (e.g. string) everything works fine again, independent of whether it is set to null or not.
If I had to take a guess, NCrunch interprets the null of the second parameter as DisplayName, which seems to be an optional parameter for DataRow, and discards it.
Kind regards,
Erik
Build/Test Issues
MsTest v2 DataRowAttribute: null is ignored if last of two parameter
Started by FsdErikB on 7,582 views
Remco NCrunch Developer
#11423
26 Oct 2017 21:08 UTC
Hi Erik,
Thanks for sharing this problem. A fix for this one is coming in the next release, so hopefully you'll see the last of it soon.
Thanks for sharing this problem. A fix for this one is coming in the next release, so hopefully you'll see the last of it soon.
Edited 26 Oct 2017 22:44 UTC
Hi,
sorry for resurrecting this old thread.
But as it seems, this bug has even got worse with the latest update.
It looks like every test which looks like the sample below fails to run.
Independent of how many parameters the datarow has or in which order they are passed.
[TestMethod]
[DataRow("abc", CustomEnum.value)]
public void TestMethod(string text, CustomEnum? parameter)
{
...
}
sorry for resurrecting this old thread.
But as it seems, this bug has even got worse with the latest update.
It looks like every test which looks like the sample below fails to run.
Independent of how many parameters the datarow has or in which order they are passed.
[TestMethod]
[DataRow("abc", CustomEnum.value)]
public void TestMethod(string text, CustomEnum? parameter)
{
...
}
Remco NCrunch Developer
#12075
20 Apr 2018 23:50 UTC
Sorry about this, we have a fix for this coming in the release due this weekend.
If you haven't already, I strongly recommend making sure you have your 'Framework utilisation type for MSTest' set to 'DynamicAnalysis'.
If you haven't already, I strongly recommend making sure you have your 'Framework utilisation type for MSTest' set to 'DynamicAnalysis'.
Edited 20 Apr 2018 23:52 UTC
Post a reply
Log in to reply.