public void record_data() { var spec = new Specification { name = "Some Name" }; var timings = new Timings(); timings.Start(spec); using (timings.Subject("Fixture.Setup", "Math")) { using (timings.Subject("Grammar", "Adding")) { using (timings.Subject("Fixture.Teardown", "Math")) { Thread.Sleep(100); } } } var records = timings.Finish(); records.Select(x => x.Subject).ShouldHaveTheSameElementsAs("Some Name", "Math", "Adding", "Math"); records.Each(x => x.Duration.ShouldBeGreaterThan(0)); }
public SpecResults Execute(Specification specification) { var plan = specification.CreatePlan(_library); var timings = new Timings(); timings.Start(specification); IExecutionContext execution = null; using (timings.Subject("Context", "Creation")) { execution = _system.CreateContext(); } var context = new SpecContext(specification, timings, new NulloResultObserver(), StopConditions, execution); context.Reporting.As <Reporting>().StartDebugListening(); var executor = new SynchronousExecutor(context); plan.AcceptVisitor(executor); execution.Dispose(); context.Dispose(); return(context.FinalizeResults(1)); }
public SpecResults Execute(Specification specification) { var plan = specification.CreatePlan(_library); var timings = new Timings(); _warmup.Wait(1.Minutes()); timings.Start(specification); IExecutionContext execution = null; SpecContext context = null; try { using (timings.Record("Context", "Creation")) { execution = _system.CreateContext(); } context = new SpecContext(specification, timings, new NulloResultObserver(), StopConditions, execution); context.Reporting.As <Reporting>().StartDebugListening(); SpecExecution.RunAll(context, plan); } finally { execution?.Dispose(); context?.Dispose(); } return(context.FinalizeResults(1)); }
public void run_with_non_zero_threshold_that_is_not_exceeded() { using (var timings = new Timings()) { timings.Start(new Specification()); var record = timings.Subject("something", "else", 100); timings.End(record); timings.Finish(); record.PerfViolation.ShouldBeFalse(); } }
public SpecResults Run(Specification specification) { var plan = specification.CreatePlan(_running.Fixtures); var timings = new Timings(); _warmup.Wait(1.Minutes()); timings.Start(specification); IExecutionContext execution = null; SpecContext context = null; try { using (timings.Record("Context", "Creation")) { execution = _running.System.CreateContext(); } context = new SpecContext(specification, timings, new NulloResultObserver(), StopConditions, execution); execution.BeforeExecution(context); context.Reporting.As <Reporting>().StartDebugListening(); SpecExecution.RunAll(context, plan); execution.AfterExecution(context); } finally { execution?.Dispose(); context?.Dispose(); } var results = context.FinalizeResults(1); _records.Add(new BatchRecord { results = results, specification = specification }); return(results); }
public void run_with_zero_threshold() { using (var timings = new Timings()) { timings.Start(new Specification()); var record = timings.Subject("something", "else", 0); Thread.Sleep(100); timings.End(record); timings.Finish(); record.PerfViolation.ShouldBeFalse(); } }
public SpecResults Execute(Specification specification) { var plan = specification.CreatePlan(_library); var timings = new Timings(); timings.Start(specification); IExecutionContext execution = null; var record = timings.Subject("Context", "Creation", 0); try { execution = _system.CreateContext(); } finally { timings.End(record); } var context = new SpecContext(specification, timings, new NulloResultObserver(), StopConditions, execution); context.Reporting.As <Reporting>().StartDebugListening(); var gatherer = new LineStepGatherer(context); plan.AcceptVisitor(gatherer); foreach (var line in gatherer.Lines) { line.Execute(context); } execution.Dispose(); context.Dispose(); return(context.FinalizeResults(1)); }