Basic test throw cannot find the file specified error

Jan 29, 2015 at 11:45 AM
Each time I try to run a basic test I get an error "----> System.ComponentModel.Win32Exception : The system cannot find the file specified"

I am using Visual studio 2013 with .NET 4.5 and running them through the unit test runner.

Test output:
Suite of 1 tests identified for MutationSimple.MathsTests+Maths.Add
Rotating arithmetic operators +, -, *, / and %.
System.AggregateException : One or more errors occurred.
  ----> System.ComponentModel.Win32Exception : The system cannot find the file specified

   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at System.Threading.Tasks.Parallel.PartitionerForEachWorker(Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEachWorker(IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEach(IEnumerable`1 source, Action`1 body)
   at NinjaTurtles.MutationTest.Run()
   at MutationSimple.MathsTests.FunctionsTests.MutateTestAdd() in MathsTests.cs: line 31
--Win32Exception
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at NinjaTurtles.MutationTest.CheckTestProcessFails(MethodTurtleBase turtle, MutantMetaData mutation)
   at NinjaTurtles.MutationTest.RunMutation(MethodTurtleBase turtle, MutantMetaData mutation, ref Int32 failures, ref Int32 count)
   at NinjaTurtles.MutationTest.<>c__DisplayClass5.<Run>b__1(MutantMetaData mutation)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass32`2.<PartitionerForEachWorker>b__30()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   at System.Threading.Tasks.Task.<>c__DisplayClass11.<ExecuteSelfReplicating>b__10(Object param0)
Code:
using NinjaTurtles;
using NinjaTurtles.Turtles;
using NUnit.Framework;

namespace MutationSimple
{
    class MathsTests
    {
        public class Maths
        {
            public int Add(int x, int y)
            {
                return x + y;
            }
        }
        [TestFixture]
        public class FunctionsTests
        {
            [Test]
            public void TestBasicAdd()
            {
                var functions = new Maths();
                int actual = functions.Add(2, 3);

                Assert.AreEqual(5, actual);
            }

            [Test, MutationTest]
            public void MutateTestAdd()
            {
                MutationTestBuilder<Maths>.For("Add").With<ArithmeticOperatorTurtle>().Run();
            }
        }
    }
}
Coordinator
Jan 29, 2015 at 2:35 PM
It sounds like the process doesn't have write access to the directory that the assembly is running from. If you set up nlog from your test fixture, and set the loglevel to debug, you should get quite a bit of diagnostic information out, most notably where it's trying to create the mutation directory.
Jan 29, 2015 at 4:29 PM
When I look in the directories they appear to have been created correctly and the contents has been copied.

Log output:
2015-01-29 16:24:41.2396|WARN|NinjaTurtles.MethodDefinitionResolver|"ResolveMethod" overload with parameter types called unnecessarily.
2015-01-29 16:24:41.2556|DEBUG|NinjaTurtles.MethodDefinitionResolver|Resolving method "Add" in "MutationSimple.MathsTests/Maths".
2015-01-29 16:24:41.2556|DEBUG|NinjaTurtles.MethodDefinitionResolver|Method "Add" successfully resolved in "MutationSimple.MathsTests/Maths".
2015-01-29 16:24:41.3706|DEBUG|NinjaTurtles.TestDirectory|Creating folder "C:\Users\louise.beech\AppData\Local\Temp\NinjaTurtles\525cd52603324c74840f3d938fca8633".
2015-01-29 16:24:41.3706|DEBUG|NinjaTurtles.TestDirectory|Copying contents from folder "C:\Work\GITHub\Learning\MutationTesting\MutationSimple\MutationSimple\bin\Debug".
2015-01-29 16:24:41.3996|DEBUG|NinjaTurtles.TestDirectory|Writing assembly "MutationSimple.dll" to "C:\Users\louise.beech\AppData\Local\Temp\NinjaTurtles\525cd52603324c74840f3d938fca8633".
2015-01-29 16:24:41.4836|DEBUG|NinjaTurtles.TestDirectory|Creating folder "C:\Users\louise.beech\AppData\Local\Temp\NinjaTurtles\38142e5a6f4142548b5f5f1f2a495a4f".
2015-01-29 16:24:41.4836|DEBUG|NinjaTurtles.TestDirectory|Copying contents from folder "C:\Work\GITHub\Learning\MutationTesting\MutationSimple\MutationSimple\bin\Debug".
2015-01-29 16:24:41.5066|DEBUG|NinjaTurtles.TestDirectory|Writing assembly "MutationSimple.dll" to "C:\Users\louise.beech\AppData\Local\Temp\NinjaTurtles\38142e5a6f4142548b5f5f1f2a495a4f".
2015-01-29 16:24:41.5066|DEBUG|NinjaTurtles.TestDirectory|Creating folder "C:\Users\louise.beech\AppData\Local\Temp\NinjaTurtles\8fc2c2522b944ff7aab4e28ff3c25a4a".
2015-01-29 16:24:41.5066|DEBUG|NinjaTurtles.TestDirectory|Copying contents from folder "C:\Work\GITHub\Learning\MutationTesting\MutationSimple\MutationSimple\bin\Debug".
2015-01-29 16:24:41.5346|DEBUG|NinjaTurtles.TestDirectory|Writing assembly "MutationSimple.dll" to "C:\Users\louise.beech\AppData\Local\Temp\NinjaTurtles\8fc2c2522b944ff7aab4e28ff3c25a4a".
2015-01-29 16:24:41.5396|DEBUG|NinjaTurtles.TestDirectory|Creating folder "C:\Users\louise.beech\AppData\Local\Temp\NinjaTurtles\ad78f021876142f8af4175fa4344d05e".
2015-01-29 16:24:41.5396|DEBUG|NinjaTurtles.TestDirectory|Copying contents from folder "C:\Work\GITHub\Learning\MutationTesting\MutationSimple\MutationSimple\bin\Debug".
Coordinator
Jan 29, 2015 at 10:05 PM
Edited Jan 29, 2015 at 10:08 PM
OK, I think I've cracked it, I think the issue might be because it cannot find the nunit runner for the version of nunit you are using. If you install or update your solution package of nunit.runners to the same version as your nunit, it should disappear.

Look under your packages directory, I'm willing to bet that the version of nunit you have there does not match the version of nunit.runners, or indeed, nunit.runners is missing altogether.