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 List<string> GetOutputOfCommand(string workingDirectory, string command, string param, bool printTestOutput,
            bool throwIfError, IDebuggedProcessLauncher debuggedLauncher, out int processExitCode)
        {
            if (_isBeingDebugged)
            {
                var output = new List<string>();
                processExitCode = LaunchProcessWithDebuggerAttached(workingDirectory, command, param, printTestOutput, debuggedLauncher);
                return output;
            }

            var actualLauncher = new ProcessLauncher(_testEnvironment, _testEnvironment.Options.GetPathExtension(command));
            return actualLauncher.GetOutputOfCommand(workingDirectory, command, param, printTestOutput, 
                throwIfError, out processExitCode);
        }
        public List <string> GetOutputOfCommand(string workingDirectory, IDictionary <string, string> envVars, string command, string param, bool printTestOutput,
                                                bool throwIfError, IDebuggedProcessLauncher debuggedLauncher, out int processExitCode)
        {
            if (_isBeingDebugged)
            {
                var output = new List <string>();
                processExitCode = LaunchProcessWithDebuggerAttached(workingDirectory, envVars, command, param, printTestOutput, debuggedLauncher);
                return(output);
            }

            var actualLauncher = new ProcessLauncher(_logger, _settings.GetPathExtension(command), processId => _processId = processId);

            return(actualLauncher.GetOutputOfCommand(workingDirectory, envVars, command, param, printTestOutput,
                                                     throwIfError, out processExitCode));
        }
        public List <string> GetOutputOfCommand(string workingDirectory, string command, string param, bool printTestOutput,
                                                bool throwIfError, IDebuggedProcessLauncher debuggedLauncher, out int processExitCode)
        {
            if (_isBeingDebugged)
            {
                var output = new List <string>();
                processExitCode = LaunchProcessWithDebuggerAttached(workingDirectory, command, param, printTestOutput, debuggedLauncher);
                return(output);
            }

            var actualLauncher = new ProcessLauncher(_testEnvironment, _testEnvironment.Options.PathExtension);

            return(actualLauncher.GetOutputOfCommand(workingDirectory, command, param, printTestOutput,
                                                     throwIfError, out processExitCode));
        }