public void RunTests(IEnumerable <TestCase> testCasesToRun, string baseDir,
                             string workingDir, string userParameters, bool isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher, IProcessExecutor executor)
        {
            DebugUtils.AssertIsNotNull(userParameters, nameof(userParameters));
            DebugUtils.AssertIsNotNull(workingDir, nameof(workingDir));

            IDictionary <string, List <TestCase> > groupedTestCases = testCasesToRun.GroupByExecutable();

            foreach (string executable in groupedTestCases.Keys)
            {
                string finalParameters = SettingsWrapper.ReplacePlaceholders(userParameters, executable);
                string finalWorkingDir = SettingsWrapper.ReplacePlaceholders(workingDir, executable);

                if (_canceled)
                {
                    break;
                }

                _settings.ExecuteWithSettingsForExecutable(executable, () =>
                {
                    RunTestsFromExecutable(
                        executable,
                        finalWorkingDir,
                        groupedTestCases[executable],
                        finalParameters,
                        isBeingDebugged,
                        debuggedLauncher,
                        executor);
                }, _logger);
            }
        }
        public void RunTests(IEnumerable <TestCase> allTestCases, IEnumerable <TestCase> testCasesToRun, string baseDir,
                             string workingDir, string userParameters, bool isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher)
        {
            DebugUtils.AssertIsNotNull(userParameters, nameof(userParameters));
            DebugUtils.AssertIsNotNull(workingDir, nameof(workingDir));

            IDictionary <string, List <TestCase> > groupedTestCases = testCasesToRun.GroupByExecutable();

            TestCase[] allTestCasesAsArray = allTestCases as TestCase[] ?? allTestCases.ToArray();
            foreach (string executable in groupedTestCases.Keys)
            {
                string finalParameters = SettingsWrapper.ReplacePlaceholders(userParameters, executable);
                string finalWorkingDir = SettingsWrapper.ReplacePlaceholders(workingDir, executable);

                if (_canceled)
                {
                    break;
                }

                RunTestsFromExecutable(
                    executable,
                    finalWorkingDir,
                    allTestCasesAsArray.Where(tc => tc.Source == executable),
                    groupedTestCases[executable],
                    baseDir,
                    finalParameters,
                    isBeingDebugged,
                    debuggedLauncher);
            }
        }
示例#3
0
        public void RunTests(IEnumerable <TestCase> testCasesToRun, string baseDir,
                             string workingDir, string userParameters, bool isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher, IProcessExecutor executor)
        {
            DebugUtils.AssertIsNotNull(userParameters, nameof(userParameters));
            DebugUtils.AssertIsNotNull(workingDir, nameof(workingDir));

            IDictionary <string, List <TestCase> > groupedTestCases = testCasesToRun.GroupByExecutable();

            foreach (string executable in groupedTestCases.Keys)
            {
                string finalParameters = SettingsWrapper.ReplacePlaceholders(userParameters, executable);
                string finalWorkingDir = SettingsWrapper.ReplacePlaceholders(workingDir, executable);

                if (_canceled)
                {
                    break;
                }

                _settings.ExecuteWithSettingsForExecutable(executable, () =>
                {
                    var testsWithNoTestPropertySettings = groupedTestCases[executable];

                    if (_settings.TestPropertySettingsContainer != null)
                    {
                        testsWithNoTestPropertySettings = new List <TestCase>();

                        foreach (var testCase in groupedTestCases[executable])
                        {
                            ITestPropertySettings settings;
                            if (_settings.TestPropertySettingsContainer.TryGetSettings(testCase.FullyQualifiedName, out settings))
                            {
                                RunTestsFromExecutable(
                                    executable,
                                    settings.WorkingDirectory,
                                    settings.Environment,
                                    Enumerable.Repeat(testCase, 1),
                                    finalParameters,
                                    isBeingDebugged,
                                    debuggedLauncher,
                                    executor);
                            }
                            else
                            {
                                testsWithNoTestPropertySettings.Add(testCase);
                            }
                        }
                    }

                    if (testsWithNoTestPropertySettings.Count != 0)
                    {
                        RunTestsFromExecutable(
                            executable,
                            finalWorkingDir,
                            null,
                            testsWithNoTestPropertySettings,
                            finalParameters,
                            isBeingDebugged,
                            debuggedLauncher,
                            executor);
                    }
                }, _logger);
            }
        }