public TestResultBuilder(TestContext testContext, IDotNetCoreTestProvider rootTest) { this.testContext = testContext; this.rootTest = rootTest; runningSingleTest = rootTest is DotNetCoreUnitTest; TestResult = UnitTestResult.CreateSuccess(); }
public void DebugTests( TestContext testContext, IDotNetCoreTestProvider testProvider, string testAssemblyPath) { try { IsRunningTests = true; this.testContext = testContext; EnsureStarted(); testResultBuilder = new TestResultBuilder(testContext, testProvider); var tests = testProvider.GetTests(); if (tests == null) { GetProcessStartInfo(new [] { testAssemblyPath }); } else { GetProcessStartInfo(tests); } } catch (Exception ex) { this.testContext = null; testContext.Monitor.ReportRuntimeError( GettextCatalog.GetString("Failed to start debug tests."), ex); if (testResultBuilder != null) { testResultBuilder.CreateFailure(ex); } IsRunningTests = false; } }
UnitTestResult RunTest( TestContext testContext, IDotNetCoreTestProvider testProvider, string testAssemblyPath) { if (testPlatformAdapter.HasDiscoveryFailed) { return(ReportLoadError(testContext)); } if (!File.Exists(testAssemblyPath)) { return(HandleMissingAssemblyOnRun(testContext, testAssemblyPath)); } if (testContext.ExecutionContext.ExecutionHandler == null) { testPlatformAdapter.RunTests(testContext, testProvider, testAssemblyPath); } else { testPlatformAdapter.DebugTests(testContext, testProvider, testAssemblyPath); } while (testPlatformAdapter.IsRunningTests) { if (testContext.Monitor.CancellationToken.IsCancellationRequested) { testPlatformAdapter.CancelTestRun(); break; } Thread.Sleep(100); } Status = TestStatus.Ready; return(testPlatformAdapter.TestResult); }
public UnitTestResult RunTest(TestContext testContext, IDotNetCoreTestProvider testProvider) { return(RunTest(testContext, testProvider, GetAssemblyFileName())); }