예제 #1
0
 public void Cancel()
 {
     if (_processId.HasValue)
     {
         TestProcessLauncher.KillProcess(_processId.Value, _logger);
     }
 }
        // ReSharper disable once UnusedParameter.Local
        private void RunTestsFromExecutable(string executable, string workingDir,
            IEnumerable<TestCase> allTestCases, IEnumerable<TestCase> testCasesToRun, string baseDir, string userParameters,
            bool isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher)
        {
            string resultXmlFile = Path.GetTempFileName();
            var serializer = new TestDurationSerializer();

            var generator = new CommandLineGenerator(allTestCases, testCasesToRun, executable.Length, userParameters, resultXmlFile, _testEnvironment);
            foreach (CommandLineGenerator.Args arguments in generator.GetCommandLines())
            {
                if (_canceled)
                {
                    break;
                }

                _frameworkReporter.ReportTestsStarted(arguments.TestCases);
                List<string> consoleOutput = new TestProcessLauncher(_testEnvironment, isBeingDebugged).GetOutputOfCommand(workingDir, executable, arguments.CommandLine, _testEnvironment.Options.PrintTestOutput && !_testEnvironment.Options.ParallelTestExecution, false, debuggedLauncher);
                IEnumerable<TestResult> results = CollectTestResults(arguments.TestCases, resultXmlFile, consoleOutput, baseDir);

                Stopwatch stopwatch = Stopwatch.StartNew();
                _frameworkReporter.ReportTestResults(results);
                stopwatch.Stop();
                _testEnvironment.DebugInfo($"Reported {results.Count()} test results to VS, executable: '{executable}', duration: {stopwatch.Elapsed}");

                serializer.UpdateTestDurations(results);
            }
        }
예제 #3
0
 public void Cancel()
 {
     if (_process != null)
     {
         TestProcessLauncher.KillProcess(_process.Id, _logger);
     }
 }
        public void GetOutputOfCommand_WithSimpleCommand_ReturnsOutputOfCommand()
        {
            List <string> output = new TestProcessLauncher(TestEnvironment.Logger, TestEnvironment.Options, false)
                                   .GetOutputOfCommand(".", "cmd.exe", "/C \"echo 2\"", false, false, null);

            output.Count.Should().Be(1);
            output[0].Should().Be("2");
        }
        public void GetOutputOfCommand_WithSimpleCommand_ReturnsOutputOfCommand()
        {
            List <string> output = new TestProcessLauncher(TestEnvironment, false)
                                   .GetOutputOfCommand(".", "cmd.exe", "/C \"echo 2\"", false, false, null);

            Assert.AreEqual(1, output.Count);
            Assert.AreEqual("2", output[0]);
        }
        public void GetOutputOfCommand_WithSimpleCommand_ReturnsOutputOfCommand()
        {
            List<string> output = new TestProcessLauncher(TestEnvironment, false)
                .GetOutputOfCommand(".", "cmd.exe", "/C \"echo 2\"", false, false, null);

            output.Count.Should().Be(1);
            output[0].Should().Be("2");
        }