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;
 }
Exemple #2
0
        public void ReportExperimentError(ExperimentError error, TestInfo testInfo)
        {
            var errorMessage = new StringBuilder()
                .AppendFormat("Error in {0} for {1}:", testInfo.Suite.TestSuiteDescription, testInfo.TestedType)
                .AppendLine().AppendFormat("    {0}: {1}", testInfo.Suite.FeatureDescription, error.Descriptor)
                .AppendLine().AppendFormat("    {0}", error.ExceptionType)
                .AppendLine().AppendFormat("    {0}", error.Message);

            MessageBox.Show(errorMessage.ToString(),"Error in test", MessageBoxButton.OK, MessageBoxImage.Error);
        }
Exemple #3
0
 internal static IObservable<PerfTestResult> Run(TestInfo[] testInfo, PerfTestConfiguration configuration, bool parallel = false)
 {
     return testInfo.Select(x => x.Suite)
                    .Distinct()
                    .ToObservable()
                    .SelectMany(suite => CreateRunObservable(suite,
                                                             x =>
                                                             testInfo.FirstOrDefault(
                                                                 test => test.TestId.Equals(x.TestId)) != null,
                                                             processes => processes.Start(!parallel),
                                                             configuration,
                                                             parallel));
 }
Exemple #4
0
        private static TestInfo GetTestInfo(Guid id, MethodInfo method, Type testedAbstraction, TestSuiteInfo suiteInfo, Type testedType)
        {
            CheckTestability(suiteInfo.TesterType, testedType);

            var testAttribute = method.Attribute<PerfTestAttribute>();
            if (testAttribute == null)
            {
                throw new ArgumentNullException("method");
            }

            if (method.ReturnType != typeof(void) || !method.HasParameterSignature(new[] { testedAbstraction }))
            {
                throw new ArgumentException("Incorrect parameter signature");
            }

            if (testedType.IsGenericType)
            {
                // Fill the generic type arguments of the loaded generic type
                // with the tested abstraction interface actual generic type arguments.
                // Example: tested abstraction = IList<int>, tested type = List<T>
                // This line converts List<T> in List<int>
                testedType = testedType.MakeGenericType(testedAbstraction.GetGenericArguments());
            }

            TestInfo result;
            var ignoreAttribute = method.Attribute<PerfIgnoreAttribute>();
            if (ignoreAttribute == null)
            {
                result = new TestInfo
                            {
                                TestId = id,
                                TestDescription = testAttribute.Description,
                                TestMethodName = method.Name,
                                TestedType = testedType,
                                Suite = suiteInfo
                            };
            }
            else
            {
                result = new TestInfoIgnored
                {
                    TestId = id,
                    TestDescription = testAttribute.Description,
                    TestMethodName = method.Name,
                    IgnoreMessage = ignoreAttribute.Message,
                    TestedType = testedType,
                    Suite = suiteInfo
                };
            }

            return result;
        }
Exemple #5
0
 private static void Remove(IDictionary<TestInfo, LineSeries> dict, PlotModel plotModel, TestInfo test)
 {
     if (dict.ContainsKey(test))
     {
         plotModel.Series.Remove(dict[test]);
         dict.Remove(test);
         plotModel.RefreshPlot(true);
     }
 }
Exemple #6
0
 private static void AddPoint(IDictionary<TestInfo, LineSeries> dict, PlotModel plotModel, TestInfo test,
                              double xValue, double yValue)
 {
     if (dict.ContainsKey(test))
     {
         dict[test].Points.Add(new DataPoint(xValue, yValue));
         plotModel.RefreshPlot(true);
     }
 }
Exemple #7
0
 private static void Add(IDictionary<TestInfo, LineSeries> dict, PlotModel plotModel, TestInfo test)
 {
     if (!dict.ContainsKey(test))
     {
         var series = new LineSeries(test.ToString());
         dict.Add(test, series);
         plotModel.Series.Add(series);
         plotModel.RefreshPlot(true);
     }
 }
Exemple #8
0
 public void Remove(TestInfo test)
 {
     tests.Remove(test);
     Remove(memorySeries, MemoryPlotModel, test);
     Remove(speedSeries, SpeedPlotModel, test);
 }
Exemple #9
0
 public void Add(TestInfo test)
 {
     tests.Add(test);
     Add(memorySeries, MemoryPlotModel, test);
     Add(speedSeries, SpeedPlotModel, test);
 }