Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

MsTest v2 DataRowAttribute: null is ignored if last of two parameter
FsdErikB
#1 Posted : Thursday, October 26, 2017 2:51:41 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/26/2017(UTC)
Posts: 2
Location: Germany

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
Remco
#2 Posted : Thursday, October 26, 2017 9:08:57 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
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.
FsdErikB
#3 Posted : Friday, April 20, 2018 1:31:35 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/26/2017(UTC)
Posts: 2
Location: Germany

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)
{
...
}


Remco
#4 Posted : Friday, April 20, 2018 11:50:54 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
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'.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download