Пример #1
0
        public void RunTests(IEnumerable <TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            // "Run tests in parallel" option from the UI sets MaxCpuCount in RunConfiguration
            // Ref: https://blogs.msdn.microsoft.com/devops/2016/10/10/parallel-test-execution/
            var isParallelRun = runContext.RunSettings.SettingsXml.Contains("<MaxCpuCount>");

            if (isParallelRun && runContext.IsBeingDebugged)
            {
                frameworkHandle.SendMessage(TestMessageLevel.Error, "Cannot debug specs in parallel, disable parallel run to debug specs.");
                foreach (var testCase in tests)
                {
                    frameworkHandle.RecordEnd(testCase, TestOutcome.None);
                }
                return;
            }
            _gaugeRunner = new GaugeRunner(tests, runContext.IsBeingDebugged, isParallelRun, frameworkHandle);
            _gaugeRunner.Run();
        }
Пример #2
0
        public void RunTests(IEnumerable <TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            dynamic runConfiguration =
                runContext.RunSettings.GetSettings(Constants.RunConfigurationSettingsName);

            // "Run tests in parallel" option from the UI sets MaxCpuCount in RunConfiguration
            // By default the MaxCpuCount=0, which is ambiguous with default(int)
            // Use MaxCpuCountSet property to determine if user initiated the test run in parallel.
            // Ref: https://blogs.msdn.microsoft.com/devops/2016/10/10/parallel-test-execution/
            bool isParallelRun = runConfiguration != null && runConfiguration.Settings.MaxCpuCountSet;

            if (isParallelRun && runContext.IsBeingDebugged)
            {
                frameworkHandle.SendMessage(TestMessageLevel.Error, "Cannot debug specs in parallel, disable parallel run to debug specs.");
                foreach (var testCase in tests)
                {
                    frameworkHandle.RecordEnd(testCase, TestOutcome.None);
                }
                return;
            }
            _gaugeRunner = new GaugeRunner(tests, runContext.IsBeingDebugged, isParallelRun, frameworkHandle);
            _gaugeRunner.Run();
        }