Example #1
0
 public ExecutionContext(PerfTestConfiguration configuration)
 {
     this.lab = new PerfLab(typeof(StringBuildingTester).Assembly, typeof(StringRunner).Assembly, typeof(Dictionary<,>).Assembly);
     this.RunTests();
     //this.RunSomeTests();
     this.perfTestConfiguration = configuration;
 }
 public TestedTypeNodeViewModel(TestNodeViewModel parent, PerfLab lab, TestInfo testInfo)
     : base(parent)
 {
     this.parent = parent;
     this.perfLab = lab;
     this.TestInfo = testInfo;
     this.Name = testInfo.TestedType.FullName;
     this.IsEnabled = true;
 }
Example #3
0
 public TestNodeViewModel(TesterNodeViewModel parent, PerfLab perfLab, TestSuiteInfo testSuite, string testMethodName)
     : base(parent)
 {
     this.PerfLab = perfLab;
     this.TestSuite = testSuite;
     this.Tests = testSuite.Tests.Where(x => x.TestMethodName == testMethodName).ToArray();
     this.Name = testMethodName;
     this.Children.AddRange(from testInfo in this.Tests
                            select new TestedTypeNodeViewModel(this, perfLab, testInfo) {IsChecked = false});
     this.IsEnabled = this.Children.Count > 0;
 }
        public TesterNodeViewModel(PerfLab lab, TestSuiteInfo testSuiteInfo)
            : base(null)
        {
            var descr = testSuiteInfo.TestSuiteDescription;
            this.Name = string.IsNullOrEmpty(descr) ? testSuiteInfo.TesterType.FullName : descr;

            this.TestSuiteInfo = testSuiteInfo;

            this.Lab = lab;

            this.Children.AddRange(
                testSuiteInfo.Tests.GroupBy(x => x.TestMethodName)
                             .Select(x => new TestNodeViewModel(this, lab, testSuiteInfo, x.Key)));

            MessageBus.Current.Listen<ChartRemoved>().Subscribe(OnChartRemoved);

            this.IsEnabled = this.Children.Count > 0;
        }
Example #5
0
        public ChartViewModel(PerfLab lab, TestSuiteInfo suiteInfo)
        {
            this.perfTestConfiguration = new PerfTestConfiguration(Settings.Default.IgnoreFirstRunDueToJITting, Settings.Default.TriggerGCBeforeEachTest);

            this.Title = suiteInfo.TestSuiteDescription;

            Lab = lab;

            TestSuiteInfo = suiteInfo;

            this.StartValue = 1;

            this.EndValue = suiteInfo.DefaultTestCount;

            this.StepValue = 1;

            SpeedPlotModel =
                new PlotModel(string.Format("\"{0}\": Time characteristics", suiteInfo.TestSuiteDescription));

            SpeedPlotModel.Axes.Clear();
            SpeedPlotModel.Axes.Add(new LinearAxis(AxisPosition.Bottom, suiteInfo.FeatureDescription));

            MemoryPlotModel =
                new PlotModel(string.Format("\"{0}\": Memory usage", suiteInfo.TestSuiteDescription));

            MemoryPlotModel.Axes.Clear();
            MemoryPlotModel.Axes.Add(new LinearAxis(AxisPosition.Bottom, suiteInfo.FeatureDescription));

            memorySeries = new Dictionary<TestInfo, LineSeries>();
            speedSeries = new Dictionary<TestInfo, LineSeries>();

            IsLinear = true;
            IsStarted = false;

            var errorHandler = IoC.Instance.Resolve<ErrorHandler>();

            var whenStarted = this.WhenAny(x => x.IsStarted, x => x.Value);

            this.StartSequential = new ReactiveAsyncCommand(whenStarted.Select(x => !x));
            StartSequential.RegisterAsyncAction(OnStartSequential, RxApp.DeferredScheduler);
            errorHandler.HandleErrors(this.StartSequential);

            this.StartParallel = new ReactiveAsyncCommand(whenStarted.Select(x => !x));
            StartParallel.RegisterAsyncAction(OnStartParallel, RxApp.DeferredScheduler);
            errorHandler.HandleErrors(this.StartParallel);

            this.Stop = new ReactiveAsyncCommand(whenStarted);
            Stop.RegisterAsyncAction(OnStop, RxApp.DeferredScheduler);
            errorHandler.HandleErrors(this.Stop);

            this.WhenAny(x => x.IsLinear, x => x.Value ? EAxisType.Linear : EAxisType.Logarithmic)
                .Subscribe(SetAxisType);

            MessageBus.Current.Listen<PerfTestResult>()
                      .Where(x => tests.FirstOrDefault(t => t.TestId.Equals(x.TestId)) != null)
                      .Subscribe(
                          res =>
                              {
                                  var nextRes = res as NextResult;
                                  var errorRes = res as ExperimentError;
                                  if (nextRes != null)
                                  {
                                      AddPoint(memorySeries, MemoryPlotModel,
                                               tests.First(x => x.TestId.Equals(res.TestId)), nextRes.Descriptor,
                                               nextRes.MemoryUsage);

                                      AddPoint(speedSeries, SpeedPlotModel,
                                               tests.First(x => x.TestId.Equals(res.TestId)), nextRes.Descriptor,
                                               nextRes.Duration);
                                  }

                                  if (errorRes != null)
                                  {
                                      var test = tests.FirstOrDefault(x => x.TestId.Equals(errorRes.TestId));
                                      Task.Factory.StartNew(() => errorHandler.ReportExperimentError(errorRes, test));
                                  }
                              }, errorHandler.ReportException);

            ConnectIterationAndDescriptors();
        }