Build/Test Issues

NCrunch fails unit test where MSTest passes

Started by Queck on 5,920 views

Hi,

I am new to NCrunch and started to evaluate it today.
I have a issue, that NCrunch can not run a unit test which on the other hand runns without problem when using MSTest.
The code NCrunch is complaining about (reporting a ArgumentNullException:

var usfFileName = Path.Combine(this.TestContext.TestRunDirectory, "testUsf.usf");

How can this line cause a ArgumentNullExceptione?
Unless NCrunch as a problem with MSTest - TestContext....

Regards
Rainer
Hi Rainer -

NCrunch's MSTest support is emulated rather than integrated, so the properties available on the TestContext need to be declared by NCrunch specifically in order for them to be available to your tests.

It looks like you've managed to find a property that hasn't been set (and should be), so this is basically a hole in the support.

I've noted this down to be fixed. There should be a number of ways to work around this problem - check whether the TestContext contains any other properties with the same value (many of them are duplicates). You may also be able to obtain the test run directory using System.IO.Directory.GetCurrentDirectory(), or using the location of the test assembly - System.IO.Path.GetDirectoryName(this.GetType().Assembly.Location)

Post a reply

Log in to reply.