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

Notification

Icon
Error

DataTestMethod with Enumerators fail in NCrunch
Kaerwek
#1 Posted : Monday, August 07, 2017 8:05:11 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/7/2017(UTC)
Posts: 2
Location: Finland

We're using DataTestMethods with enumerators, e.g.

[DataTestMethod]
[DataRow(AlignmentX.Center, "middle", DisplayName = "Returns \"middle\" for given AlignmentX = Center")]
[DataRow(AlignmentX.Left, "start", DisplayName = "Returns \"start\" for given AlignmentX = Left")]
[DataRow(AlignmentX.Right, "end", DisplayName = "Returns \"end\" for given AlignmentX = Right")]
public void Test(object input, string expected)

The tests fail because NCrunch converts the chosen enumerator to the backend value. When entering a breakpoint in debugger mode on first line, I see that input is an integer, 2, in the first case.

If I had a test that only tested for AlignmentX, I could perhaps code past it, but currently I have loads of other datarows and datatypes. Forcing everyone in the organization (since all dont use NCrunch), to create specific tests for DataTestMethods that use a specific enumerator isn't really feasible either.


Is this a known issue?
Remco
#2 Posted : Monday, August 07, 2017 8:09:41 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
Hi,

Thanks for sharing this issue.

Until now, I was not aware of this issue, but it does make sense that it could exist. There is some complexity in the handling of DataRow parameters, and you've managed to find an alignment hole.

I'll see what I can do about getting this fixed in the next build.
Remco
#3 Posted : Thursday, August 31, 2017 1:32:35 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
I've taken a deeper look into this issue, and prepared a fix expected to be in a new version of NCrunch released by early next week.

The fix is narrow in scope. It will only work when MSTest is set to use a framework utilisation type of 'Dynamic Analysis'. This can be adjusted in your NCrunch configuration.

For performance reasons, the default mode of operation under MSTest is set to 'Static Analysis'. Unfortunately, static analysis does have some compatibility trade-offs that can affect edge cases like this one. If you are in a situation where other team members are using different test runners to NCrunch and alignment between runners is critically important, I recommend using Dynamic Analysis instead.
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.027 seconds.