Build/Test Issues

Unit test "failing" in NCrunch, but passing in all other test runners.

Started by mking on 6,344 views

Hi,

I have a unit test that is failing in NCrunch but passing under all other test runners.

I've created a GitHub repository with more details, and a simple example that you can use to replicate the problem:
https://github.com/MatthewKing/NCrunchNancyFxBug

Problem description

I have a project using NancyFx, as well as some unit tests for that project. All of my tests pass when I use the standard test runner for my unit testing framework (I've tried both xUnit and NUnit). However, when I use NCrunch to automate my testing, any tests that involve the Razor view engine fail in NCrunch (but still pass when run with the standard test runner).

[img=https://github.com/MatthewKing/NCrunchNancyFxBug/raw/master/test-results.png]Test Results[/img]

Simple example that demonstrates the issue

https://github.com/MatthewKing/NCrunchNancyFxBug
Hi,

Thanks for reporting this issue and for sharing the sample code to reproduce. It's always much easier to analyse an issue like this when there is sample code available.

This issue is being caused by an assembly co-location assumption inside the Nancy framework source code. This code is expecting all assemblies to exist in the same directory when the test is run - an assumption that doesn't hold true for NCrunch unless the Copy referenced assemblies to workspace setting is set to TRUE.

Changing this configuration setting should solve the problem. Depending upon your solution structure, you may also need to change the same setting on other projects depended on by your test project.
Hi Remco,

Thanks for the prompt reply. This has completely solved my issue! Great support, as always.

I've updated the GitHub repository to include the solution and a quote from your forum post, as I had linked it elsewhere and abhor link rot. I assume you're happy to have your quote immortalized there - it not, let me know.

Thanks once again for the solution and the quick response.
Cheers!

Post a reply

Log in to reply.