public void OnShrink(FSharpList <object> args, FSharpFunc <FSharpList <object>, string> everyShrink) { TestTimer.Stop(); RunnerImplementation.OnShrink(args, everyShrink); numberOfShrinks++; if (!isDetailedTraces) { if (isRunningTests && FsCheckRunnerConfig.TraceNumberOfRuns) { isRunningTests = false; FormattableString.Invariant($"Failed test: {latestNumTests} / {MaxTest}"); } if (isRunningShrinks && FsCheckRunnerConfig.TraceNumberOfRuns) { Trace( FormattableString.Invariant( $"Ran shrink: {numberOfShrinks} in {TestTimer.ElapsedMilliseconds:n0}ms" ) ); } isRunningShrinks = true; } TestTimer.Restart(); }
public void OnFinished(string name, TestResult testResult) { if (testResult.IsFailed) { var size = ((TestResult.Failed)testResult).Item7; var latestShrinks = ((TestResult.Failed)testResult).Item3.Select(x => (object[])x) .Cast <IEnumerable>() .Select(y => y); //var origArguments = ((TestResult.Failed) testResult).Item2 // .Select(x => (object[])x).Cast<IEnumerable>().Select(y => y); var message = string.Join( Environment.NewLine, $"Falsifiable, after {latestNumTests} test{(latestNumTests != 1 ? "s" : string.Empty)} ({numberOfShrinks} shrink{(numberOfShrinks != 1 ? "s" : string.Empty)})", $"Last step was invoked with size of {size}", "Shrunk:", $"{CSharpNotationSerializer.SerializeEach(latestShrinks.ToList(), CSharpNotationConfig)}" ); if (((TestResult.Failed)testResult).Item4.IsFailed) { var failedOutcome = (Outcome.Failed)((TestResult.Failed)testResult).Item4; FailureCausedByException = failedOutcome.Item; } if (!FsCheckRunnerConfig.ThrowOnFailure) { Trace(message); } else { throwOnFailureMessage = message; } } RunnerImplementation.OnFinished(name, testResult); // No need for event handlers to keep this runner alive, if we are executing multiple // property checks in the same test method. Dispose(); }
public void OnArguments( int numTest, FSharpList <object> args, FSharpFunc <int, FSharpFunc <FSharpList <object>, string> > every) { TestTimer.Stop(); RunnerImplementation.OnArguments(numTest, args, every); latestNumTests++; if (!isDetailedTraces) { if (FsCheckRunnerConfig.TraceNumberOfRuns) { Trace( FormattableString.Invariant( $"Ran test: {latestNumTests} / {MaxTest} in {TestTimer.ElapsedMilliseconds:n0}ms" ) ); } isRunningTests = true; } TestTimer.Restart(); }
public void OnStartFixture(Type t) { RunnerImplementation.OnStartFixture(t); TestTimer.Restart(); }