public void RunTests(IEnumerable <TestCase> allTestCases, IEnumerable <TestCase> testCasesToRun, string baseDir,
                             string userParameters, bool isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher)
        {
            List <Thread> threads;

            lock (this)
            {
                DebugUtils.AssertIsNull(userParameters, nameof(userParameters));

                threads = new List <Thread>();
                RunTests(allTestCases, testCasesToRun, baseDir, threads, isBeingDebugged, debuggedLauncher);
            }

            foreach (Thread thread in threads)
            {
                thread.Join();
            }
        }
        public void RunTests(IEnumerable <TestCase> allTestCases, IEnumerable <TestCase> testCasesToRun, string baseDir,
                             string workingDir, string userParameters, bool isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher, IProcessExecutor executor)
        {
            DebugUtils.AssertIsNull(userParameters, nameof(userParameters));
            DebugUtils.AssertIsNull(workingDir, nameof(workingDir));

            try
            {
                Stopwatch stopwatch = Stopwatch.StartNew();

                string testDirectory = Utils.GetTempDirectory();
                workingDir     = _settings.GetWorkingDir(_solutionDirectory, testDirectory, _threadId);
                userParameters = _settings.GetUserParameters(_solutionDirectory, testDirectory, _threadId);

                string batch = _settings.GetBatchForTestSetup(_solutionDirectory, testDirectory, _threadId);
                batch = batch == "" ? "" : _solutionDirectory + batch;
                SafeRunBatch(TestSetup, _solutionDirectory, batch, isBeingDebugged);

                _innerTestRunner.RunTests(allTestCases, testCasesToRun, baseDir, workingDir, userParameters, isBeingDebugged, debuggedLauncher, executor);

                batch = _settings.GetBatchForTestTeardown(_solutionDirectory, testDirectory, _threadId);
                batch = batch == "" ? "" : _solutionDirectory + batch;
                SafeRunBatch(TestTeardown, _solutionDirectory, batch, isBeingDebugged);

                stopwatch.Stop();
                _logger.DebugInfo($"{_threadName}Execution took {stopwatch.Elapsed}");

                string errorMessage;
                if (!Utils.DeleteDirectory(testDirectory, out errorMessage))
                {
                    _logger.DebugWarning(
                        $"{_threadName}Could not delete test directory '" + testDirectory + "': " + errorMessage);
                }
            }
            catch (Exception e)
            {
                _logger.LogError($"{_threadName}Exception while running tests: " + e);
            }
        }
        public void RunTests(IEnumerable <TestCase> testCasesToRun, string baseDir,
                             string workingDir, string userParameters, bool isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher, IProcessExecutor executor)
        {
            DebugUtils.AssertIsNull(userParameters, nameof(userParameters));
            DebugUtils.AssertIsNull(workingDir, nameof(workingDir));

            try
            {
                Stopwatch stopwatch = Stopwatch.StartNew();

                string testDirectory = Utils.GetTempDirectory();
                workingDir     = _settings.GetWorkingDir(_solutionDirectory, testDirectory, _threadId);
                userParameters = _settings.GetUserParameters(_solutionDirectory, testDirectory, _threadId);

                string batch = _settings.GetBatchForTestSetup(_solutionDirectory, testDirectory, _threadId);
                batch = batch == "" ? "" : _solutionDirectory + batch;
                SafeRunBatch(BatchType.TestSetup, _solutionDirectory, batch, isBeingDebugged);

                _innerTestRunner.RunTests(testCasesToRun, baseDir, workingDir, userParameters, isBeingDebugged, debuggedLauncher, executor);

                batch = _settings.GetBatchForTestTeardown(_solutionDirectory, testDirectory, _threadId);
                batch = batch == "" ? "" : _solutionDirectory + batch;
                SafeRunBatch(BatchType.TestTeardown, _solutionDirectory, batch, isBeingDebugged);

                stopwatch.Stop();
                _logger.DebugInfo(String.Format(Resources.ExecutionTime, _threadName, stopwatch.Elapsed));

                string errorMessage;
                if (!Utils.DeleteDirectory(testDirectory, out errorMessage))
                {
                    _logger.DebugWarning(String.Format(Resources.DeleteTestDir, _threadName, testDirectory, errorMessage));
                }
            }
            catch (Exception e)
            {
                _logger.LogError(String.Format(Resources.ExceptionMessage, _threadName, e));
            }
        }
        public void RunTests(IEnumerable <TestCase> allTestCases, IEnumerable <TestCase> testCasesToRun, string baseDir,
                             string userParameters, bool isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher)
        {
            DebugUtils.AssertIsNull(userParameters, nameof(userParameters));

            try
            {
                Stopwatch stopwatch = Stopwatch.StartNew();

                string testDirectory = Utils.GetTempDirectory();
                userParameters = TestEnvironment.Options.GetUserParameters(SolutionDirectory, testDirectory, ThreadId);

                string batch = TestEnvironment.Options.GetBatchForTestSetup(SolutionDirectory, testDirectory, ThreadId);
                batch = batch == "" ? "" : SolutionDirectory + batch;
                SafeRunBatch(TestSetup, SolutionDirectory, batch, isBeingDebugged);

                InnerTestRunner.RunTests(allTestCases, testCasesToRun, baseDir, userParameters, isBeingDebugged, debuggedLauncher);

                batch = TestEnvironment.Options.GetBatchForTestTeardown(SolutionDirectory, testDirectory, ThreadId);
                batch = batch == "" ? "" : SolutionDirectory + batch;
                SafeRunBatch(TestTeardown, SolutionDirectory, batch, isBeingDebugged);

                stopwatch.Stop();
                TestEnvironment.DebugInfo($"Thread {ThreadId} took {stopwatch.Elapsed}");

                string errorMessage;
                if (!Utils.DeleteDirectory(testDirectory, out errorMessage))
                {
                    TestEnvironment.DebugWarning(
                        "Could not delete test directory '" + testDirectory + "': " + errorMessage);
                }
            }
            catch (Exception e)
            {
                TestEnvironment.LogError("Exception while running tests: " + e);
            }
        }