Beispiel #1
0
        private bool BuildAndRunMutationTest(MutationTest mutationTest)
        {
            var outputOption = Options.Options.OfType <Output>().FirstOrDefault();

            if (outputOption != null)
            {
                string outputPath = Path.Combine(Environment.CurrentDirectory, outputOption.FileName);
                mutationTest.MergeReportTo(outputPath);
            }
            var turtlesOption = Options.Options.OfType <TurtlesTypes>().FirstOrDefault();

            if (turtlesOption != null)
            {
                mutationTest.With(turtlesOption.Types);
            }
            bool result = false;

            try
            {
                mutationTest.Run(Options.Options.Any(o => o is DetachBench));
                result = true;
            }
            catch (MutationTestFailureException)
            {
            }
            catch (Exception ex)
            {
                System.Console.Error.WriteLine("An error occur during mutation test of {0}:\n{1}\nThe corresponding report was not merged", mutationTest.TargetMethod, ex);
                return(false);
            }
            _report.MergeMutationTestReport(mutationTest.Report);
            return(result);
        }
Beispiel #2
0
        private bool RunTests(string targetAssemblyLocation, string targetClass, string targetMethod, TestsDispatcher dispatcher, Type[] parameterTypes = null)
        {
            var parameterList = parameterTypes == null || parameterTypes.Length == 0
                                    ? null
                                    : String.Join(", ", parameterTypes.Select(t => t.Name).ToArray());

            OutputMethod(targetClass, targetMethod, parameterList);
            MutationTest mutationTest =
                parameterTypes == null
                    ? (MutationTest)MutationTestBuilder.For(targetAssemblyLocation, targetClass, targetMethod, dispatcher, _testMethods)
                    : (MutationTest)MutationTestBuilder.For(targetAssemblyLocation, targetClass, targetMethod, dispatcher, _testMethods, parameterTypes);

            mutationTest.TestAssemblyLocation = _testAssemblyLocation;
            var result = BuildAndRunMutationTest(mutationTest);

            return(result);
        }
Beispiel #3
0
        private bool BuildAndRunMutationTest(MutationTest mutationTest)
        {
            var outputOption = Options.Options.OfType<Output>().FirstOrDefault();
            if (outputOption != null)
            {
                string outputPath = Path.Combine(Environment.CurrentDirectory, outputOption.FileName);
                mutationTest.MergeReportTo(outputPath);
            }
            bool result = false;
            try
            {
                mutationTest.Run();
                result = true;
            }
            catch (MutationTestFailureException)
            {
            }
            catch (Exception ex)
            {
                Debugger.Launch();
                _message =
                    @"
An exception was thrown setting up the mutation tests. The exception details
are below. If you are unable to resolve the problem from these details, please
post the details in our issue tracker at:

http://ninjaturtles.codeplex.com/workitem/list/basic

Exception details:

" + ex;
            }
            return result;
        }