public XUnitTestCase(XUnitAssemblyTestSuite rootSuite, XUnitTestExecutor executor, XUnitTestInfo testInfo) : base(testInfo.Name) { this.rootSuite = rootSuite; TestInfo = testInfo; this.executor = executor; FixtureTypeName = testInfo.Type; }
public XUnitTestSuite(XUnitAssemblyTestSuite rootSuite, XUnitTestExecutor executor, XUnitTestInfo testInfo) : base(testInfo.Name) { this.rootSuite = rootSuite; TestInfo = testInfo; this.executor = executor; this.TestId = testInfo.Id; }
private static bool RunTests(IEnumerable <IXTestExecutor> tes, string slnPath, string slnSnapPath, string buildRoot, string testResultsStore, string testFailureInfoStore, PerDocumentLocationXTestCases discoveredUnitTests) { Stopwatch stopWatch = new Stopwatch(); LogInfo("TestHost executing tests..."); stopWatch.Start(); var testResults = new PerTestIdDResults(); var testFailureInfo = new PerDocumentLocationTestFailureInfo(); var tests = from dc in discoveredUnitTests.Keys from t in discoveredUnitTests[dc] group t by t.Source; Parallel.ForEach( tests, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, test => { LogInfo("Executing tests in {0}: Start.", test.Key); var exec = new XUnitTestExecutor(); exec.TestExecuted.AddHandler( new FSharpHandler <XTestResult>( (o, ea) => { Func <string, string> rebaseCFP = cfp => { if (cfp == null) { return(null); } return(PathBuilder.rebaseCodeFilePath(FilePath.NewFilePath(slnPath), FilePath.NewFilePath(slnSnapPath), FilePath.NewFilePath(cfp)).ToString()); }; ea.TestCase.CodeFilePath = rebaseCFP(ea.TestCase.CodeFilePath); RebaseCallStackDocumentReferences(rebaseCFP, ea); NoteTestResults(testResults, ea, rebaseCFP); NoteTestFailureInfo(testFailureInfo, ea); })); exec.ExecuteTests(tes, test); LogInfo("Executing tests in {0}: Done.", test.Key); }); if (!_debuggerAttached) { testResults.Serialize(FilePath.NewFilePath(testResultsStore)); testFailureInfo.Serialize(FilePath.NewFilePath(testFailureInfoStore)); } stopWatch.Stop(); var ts = stopWatch.Elapsed; var elapsedTime = string.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); LogInfo("Done TestHost executing tests! [" + elapsedTime + "]"); LogInfo(""); var rrs = from tr in testResults from rr in tr.Value where rr.Outcome == DTestOutcome.TOFailed select rr; return(!rrs.Any()); }