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

Notification

Icon
Error

Tests utilising Microsoft.AspNet.TestHost i.c.w. MVC Views fail in NCrunch
jp7677
#1 Posted : Monday, June 12, 2017 9:40:05 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/12/2017(UTC)
Posts: 6
Location: Netherlands

Was thanked: 1 time(s) in 1 post(s)
Hi there,

As a follow-up to http://forum.ncrunch.net...t-fail-in-NCrunch.aspx, there is still a case where ncrunch fails to successfully execute unit test. That case would be compilation of mvc views.

I have a reproduction repository here:
https://github.com/jp7677/ncrunchbugrepro

There are two testcases, one is a normal MVC Controller, that one succeeds with the latest ncrunch version. The second test involves MVC view compilation. This one fails in ncrunch, but succeeds on the command line. Note that there is a workaround in the csproj file for the test project (https://github.com/jp7677/ncrunchbugrepro/blob/master/NCrunchBugRepro.Test/NCrunchBugRepro.Test.csproj), taken from https://github.com/NuGet/Home/issues/4412.

If I apply this workaround manually to nrcunch, thus copying the NCrunchBugRepro.deps.json into the ncrunch test, ncrunch can successfully execute the test.
Thus I guess a solution would be that the mode "Copy Referenced Assemblies To Workspace" should also include deps.json files.

Regards and thanks for creating and supporting ncrunch!
Jens
Remco
#2 Posted : Monday, June 12, 2017 10:37:51 AM(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 Jens,

Thanks for sharing the extension to this issue. I believe you are correct in that copying the .deps files over when 'Copy referenced assemblies to workspace' is enabled would be the correct solution here. I'll see what I can do about arranging a fix.
jp7677
#3 Posted : Monday, June 12, 2017 12:55:09 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/12/2017(UTC)
Posts: 6
Location: Netherlands

Was thanked: 1 time(s) in 1 post(s)
Thanks for the fast response! Nice to read that and looking forward to a solution.
Remco
#4 Posted : Friday, June 16, 2017 4:05:44 AM(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)
jp7677
#5 Posted : Friday, June 16, 2017 11:32:15 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/12/2017(UTC)
Posts: 6
Location: Netherlands

Was thanked: 1 time(s) in 1 post(s)
Thanks a lot. works perfectly for my scenarios.
Though I have noticed that view compilation inside ncrunch still fails when one references other projects directly inside the views.
Remco
#6 Posted : Saturday, June 17, 2017 1:29:19 AM(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)
jp7677;10634 wrote:
Thanks a lot. works perfectly for my scenarios.
Though I have noticed that view compilation inside ncrunch still fails when one references other projects directly inside the views.


Thanks. I'll see if I can get this sorted in the next dev build.
Remco
#7 Posted : Monday, June 19, 2017 11:05:24 AM(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)
jp7677
#8 Posted : Monday, June 19, 2017 12:37:32 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/12/2017(UTC)
Posts: 6
Location: Netherlands

Was thanked: 1 time(s) in 1 post(s)
How convenient, I had just updated my reproduction repository at https://github.com/jp7677/ncrunchbugrepro for my latest issue here with directly referenced projects in MVC pages ;)
Unfortunately ncrunch (3.10.0.2) still fails to run my second test while "dotnet test" on the command line succeeds, please see my repository.
Remco
#9 Posted : Thursday, June 29, 2017 7:43:56 AM(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)
jp7677
#10 Posted : Monday, July 3, 2017 7:59:59 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/12/2017(UTC)
Posts: 6
Location: Netherlands

Was thanked: 1 time(s) in 1 post(s)
Hi there, thanks for version 3.10.0.6. Unfortunately my second issue reported here (posting #8) is not yet fixed on my machine with that version.
Remco
#11 Posted : Monday, July 3, 2017 9:53:07 AM(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)
jp7677;10732 wrote:
Hi there, thanks for version 3.10.0.6. Unfortunately my second issue reported here (posting #8) is not yet fixed on my machine with that version.


Sorry, I should have clarified this. For the fix to work, you'll need to turn on the 'Copy referenced assemblies to workspace' setting for all projects in the dependency chain. NCrunch will implicitly turn this on for any projects that reference AspNet.TestHost, but it can't do this automatically for projects deeper down the chain.
jp7677
#12 Posted : Monday, July 3, 2017 10:20:55 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/12/2017(UTC)
Posts: 6
Location: Netherlands

Was thanked: 1 time(s) in 1 post(s)
Remco;10733 wrote:
For the fix to work, you'll need to turn on the 'Copy referenced assemblies to workspace' setting for all projects in the dependency chain.


Yes, that did the trick, thanks a lot!
1 user thanked jp7677 for this useful post.
Remco on 7/3/2017(UTC)
Remco
#13 Posted : Tuesday, July 18, 2017 1:18:58 AM(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)
NCrunch v3.10 has now been released.
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.088 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download