protected TestPlanBase(DefaultTestRunner runner, TestRun testRun, TestRunnerOptions normalized) { _normalizedOpts = normalized; _runner = runner; _root = new RootNode(runner, testRun); _root.Initialize(); normalized.PreviousRun.ApplyTo(testRun); if (normalized.RerunPreviousFailures) { if (normalized.PreviousRun.FailureReason.IsFailure()) { normalized.PlanFilter.Tags.Add( TestTagPredicate.Previously(TestStatus.Failed) ); } else { Log.Warn("No previous failures, re-running all tests..."); } } // Apply filter rules from the options _normalizedOpts.PlanFilter.Apply(testRun, normalized); _willRun = PlanOrder.Where(p => p.IsLeafThatWillRun).Select(n => (TestCaseInfo)n.Unit).ToList(); }
internal virtual void Done(TestUnit unit, TestRunnerOptions opts) { if (Children.Count == 0) { _status = TestUnit.ConvertToStatus(unit).GetValueOrDefault(TestStatus.Passed); } else { _status = Children.Status; } }
protected TestRunner(TestRunnerOptions options) { Options = options.Clone(); // HACK -- This is unsealed when the self-tests run because it could be modified // to facilitate runner-specific test setup (e.g. DSLGrammarTests) if (!Options.SelfTest) { Options.MakeReadOnly(); } SessionId = Utility.RandomName(); }
internal void Apply(TestRun testRun, TestRunnerOptions normalized) { ActivateDefaultTestSet(testRun); Excludes.Apply(testRun, SKIP); FocusPatterns.Apply(testRun, FOCUS); // If any focused nodes, then only run focused nodes if (!normalized.IgnoreFocus && testRun.ContainsFocusedUnits) { ApplyFocussing(testRun); } InheritBiasToChildren(testRun); SealRecursive(testRun); }
internal override void Done(TestUnit unit, TestRunnerOptions opts) { _finishedAt = DateTime.Now; if (Status == TestStatus.NotRun) { SetSuccess(); } if (unit != null && unit.IsFocused) { _flags |= Flags.Focused; } if (opts.SlowTestThreshold.HasValue && ExecutionTime >= opts.SlowTestThreshold.Value) { _flags |= Flags.Slow; } }
internal TestRunnerOptions Normalize() { var result = new TestRunnerOptions(this); if (result.RandomSeed <= 0) { result.RandomSeed = Environment.TickCount; } if (result.ContextLines < 0) { result.ContextLines = 3; // default } if (!result.SlowTestThreshold.HasValue) { result.SlowTestThreshold = TimeSpan.FromMilliseconds(500); } result.MakeReadOnly(); return(result); }
internal TestRunProblems(IEnumerable <TestUnitResult> descendants, TestRunnerOptions opts) { foreach (var item in descendants) { if (item.Children.Count > 0) { // Because statuses rollup into the composite result (e.g. if composite contains // only failed tests, then it rolls up as failed), // only report composite results as a problem if there is a setup error. bool ignoreProblem = item.ExceptionInfo == null && item.Messages.Count == 0; if (ignoreProblem) { continue; } } if (item.IsPending) { _pending.Add(item); } else if (item.Failed) { _failures.Add(item); } else if (item.IsSlow) { _slow.Add(item); } } int ordinal = 1; foreach (var f in _failures) { f.Ordinal = ordinal++; } foreach (var f in _slow) { f.Ordinal = ordinal++; } }
public TestRunnerOptions(TestRunnerOptions copyFrom) { if (copyFrom == null) { return; } IgnoreFocus = copyFrom.IgnoreFocus; FixturePaths.AddAll(copyFrom.FixturePaths); LoaderPaths.AddAll(copyFrom.LoaderPaths); LoadAssemblyFromPath = copyFrom.LoadAssemblyFromPath; RandomSeed = copyFrom.RandomSeed; _flags = copyFrom._flags; ContextLines = copyFrom.ContextLines; SelfTest = copyFrom.SelfTest; PackageReferences.AddAll(copyFrom.PackageReferences); PlanFilter.CopyFrom(copyFrom.PlanFilter); TestTimeout = copyFrom.TestTimeout; PlanTimeout = copyFrom.PlanTimeout; SlowTestThreshold = copyFrom.SlowTestThreshold; AssertionMessageFormatMode = copyFrom.AssertionMessageFormatMode; PreviousRun = copyFrom.PreviousRun; }
internal void CopyToOptions(TestRunnerOptions testRunnerOptions) { testRunnerOptions.PreviousRun = Results; }
internal TestRunnerStartingEventArgs(TestRunnerOptions options, TestRun run, int willRunTests) { _options = options; _willRunTests = willRunTests; TestRun = run; }
public DefaultTestRunner(TestRunnerOptions opts) : base(opts.Normalize()) { _messageLogger = new BufferMessageEventCache(); Logger = new ConsoleLogger(opts); }
internal TestRunnerFinishedEventArgs(TestRun testRun, TestRunResults results, TestRunnerOptions opts) { Results = results; TestRun = testRun; _opts = opts; }
public static TestRunner Create(TestRunnerOptions testRunnerOptions) { return(new DefaultTestRunner(testRunnerOptions)); }