Ejemplo n.º 1
0
        private void SendMutationTestToDispatcher(MutantMetaData mutation)
        {
            TestDescription testDescription = new TestDescription(Path.Combine(mutation.TestDirectory.FullName, Path.GetFileName(TestAssemblyLocation)), _testsToRun, _benchmark.TotalMs);

            _pendingTest.Add(testDescription.Uid, mutation);
            _dispatcher.SendTest(testDescription);
        }
Ejemplo n.º 2
0
        private bool CheckTestResult(MethodTurtleBase turtle, MutantMetaData mutation, TestDescription testDescription)
        {
            var    exitedInTime    = testDescription.ExitedInTime;
            var    exitCode        = (testDescription.TestsPass ? 0 : 1);
            bool   testSuitePassed = exitCode == 0 && exitedInTime;
            string result          = string.Format(" Mutant: {0}. {1}",
                                                   mutation.Description,
                                                   testSuitePassed
                                ? "Survived."
                                : "Killed.");

            _report.AddResult(mutation.MethodDefinition.GetCurrentSequencePoint(mutation.ILIndex), mutation, !testSuitePassed);

            if (testSuitePassed)
            {
                mutation.TestDirectory.DoNotDelete = true;
                var sourceFilename    = mutation.MethodDefinition.GetOriginalSourceFileName(mutation.ILIndex);
                var testDirectoryPath = mutation.TestDirectoryName;
                if (sourceFilename != null)
                {
                    var sourceCode = mutation.GetOriginalSourceCode(mutation.ILIndex);
                    result =
                        string.Format(
                            "{0}\nOriginal source code around surviving mutant (in {1}):\n{2}\nFiles left for inspection in: {3}",
                            result,
                            sourceFilename,
                            sourceCode,
                            testDirectoryPath);
                }
                else
                {
                    result = string.Format(
                        "{0}\nOriginal source code couldn't be retrieve\nFiles left for inspection in: {1}",
                        result,
                        testDirectoryPath);
                }
            }

            Console.WriteLine(result);

            turtle.MutantComplete(mutation);
            return(!testSuitePassed);
        }