private void ReportTestStart(string line) { string qualifiedTestname = StandardOutputTestResultParser.RemovePrefix(line).Trim(); TestCase testCase = StandardOutputTestResultParser.FindTestcase(qualifiedTestname, _testCasesRun); _reporter.ReportTestsStarted(testCase.Yield()); }
// 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); } }
private void ReportTestStart(string line) { string qualifiedTestname = RemovePrefix(line).Trim(); TestCase testCase = FindTestcase(qualifiedTestname, _testCasesRun); if (testCase != null) { _reporter.ReportTestsStarted(testCase.Yield()); } }
private TestResult ReportExitCodeTestResult(ExecutableResult executableResult) { var exitCodeTestCase = CreateExitCodeTestCase(_settings, executableResult.Executable); _reporter.ReportTestsStarted(exitCodeTestCase.Yield()); var testResult = CreateExitCodeTestResult(exitCodeTestCase, executableResult); _reporter.ReportTestResults(testResult.Yield()); return(testResult); }
// ReSharper disable once UnusedParameter.Local private void RunTestsFromExecutable(string executable, string workingDir, IEnumerable <TestCase> testCasesToRun, string userParameters, bool isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher, IProcessExecutor executor) { string resultXmlFile = Path.GetTempFileName(); var serializer = new TestDurationSerializer(); var generator = new CommandLineGenerator(testCasesToRun, executable.Length, userParameters, resultXmlFile, _settings); foreach (CommandLineGenerator.Args arguments in generator.GetCommandLines()) { if (_canceled) { break; } var streamingParser = new StreamingStandardOutputTestResultParser(arguments.TestCases, _logger, _frameworkReporter); var results = RunTests(executable, workingDir, isBeingDebugged, debuggedLauncher, arguments, resultXmlFile, executor, streamingParser).ToArray(); try { Stopwatch stopwatch = Stopwatch.StartNew(); _frameworkReporter.ReportTestsStarted(results.Select(tr => tr.TestCase)); _frameworkReporter.ReportTestResults(results); stopwatch.Stop(); if (results.Length > 0) { _logger.DebugInfo($"{_threadName}Reported {results.Length} test results to VS, executable: '{executable}', duration: {stopwatch.Elapsed}"); } } catch (TestRunCanceledException e) { _logger.DebugInfo($"{_threadName}Execution has been canceled: {e.InnerException?.Message ?? e.Message}"); Cancel(); } serializer.UpdateTestDurations(results); foreach (TestResult result in results) { if (!_schedulingAnalyzer.AddActualDuration(result.TestCase, (int)result.Duration.TotalMilliseconds)) { _logger.DebugWarning("TestCase already in analyzer: " + result.TestCase.FullyQualifiedName); } } } }