public Dispatcher(RemoteProgressMonitor remoteProgressMonitor)
 {
     this.remoteProgressMonitor = remoteProgressMonitor;
 }
        private void ExploreOrRunAssembly(ITestIsolationContext testIsolationContext, TestPackage testPackage, TestExplorationOptions testExplorationOptions,
            TestExecutionOptions testExecutionOptions, RemoteMessageSink remoteMessageSink, IProgressMonitor progressMonitor, string taskName,
            FileInfo file)
        {
            using (progressMonitor.BeginTask(taskName, 100))
            {
                if (progressMonitor.IsCanceled)
                    return;

                string assemblyPath = file.FullName;
                progressMonitor.SetStatus("Getting test assembly metadata.");
                AssemblyMetadata assemblyMetadata = AssemblyUtils.GetAssemblyMetadata(assemblyPath, AssemblyMetadataFields.RuntimeVersion);
                progressMonitor.Worked(2);

                if (progressMonitor.IsCanceled)
                    return;

                if (assemblyMetadata != null)
                {
                    Type driverType = GetType();
                    object[] driverArguments = GetRemoteTestDriverArguments();

                    HostSetup hostSetup = CreateHostSetup(testPackage, assemblyPath, assemblyMetadata);

                    using (var remoteProgressMonitor = new RemoteProgressMonitor(
                        progressMonitor.CreateSubProgressMonitor(97)))
                    {
                        testIsolationContext.RunIsolatedTask<ExploreOrRunTask>(hostSetup,
                            (statusMessage) => progressMonitor.SetStatus(statusMessage),
                            new object[] { driverType, driverArguments, assemblyPath, testExplorationOptions, testExecutionOptions, remoteMessageSink, remoteProgressMonitor });
                    }

                    // Record one final work unit after the isolated task has been fully cleaned up.
                    progressMonitor.SetStatus("");
                    progressMonitor.Worked(1);
                }
            }
        }
 public Dispatcher(RemoteProgressMonitor remoteProgressMonitor)
 {
     this.remoteProgressMonitor = remoteProgressMonitor;
 }
Example #4
0
        private void ExploreOrRun(ITestIsolationContext testIsolationContext, TestPackage testPackage, TestExplorationOptions testExplorationOptions,
            TestExecutionOptions testExecutionOptions, IMessageSink messageSink, IProgressMonitor progressMonitor, string taskName)
        {
            using (progressMonitor.BeginTask(taskName, 1))
            {
                if (progressMonitor.IsCanceled)
                    return;

                FileInfo testDriverScriptFile = GetTestDriverScriptFile(testPackage);
                if (testDriverScriptFile == null)
                    return;

                HostSetup hostSetup = CreateHostSetup(testPackage);
                ScriptRuntimeSetup scriptRuntimeSetup = CreateScriptRuntimeSetup(testPackage);
                string testDriverScriptPath = testDriverScriptFile.FullName;
                var remoteMessageSink = new RemoteMessageSink(messageSink);
                var remoteLogger = new RemoteLogger(logger);

                using (var remoteProgressMonitor = new RemoteProgressMonitor(progressMonitor.CreateSubProgressMonitor(1)))
                {
                    testIsolationContext.RunIsolatedTask<ExploreOrRunTask>(hostSetup,
                        (statusMessage) => progressMonitor.SetStatus(statusMessage),
                        new object[] { testPackage, scriptRuntimeSetup, testDriverScriptPath, testExplorationOptions, testExecutionOptions,
                            remoteMessageSink, remoteProgressMonitor, remoteLogger });
                }
            }
        }