public void RunTests(IEnumerable <string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            ValidateArg.NotNull(frameworkHandle, "frameworkHandle");
            ValidateArg.NotNullOrEmpty(sources, "sources");

            if (!this.MSTestDiscoverer.AreValidSources(sources))
            {
                throw new NotSupportedException();
            }

            // Populate the runsettings.
            MSTestSettings.PopulateSettings(runContext);

            // Scenarios that include testsettings or forcing a run via the legacy adapter are currently not supported in MSTestAdapter.
            if (MSTestSettings.IsLegacyScenario(frameworkHandle))
            {
                return;
            }

            sources = PlatformServiceProvider.Instance.TestSource.GetTestSources(sources);
            this.cancellationToken = new TestRunCancellationToken();
            this.TestExecutionManager.RunTests(sources, runContext, frameworkHandle, this.cancellationToken);

            this.cancellationToken = null;
        }
Beispiel #2
0
        public void RunTests(IEnumerable <string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            PlatformServiceProvider.Instance.AdapterTraceLogger.LogInfo("MSTestExecutor.RunTests: Running tests from sources.");
            ValidateArg.NotNull(frameworkHandle, "frameworkHandle");
            ValidateArg.NotNullOrEmpty(sources, "sources");

            if (!this.MSTestDiscoverer.AreValidSources(sources))
            {
                throw new NotSupportedException();
            }

            // Populate the runsettings.
            try
            {
                MSTestSettings.PopulateSettings(runContext);
            }
            catch (AdapterSettingsException ex)
            {
                frameworkHandle.SendMessage(TestMessageLevel.Error, ex.Message);
                return;
            }

            // Scenarios that include testsettings or forcing a run via the legacy adapter are currently not supported in MSTestAdapter.
            if (MSTestSettings.IsLegacyScenario(frameworkHandle))
            {
                return;
            }

            sources = PlatformServiceProvider.Instance.TestSource.GetTestSources(sources);
            this.cancellationToken = new TestRunCancellationToken();
            this.TestExecutionManager.RunTests(sources, runContext, frameworkHandle, this.cancellationToken);

            this.cancellationToken = null;
        }
Beispiel #3
0
        public void RunTests(IEnumerable <TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            ValidateArg.NotNull(frameworkHandle, "frameworkHandle");
            ValidateArg.NotNullOrEmpty(tests, "tests");

            if (!this.MSTestDiscoverer.AreValidSources(from test in tests select test.Source))
            {
                throw new NotSupportedException();
            }

            // Populate the runsettings.
            try
            {
                MSTestSettings.PopulateSettings(runContext);
            }
            catch (AdapterSettingsException ex)
            {
                frameworkHandle.SendMessage(TestMessageLevel.Error, ex.Message);
                return;
            }

            // Scenarios that include testsettings or forcing a run via the legacy adapter are currently not supported in MSTestAdapter.
            if (MSTestSettings.IsLegacyScenario(frameworkHandle))
            {
                return;
            }

            this.cancellationToken = new TestRunCancellationToken();
            this.TestExecutionManager.RunTests(tests, runContext, frameworkHandle, this.cancellationToken);
            this.cancellationToken = null;
        }