public IList <TestCase> CreateTestCases() { var launcher = new ProcessLauncher(_testEnvironment, _testEnvironment.Options.GetPathExtension(_executable)); int processReturnCode; List <string> consoleOutput = launcher.GetOutputOfCommand("", _executable, GoogleTestConstants.ListTestsOption.Trim(), false, false, out processReturnCode); if (processReturnCode != 0) { string messsage = $"Could not list test cases of executable '{_executable}': executing process failed with return code {processReturnCode}"; messsage += $"\nCommand executed: '{_executable} {GoogleTestConstants.ListTestsOption.Trim()}', working directory: '{Path.GetDirectoryName(_executable)}'"; if (consoleOutput.Count(s => !string.IsNullOrEmpty(s)) > 0) { messsage += $"\nOutput of command:\n{string.Join("\n", consoleOutput)}"; } else { messsage += "\nCommand produced no output"; } _testEnvironment.LogWarning(messsage); return(new List <TestCase>()); } IList <TestCaseDescriptor> testCaseDescriptors = new ListTestsParser(_testEnvironment).ParseListTestsOutput(consoleOutput); if (_testEnvironment.Options.ParseSymbolInformation) { List <TestCaseLocation> testCaseLocations = GetTestCaseLocations(testCaseDescriptors, _testEnvironment.Options.GetPathExtension(_executable)); return(testCaseDescriptors.Select(descriptor => CreateTestCase(descriptor, testCaseLocations)).ToList()); } return(testCaseDescriptors.Select(CreateTestCase).ToList()); }
public IList<TestCase> CreateTestCases() { var launcher = new ProcessLauncher(_testEnvironment, _testEnvironment.Options.GetPathExtension(_executable)); int processReturnCode; List<string> consoleOutput = launcher.GetOutputOfCommand("", _executable, GoogleTestConstants.ListTestsOption.Trim(), false, false, out processReturnCode); if (processReturnCode != 0) { string messsage = $"Could not list test cases of executable '{_executable}': executing process failed with return code {processReturnCode}"; messsage += $"\nCommand executed: '{_executable} {GoogleTestConstants.ListTestsOption.Trim()}', working directory: '{Path.GetDirectoryName(_executable)}'"; if (consoleOutput.Count(s => !string.IsNullOrEmpty(s)) > 0) messsage += $"\nOutput of command:\n{string.Join("\n", consoleOutput)}"; else messsage += "\nCommand produced no output"; _testEnvironment.LogWarning(messsage); return new List<TestCase>(); } IList<TestCaseDescriptor> testCaseDescriptors = new ListTestsParser(_testEnvironment).ParseListTestsOutput(consoleOutput); if (_testEnvironment.Options.ParseSymbolInformation) { List<TestCaseLocation> testCaseLocations = GetTestCaseLocations(testCaseDescriptors, _testEnvironment.Options.GetPathExtension(_executable)); return testCaseDescriptors.Select(descriptor => CreateTestCase(descriptor, testCaseLocations)).ToList(); } return testCaseDescriptors.Select(CreateTestCase).ToList(); }
public IList <TestCase> CreateTestCases() { var launcher = new ProcessLauncher(_testEnvironment, _testEnvironment.Options.PathExtension); List <string> consoleOutput = launcher.GetOutputOfCommand("", _executable, GoogleTestConstants.ListTestsOption.Trim(), false, false); IList <TestCaseDescriptor> testCaseDescriptors = new ListTestsParser(_testEnvironment).ParseListTestsOutput(consoleOutput); if (_testEnvironment.Options.ParseSymbolInformation) { List <TestCaseLocation> testCaseLocations = GetTestCaseLocations(testCaseDescriptors, _testEnvironment.Options.PathExtension); return(testCaseDescriptors.Select(descriptor => CreateTestCase(descriptor, testCaseLocations)).ToList()); } return(testCaseDescriptors.Select(CreateTestCase).ToList()); }
public IList <TestCase> CreateTestCases(Action <TestCase> reportTestCase = null) { List <string> standardOutput = new List <string>(); if (_settings.UseNewTestExecutionFramework) { return(NewCreateTestcases(reportTestCase, standardOutput)); } try { var launcher = new ProcessLauncher(_logger, _settings.GetPathExtension(_executable)); int processExitCode; standardOutput = launcher.GetOutputOfCommand("", _executable, GoogleTestConstants.ListTestsOption.Trim(), false, false, out processExitCode); if (!CheckProcessExitCode(processExitCode, standardOutput)) { return(new List <TestCase>()); } } catch (Exception e) { SequentialTestRunner.LogExecutionError(_logger, _executable, Path.GetFullPath(""), GoogleTestConstants.ListTestsOption.Trim(), e); return(new List <TestCase>()); } IList <TestCaseDescriptor> testCaseDescriptors = new ListTestsParser(_settings.TestNameSeparator).ParseListTestsOutput(standardOutput); if (_settings.ParseSymbolInformation) { List <TestCaseLocation> testCaseLocations = GetTestCaseLocations(testCaseDescriptors, _settings.GetPathExtension(_executable)); return(testCaseDescriptors.Select(descriptor => CreateTestCase(descriptor, testCaseLocations)).ToList()); } return(testCaseDescriptors.Select(CreateTestCase).ToList()); }