Пример #1
0
        public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null)
        {
            Contract.Assert(this.output != null);
            Contract.Assert(this.commandLineOptions != null);
            Contract.Assert(!string.IsNullOrWhiteSpace(this.runSettingsManager?.ActiveRunSettings?.SettingsXml));

            if (this.commandLineOptions.Sources.Count() <= 0)
            {
                throw new CommandLineException(string.Format(CultureInfo.CurrentUICulture, CommandLineResources.MissingTestSourceFile));
            }

            if (!string.IsNullOrEmpty(EqtTrace.LogFile))
            {
                this.output.Information(false, CommandLineResources.VstestDiagLogOutputPath, EqtTrace.LogFile);
            }

            var runSettings = this.runSettingsManager.ActiveRunSettings.SettingsXml;

            this.testRequestManager.DiscoverTests(
                new DiscoveryRequestPayload {
                Sources = this.commandLineOptions.Sources, RunSettings = runSettings
            },
                this.discoveryEventsRegistrar, Constants.DefaultProtocolConfig);

            if (string.IsNullOrEmpty(this.commandLineOptions.ListTestsTargetPath))
            {
                // This string does not need to go to Resources. Reason - only internal consumption
                throw new CommandLineException("Target Path should be specified for listing FQDN tests!");
            }

            File.WriteAllLines(this.commandLineOptions.ListTestsTargetPath, this.discoveredTests);
            return(ArgumentProcessorResult.Success);
        }
Пример #2
0
        public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null)
        {
            Contract.Assert(this.output != null);
            Contract.Assert(this.commandLineOptions != null);
            Contract.Assert(!string.IsNullOrWhiteSpace(this.runSettingsManager?.ActiveRunSettings?.SettingsXml));

            if (this.commandLineOptions.Sources.Count() <= 0)
            {
                throw new CommandLineException(string.Format(CultureInfo.CurrentUICulture, CommandLineResources.MissingTestSourceFile));
            }

            this.output.WriteLine(CommandLineResources.ListTestsHeaderMessage, OutputLevel.Information);
            if (!string.IsNullOrEmpty(EqtTrace.LogFile))
            {
                this.output.Information(false, CommandLineResources.VstestDiagLogOutputPath, EqtTrace.LogFile);
            }

            var runSettings = this.runSettingsManager.ActiveRunSettings.SettingsXml;

            this.discoveryEventsRegistrar.ObjectWriter = objectWriter;

            this.testRequestManager.TestPlatformEventSourceInstance = testPlatformEventSource;

            this.testRequestManager.DiscoverTests(
                new DiscoveryRequestPayload()
            {
                Sources = this.commandLineOptions.Sources, RunSettings = runSettings
            },
                this.discoveryEventsRegistrar, Constants.DefaultProtocolConfig);

            return(ArgumentProcessorResult.Success);
        }
Пример #3
0
 internal DiscovererEnumerator(
     DiscoveryResultCache discoveryResultCache,
     ITestPlatformEventSource testPlatformEventSource)
 {
     this.discoveryResultCache    = discoveryResultCache;
     this.testPlatformEventSource = testPlatformEventSource;
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DiscovererEnumerator"/> class.
 /// </summary>
 /// <param name="requestData">The request data for providing discovery services and data.</param>
 /// <param name="discoveryResultCache"> The discovery result cache. </param>
 /// <param name="testPlatformEventSource">Telemetry events receiver</param>
 /// <param name="token">Cancellation Token to abort discovery</param>
 public DiscovererEnumerator(IRequestData requestData,
                             DiscoveryResultCache discoveryResultCache,
                             ITestPlatformEventSource testPlatformEventSource,
                             CancellationToken token)
     : this(requestData, discoveryResultCache, testPlatformEventSource, new AssemblyProperties(), token)
 {
 }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseRunTests"/> class.
        /// </summary>
        /// <param name="requestData">Provides services and data for execution</param>
        /// <param name="package">The user input test source(package) list if it differs from actual test source otherwise null.</param>
        /// <param name="runSettings">The run settings.</param>
        /// <param name="testExecutionContext">The test execution context.</param>
        /// <param name="testCaseEventsHandler">The test case events handler.</param>
        /// <param name="testRunEventsHandler">The test run events handler.</param>
        /// <param name="testPlatformEventSource">Test platform event source.</param>
        /// <param name="testEventsPublisher">Publisher for test events.</param>
        /// <param name="platformThread">Platform Thread.</param>
        /// <param name="dataSerializer">Data Serializer for cloning TestCase and test results object.</param>
        protected BaseRunTests(
            IRequestData requestData,
            string package,
            string runSettings,
            TestExecutionContext testExecutionContext,
            ITestCaseEventsHandler testCaseEventsHandler,
            ITestRunEventsHandler testRunEventsHandler,
            ITestPlatformEventSource testPlatformEventSource,
            ITestEventsPublisher testEventsPublisher,
            IThread platformThread,
            IDataSerializer dataSerializer)
        {
            this.package               = package;
            this.runSettings           = runSettings;
            this.testExecutionContext  = testExecutionContext;
            this.testCaseEventsHandler = testCaseEventsHandler;
            this.testRunEventsHandler  = testRunEventsHandler;
            this.requestData           = requestData;

            this.isCancellationRequested = false;
            this.testPlatformEventSource = testPlatformEventSource;
            this.testEventsPublisher     = testEventsPublisher;
            this.platformThread          = platformThread;
            this.dataSerializer          = dataSerializer;
            this.SetContext();
        }
Пример #6
0
 public TestableBaseRunTests(
     IRequestData requestData,
     string package,
     string runSettings,
     TestExecutionContext testExecutionContext,
     ITestCaseEventsHandler testCaseEventsHandler,
     ITestRunEventsHandler testRunEventsHandler,
     ITestPlatformEventSource testPlatformEventSource,
     ITestEventsPublisher testEventsPublisher,
     IThread platformThread,
     IDataSerializer dataSerializer)
     : base(
         requestData,
         package,
         runSettings,
         testExecutionContext,
         testCaseEventsHandler,
         testRunEventsHandler,
         testPlatformEventSource,
         testEventsPublisher,
         platformThread,
         dataSerializer)
 {
     this.testCaseEventsHandler = testCaseEventsHandler;
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DiscoveryManager"/> class.
 /// </summary>
 /// <param name="requestData">
 /// The Request Data for providing discovery services and data.
 /// </param>
 /// <param name="testPlatformEventSource">
 ///     The test platform event source.
 /// </param>
 protected DiscoveryManager(IRequestData requestData, ITestPlatformEventSource testPlatformEventSource)
 {
     this.sessionMessageLogger = TestSessionMessageLogger.Instance;
     this.sessionMessageLogger.TestRunMessage += this.TestSessionMessageHandler;
     this.testPlatformEventSource              = testPlatformEventSource;
     this.requestData = requestData;
 }
Пример #8
0
        /// <summary>
        /// Execute specific tests that match any of the given strings.
        /// </summary>
        /// <returns></returns>
        public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null)
        {
            Contract.Assert(this.output != null);
            Contract.Assert(this.commandLineOptions != null);
            Contract.Assert(this.testRequestManager != null);
            Contract.Assert(!string.IsNullOrWhiteSpace(this.runSettingsManager.ActiveRunSettings.SettingsXml));

            if (!this.commandLineOptions.Sources.Any())
            {
                throw new CommandLineException(string.Format(CultureInfo.CurrentUICulture, CommandLineResources.MissingTestSourceFile));
            }

            this.effectiveRunSettings = this.runSettingsManager.ActiveRunSettings.SettingsXml;

            ((TestRequestManager)this.testRequestManager).VSTestLoggerManager = this.VSTestLoggerManager = vsTestLogManager;

            // Discover tests from sources and filter on every discovery reported.
            this.DiscoverTestsAndSelectSpecified(this.commandLineOptions.Sources);

            this.testRequestManager.TestPlatformEventSourceInstance = testPlatformEventSource;

            // Now that tests are discovered and filtered, we run only those selected tests.
            this.ExecuteSelectedTests();

            bool treatNoTestsAsError = RunSettingsUtilities.GetTreatNoTestsAsError(effectiveRunSettings);

            if (treatNoTestsAsError && this.selectedTestCases.Count == 0)
            {
                return(ArgumentProcessorResult.Fail);
            }

            return(ArgumentProcessorResult.Success);
        }
Пример #9
0
 internal DiscovererEnumerator(IRequestData requestData,
                               DiscoveryResultCache discoveryResultCache,
                               ITestPlatformEventSource testPlatformEventSource)
 {
     this.discoveryResultCache    = discoveryResultCache;
     this.testPlatformEventSource = testPlatformEventSource;
     this.requestData             = requestData;
 }
Пример #10
0
 internal DiscovererEnumerator(IRequestData requestData,
                               DiscoveryResultCache discoveryResultCache,
                               ITestPlatformEventSource testPlatformEventSource)
 {
     this.discoveryResultCache    = discoveryResultCache;
     this.testPlatformEventSource = testPlatformEventSource;
     this.requestData             = requestData;
     this.assemblyProperties      = new AssemblyProperties();
 }
Пример #11
0
 public TestableBaseRunTests(
     string runSettings,
     TestExecutionContext testExecutionContext,
     ITestCaseEventsHandler testCaseEventsHandler,
     ITestRunEventsHandler testRunEventsHandler,
     ITestPlatformEventSource testPlatformEventSource)
     : base(runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, testPlatformEventSource)
 {
 }
Пример #12
0
 internal TestRequestManager(CommandLineOptions commandLineOptions, ITestPlatform testPlatform, TestRunResultAggregator testRunResultAggregator, ITestPlatformEventSource testPlatformEventSource, InferHelper inferHelper, Task <IMetricsPublisher> metricsPublisher)
 {
     this.testPlatform            = testPlatform;
     this.commandLineOptions      = commandLineOptions;
     this.testRunResultAggregator = testRunResultAggregator;
     this.testPlatformEventSource = testPlatformEventSource;
     this.inferHelper             = inferHelper;
     this.metricsPublisher        = metricsPublisher;
 }
Пример #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VsTestConsoleWrapper"/> class.
        /// </summary>
        /// <param name="requestSender">Sender for test messages.</param>
        /// <param name="processManager">Process manager.</param>
        /// <param name="consoleParameters">The parameters to be passed onto the runner process</param>
        /// <param name="testPlatformEventSource">Performance event source</param>
        internal VsTestConsoleWrapperAsync(ITranslationLayerRequestSenderAsync requestSender, IProcessManager processManager, ConsoleParameters consoleParameters, ITestPlatformEventSource testPlatformEventSource)
        {
            this.requestSender = requestSender;
            this.vstestConsoleProcessManager = processManager;
            this.consoleParameters           = consoleParameters;
            this.testPlatformEventSource     = testPlatformEventSource;
            this.pathToAdditionalExtensions  = new List <string>();

            this.vstestConsoleProcessManager.ProcessExited += (sender, args) => this.requestSender.OnProcessExited();
        }
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseRunTests"/> class.
        /// </summary>
        /// <param name="runSettings"> The run settings. </param>
        /// <param name="testExecutionContext"> The test execution context. </param>
        /// <param name="testCaseEventsHandler"> The test case events handler. </param>
        /// <param name="testRunEventsHandler"> The test run events handler. </param>
        /// <param name="testPlatformEventSource"></param>
        protected BaseRunTests(string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, ITestPlatformEventSource testPlatformEventSource)
        {
            this.runSettings           = runSettings;
            this.testExecutionContext  = testExecutionContext;
            this.testCaseEventsHandler = testCaseEventsHandler;
            this.testRunEventsHandler  = testRunEventsHandler;

            this.isCancellationRequested = false;
            this.testPlatformEventSource = testPlatformEventSource;
            this.SetContext();
        }
Пример #15
0
 public TestableBaseRunTests(
     string runSettings,
     string package,
     TestExecutionContext testExecutionContext,
     ITestCaseEventsHandler testCaseEventsHandler,
     ITestRunEventsHandler testRunEventsHandler,
     ITestPlatformEventSource testPlatformEventSource,
     IRequestData requestData)
     : base(requestData, package, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, testPlatformEventSource)
 {
 }
Пример #16
0
 public TestableBaseRunTests(
     string runSettings,
     TestExecutionContext testExecutionContext,
     ITestCaseEventsHandler testCaseEventsHandler,
     ITestRunEventsHandler testRunEventsHandler,
     ITestPlatformEventSource testPlatformEventSource,
     ITestEventsPublisher testEventsPublisher,
     IThread platformThread,
     IRequestData requestData)
     : base(requestData, null, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, testPlatformEventSource, testEventsPublisher, platformThread)
 {
 }
Пример #17
0
        /// <summary>
        /// Initialize the design mode client.
        /// </summary>
        /// <returns> The <see cref="ArgumentProcessorResult.Success"/> if initialization is successful. </returns>
        public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null)
        {
            try
            {
                this.designModeClient?.ConnectToClientAndProcessRequests(this.commandLineOptions.Port, this.testRequestManager);
            }
            catch (TimeoutException ex)
            {
                throw new CommandLineException(string.Format(CultureInfo.CurrentUICulture, string.Format(CommandLineResources.DesignModeClientTimeoutError, this.commandLineOptions.Port)), ex);
            }

            return(ArgumentProcessorResult.Success);
        }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DiscovererEnumerator"/> class.
 /// </summary>
 /// <param name="requestData">The request data for providing discovery services and data.</param>
 /// <param name="discoveryResultCache"> The discovery result cache. </param>
 /// <param name="testPlatformEventSource">Telemetry events receiver</param>
 /// <param name="assemblyProperties">Information on the assemblies being discovered</param>
 /// <param name="token">Cancellation Token to abort discovery</param>
 public DiscovererEnumerator(IRequestData requestData,
                             DiscoveryResultCache discoveryResultCache,
                             ITestPlatformEventSource testPlatformEventSource,
                             IAssemblyProperties assemblyProperties,
                             CancellationToken token)
 {
     // Added this to make class testable, needed a PEHeader mocked Instance
     this.discoveryResultCache    = discoveryResultCache;
     this.testPlatformEventSource = testPlatformEventSource;
     this.requestData             = requestData;
     this.assemblyProperties      = assemblyProperties;
     this.cancellationToken       = token;
 }
        public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null)
        {
            ConsoleOutput.Instance.WriteLine(CommandLineResources.AvailableSettingsProvidersHeaderMessage, OutputLevel.Information);
            var testPlatform     = TestPlatformFactory.GetTestPlatform();
            var extensionManager = SettingsProviderExtensionManager.Create();

            foreach (var extension in extensionManager.SettingsProvidersMap.Values)
            {
                ConsoleOutput.Instance.WriteLine(extension.Value.GetType().FullName, OutputLevel.Information);
                ConsoleOutput.Instance.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.AvailableExtensionsMetadataFormat, "SettingName", extension.Metadata.SettingsName), OutputLevel.Information);
            }

            return(ArgumentProcessorResult.Success);
        }
Пример #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseRunTests"/> class.
 /// </summary>
 /// <param name="runSettings">The run settings.</param>
 /// <param name="testExecutionContext">The test execution context.</param>
 /// <param name="testCaseEventsHandler">The test case events handler.</param>
 /// <param name="testRunEventsHandler">The test run events handler.</param>
 /// <param name="testPlatformEventSource">Test platform event source.</param>
 protected BaseRunTests(string runSettings,
                        TestExecutionContext testExecutionContext,
                        ITestCaseEventsHandler testCaseEventsHandler,
                        ITestRunEventsHandler testRunEventsHandler,
                        ITestPlatformEventSource testPlatformEventSource) :
     this(
         runSettings,
         testExecutionContext,
         testCaseEventsHandler,
         testRunEventsHandler,
         testPlatformEventSource,
         testCaseEventsHandler as ITestEventsPublisher,
         new PlatformThread())
 {
 }
        public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null)
        {
            ConsoleOutput.Instance.WriteLine(CommandLineResources.AvailableDiscoverersHeaderMessage, OutputLevel.Information);
            var testPlatform     = TestPlatformFactory.GetTestPlatform();
            var extensionManager = TestDiscoveryExtensionManager.Create();

            foreach (var extension in extensionManager.Discoverers)
            {
                ConsoleOutput.Instance.WriteLine(extension.Value.GetType().FullName, OutputLevel.Information);
                ConsoleOutput.Instance.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.UriOfDefaultExecutor, extension.Metadata.DefaultExecutorUri), OutputLevel.Information);
                ConsoleOutput.Instance.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.SupportedFileTypesIndicator + " " + string.Join(", ", extension.Metadata.FileExtension)), OutputLevel.Information);
            }

            return(ArgumentProcessorResult.Success);
        }
        public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null)
        {
            ConsoleOutput.Instance.WriteLine(CommandLineResources.AvailableLoggersHeaderMessage, OutputLevel.Information);
            var testPlatform     = TestPlatformFactory.GetTestPlatform();
            var extensionManager = TestLoggerExtensionManager.Create(new NullMessageLogger());

            foreach (var extension in extensionManager.TestExtensions)
            {
                ConsoleOutput.Instance.WriteLine(extension.Value.GetType().FullName, OutputLevel.Information);
                ConsoleOutput.Instance.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.AvailableExtensionsMetadataFormat, "Uri", extension.Metadata.ExtensionUri), OutputLevel.Information);
                ConsoleOutput.Instance.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.AvailableExtensionsMetadataFormat, "FriendlyName", string.Join(", ", extension.Metadata.FriendlyName)), OutputLevel.Information);
            }

            return(ArgumentProcessorResult.Success);
        }
Пример #23
0
        internal TestRequestManager(CommandLineOptions commandLineOptions, ITestPlatform testPlatform, TestLoggerManager testLoggerManager, TestRunResultAggregator testRunResultAggregator, ITestPlatformEventSource testPlatformEventSource)
        {
            this.testPlatform            = testPlatform;
            this.commandLineOptions      = commandLineOptions;
            this.testLoggerManager       = testLoggerManager;
            this.testRunResultAggregator = testRunResultAggregator;
            this.testPlatformEventSource = testPlatformEventSource;

            // Always enable logging for discovery or run requests
            this.testLoggerManager.EnableLogging();

            // TODO: Is this required for design mode
            // Add console logger as a listener to logger events.
            var consoleLogger = new ConsoleLogger();

            consoleLogger.Initialize(this.testLoggerManager.LoggerEvents, null);
        }
Пример #24
0
        internal TestRequestManager(CommandLineOptions commandLineOptions, ITestPlatform testPlatform, TestLoggerManager testLoggerManager, TestRunResultAggregator testRunResultAggregator, ITestPlatformEventSource testPlatformEventSource)
        {
            this.testPlatform            = testPlatform;
            this.commandLineOptions      = commandLineOptions;
            this.testLoggerManager       = testLoggerManager;
            this.testRunResultAggregator = testRunResultAggregator;
            this.testPlatformEventSource = testPlatformEventSource;

            // Always enable logging for discovery or run requests
            this.testLoggerManager.EnableLogging();

            if (!this.commandLineOptions.IsDesignMode)
            {
                var consoleLogger = new ConsoleLogger();
                this.testLoggerManager.AddLogger(consoleLogger, ConsoleLogger.ExtensionUri, null);
            }
        }
Пример #25
0
        public static int RunExecutor(string[] args, ITestPlatformEventSource testPlatformEventSource, IObjectWriter objectWriter = null, ITestLoggerManager vsTestLogManager = null)
        {
            SetCultureSpecifiedByUser();

            var executor = new Executor(ConsoleOutput.Instance, testPlatformEventSource);

            if (objectWriter != null)
            {
                executor.ObjectWriter = objectWriter;
            }

            if (vsTestLogManager != null)
            {
                executor.VStestLogManager = vsTestLogManager;
            }

            return(executor.Execute(args));
        }
Пример #26
0
 internal TestRequestManager(
     CommandLineOptions commandLineOptions,
     ITestPlatform testPlatform,
     TestRunResultAggregator testRunResultAggregator,
     ITestPlatformEventSource testPlatformEventSource,
     InferHelper inferHelper,
     Task <IMetricsPublisher> metricsPublisher,
     IProcessHelper processHelper,
     ITestRunAttachmentsProcessingManager attachmentsProcessingManager)
 {
     this.testPlatform                    = testPlatform;
     this.commandLineOptions              = commandLineOptions;
     this.testRunResultAggregator         = testRunResultAggregator;
     this.TestPlatformEventSourceInstance = testPlatformEventSource;
     this.inferHelper                  = inferHelper;
     this.metricsPublisher             = metricsPublisher;
     this.processHelper                = processHelper;
     this.attachmentsProcessingManager = attachmentsProcessingManager;
 }
Пример #27
0
        /// <summary>
        /// Execute all of the tests.
        /// </summary>
        public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null)
        {
            Contract.Assert(this.commandLineOptions != null);
            Contract.Assert(!string.IsNullOrWhiteSpace(this.runSettingsManager?.ActiveRunSettings?.SettingsXml));

            if (this.commandLineOptions.IsDesignMode)
            {
                // Do not attempt execution in case of design mode. Expect execution to happen
                // via the design mode client.
                return(ArgumentProcessorResult.Success);
            }

            // Ensure a test source file was provided
            var anySource = this.commandLineOptions.Sources.FirstOrDefault();

            if (anySource == null)
            {
                throw new CommandLineException(string.Format(CultureInfo.CurrentUICulture, CommandLineResources.MissingTestSourceFile));
            }

            this.output.WriteLine(CommandLineResources.StartingExecution, OutputLevel.Information);
            if (!string.IsNullOrEmpty(EqtTrace.LogFile))
            {
                this.output.Information(false, CommandLineResources.VstestDiagLogOutputPath, EqtTrace.LogFile);
            }

            var runSettings = this.runSettingsManager.ActiveRunSettings.SettingsXml;

            if (this.commandLineOptions.Sources.Any())
            {
                this.RunTests(runSettings);
            }

            bool treatNoTestsAsError = RunSettingsUtilities.GetTreatNoTestsAsError(runSettings);

            if (treatNoTestsAsError && numberOfExecutedTests == 0)
            {
                return(ArgumentProcessorResult.Fail);
            }

            return(ArgumentProcessorResult.Success);
        }
Пример #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseRunTests"/> class.
 /// </summary>
 /// <param name="requestData">The request data for providing common execution services and data</param>
 /// <param name="package">The user input test source(package) if it differs from actual test source otherwise null.</param>
 /// <param name="runSettings">The run settings.</param>
 /// <param name="testExecutionContext">The test execution context.</param>
 /// <param name="testCaseEventsHandler">The test case events handler.</param>
 /// <param name="testRunEventsHandler">The test run events handler.</param>
 /// <param name="testPlatformEventSource">Test platform event source.</param>
 protected BaseRunTests(
     IRequestData requestData,
     string package,
     string runSettings,
     TestExecutionContext testExecutionContext,
     ITestCaseEventsHandler testCaseEventsHandler,
     ITestRunEventsHandler testRunEventsHandler,
     ITestPlatformEventSource testPlatformEventSource)
     : this(
         requestData,
         package,
         runSettings,
         testExecutionContext,
         testCaseEventsHandler,
         testRunEventsHandler,
         testPlatformEventSource,
         testCaseEventsHandler as ITestEventsPublisher,
         new PlatformThread(),
         JsonDataSerializer.Instance)
 {
 }
Пример #29
0
        public ArgumentProcessorResult Execute(IObjectWriter objectWriter = null, ITestPlatformEventSource testPlatformEventSource = null, ITestLoggerManager vsTestLogManager = null)
        {
            // Output the stock output text
            OutputSection(CommandLineResources.HelpUsageText);
            OutputSection(CommandLineResources.HelpDescriptionText);
            OutputSection(CommandLineResources.HelpArgumentsText);

            var argumentProcessorFactory         = ArgumentProcessorFactory.Create();
            List <IArgumentProcessor> processors = new List <IArgumentProcessor>();

            processors.AddRange(argumentProcessorFactory.AllArgumentProcessors);
            processors.Sort((p1, p2) => Comparer <HelpContentPriority> .Default.Compare(p1.Metadata.Value.HelpPriority, p2.Metadata.Value.HelpPriority));

            // Output the help description for RunTestsArgumentProcessor
            IArgumentProcessor runTestsArgumentProcessor = processors.Find(p1 => p1.GetType() == typeof(RunTestsArgumentProcessor));

            processors.Remove(runTestsArgumentProcessor);
            var helpDescription = LookupHelpDescription(runTestsArgumentProcessor);

            if (helpDescription != null)
            {
                OutputSection(helpDescription);
            }

            // Output the help description for each available argument processor
            OutputSection(CommandLineResources.HelpOptionsText);
            foreach (var argumentProcessor in processors)
            {
                helpDescription = LookupHelpDescription(argumentProcessor);
                if (helpDescription != null)
                {
                    OutputSection(helpDescription);
                }
            }
            OutputSection(CommandLineResources.Examples);

            // When Help has finished abort any subsequent argument processor operations
            return(ArgumentProcessorResult.Abort);
        }
Пример #30
0
 internal VsTestConsoleRequestSender(ICommunicationManager communicationManager, IDataSerializer dataSerializer, ITestPlatformEventSource testPlatformEventSource)
 {
     this.communicationManager    = communicationManager;
     this.dataSerializer          = dataSerializer;
     this.testPlatformEventSource = testPlatformEventSource;
 }