private static void Compare(string baseResultsPath, string newResultsPath, string savePath) { if (baseResultsPath == string.Empty) { Console.WriteLine("Please generate a baseline benchmark results file," + "or provide a path for a baseline benchmark results file."); return; } if (newResultsPath == string.Empty) { Console.WriteLine("Please provide a path to a benchmark results file to compare against the baseline."); return; } // Create Model comparer Console.WriteLine("\nComparison of Model tests: \n"); var baseModelPath = Path.Combine(PerformanceTestHelper.GetFullPath(baseResultsPath), "DynamoPerformanceTests.DynamoModelPerformanceTestBase-report.csv"); var newModelPath = Path.Combine(PerformanceTestHelper.GetFullPath(newResultsPath), "DynamoPerformanceTests.DynamoModelPerformanceTestBase-report.csv"); var modelSavePath = Path.Combine(PerformanceTestHelper.GetFullPath(savePath), "DynamoPerformanceTests.Comparison-Model.csv"); var modelComparer = new ResultsComparer(baseModelPath, newModelPath, modelSavePath); // Create View comparer Console.WriteLine("\nComparison of View tests: \n"); var baseViewPath = Path.Combine(PerformanceTestHelper.GetFullPath(baseResultsPath), "DynamoPerformanceTests.DynamoViewPerformanceTestBase-report.csv"); var newViewPath = Path.Combine(PerformanceTestHelper.GetFullPath(newResultsPath), "DynamoPerformanceTests.DynamoViewPerformanceTestBase-report.csv"); var viewSavePath = Path.Combine(PerformanceTestHelper.GetFullPath(savePath), "DynamoPerformanceTests.Comparison-View.csv"); var viewComparer = new ResultsComparer(baseViewPath, newViewPath, viewSavePath); }
private static void Compare(string baseResultsPath, string newResultsPath, string savePath) { if (baseResultsPath == string.Empty) { Console.WriteLine("Please generate a baseline benchmark results file," + "or provide a path for a baseline benchmark results file."); return; } if (newResultsPath == string.Empty) { Console.WriteLine("Please provide a path to a benchmark results file to compare against the baseline."); return; } ResultsComparer modelComparer = null; ResultsComparer viewComparer = null; try { // Create Model comparer Console.WriteLine("\nComparison of Model tests: \n"); var baseModelPath = Path.Combine(PerformanceTestHelper.GetFullPath(baseResultsPath), modelTestBaseReport); var newModelPath = Path.Combine(PerformanceTestHelper.GetFullPath(newResultsPath), modelTestBaseReport); var modelSavePath = Path.Combine(PerformanceTestHelper.GetFullPath(savePath), modelTestComparison); modelComparer = new ResultsComparer(baseModelPath, newModelPath, modelSavePath); // Create View comparer Console.WriteLine("\nComparison of View tests: \n"); var baseViewPath = Path.Combine(PerformanceTestHelper.GetFullPath(baseResultsPath), viewTestBaseReport); var newViewPath = Path.Combine(PerformanceTestHelper.GetFullPath(newResultsPath), viewTestBaseReport); var viewSavePath = Path.Combine(PerformanceTestHelper.GetFullPath(savePath), viewTestComparison); viewComparer = new ResultsComparer(baseViewPath, newViewPath, viewSavePath); } //catch here - likely we could not create a view comparer if view comparison did not run. catch (Exception e) { Console.WriteLine($"exception while comparing results {e} {Environment.NewLine} {e.Message}"); } //return result of comparison if (modelComparer != null) { if (modelComparer.ComparisonData.Any(x => x.ResultState == ResultsComparer.ComparisonResultState.FAIL)) { Console.WriteLine("Comparison failed, some model performance benchmarks failed. Please see log above for details."); Environment.Exit((int)ExitCode.ComparisonFailure); } } if (viewComparer != null) { if (viewComparer.ComparisonData.Any(x => x.ResultState == ResultsComparer.ComparisonResultState.FAIL)) { Console.WriteLine("Comparison failed, some view performance benchmarks failed. Please see log above for details."); Environment.Exit((int)ExitCode.ComparisonFailure); } } }