Ejemplo n.º 1
0
        public void RunTests(string resultDirectory)
        {
            var results = new List <PerformanceMetric>();
            var performanceCaseResult = new PerformanceCaseResult();

            performanceCaseResult.StartTimer();

            foreach (var testDefinition in Tests)
            {
                var result = Run(testDefinition);
                PrintSummary(result);
                results.AddRange(ConvertResultToMetrics(result));
            }

            performanceCaseResult.StopTimer();
            performanceCaseResult.Metrics = results.ToArray();

            Assert.False(results.Count == 0, "tests returned no results");

            var parsedData = JsonConvert.SerializeObject(performanceCaseResult, Formatting.Indented);

            if (!Directory.Exists(resultDirectory))
            {
                Directory.CreateDirectory(resultDirectory);
            }

            var filename = string.Format("result_{0}.json", results.First().Scenario.Replace(' ', '_'));

            File.WriteAllText(Path.Combine(resultDirectory, filename), parsedData);
        }
Ejemplo n.º 2
0
        public void RunTests(string resultDirectory)
        {
            var results = new List<PerformanceMetric>();
            var failedRunResult = new List<Exception>();
            var performanceCaseResult = new PerformanceCaseResult();
            performanceCaseResult.StartTimer();

            foreach (var testDefinition in _tests)
            {
                var result = Run(testDefinition);
                PrintSummary(result);
                results.AddRange(ConvertResultToMetrics(result));
                if (!result.Successful)
                {
                    failedRunResult.Add(result.ReportedException);
                }
            }

            performanceCaseResult.StopTimer();
            performanceCaseResult.Metrics = results.ToArray();

            Assert.False(failedRunResult.Any(), failedRunResult.Any() ? failedRunResult.First().Message : string.Empty);
            Assert.False(results.Count == 0, "tests returned no results");

            WriteResultFiles(resultDirectory, results, performanceCaseResult);
        }
Ejemplo n.º 3
0
        public void RunTests(string resultDirectory)
        {
            var results               = new List <PerformanceMetric>();
            var failedRunResult       = new List <Exception>();
            var performanceCaseResult = new PerformanceCaseResult();

            performanceCaseResult.StartTimer();

            foreach (var testDefinition in _tests)
            {
                var result = Run(testDefinition);
                PrintSummary(result);
                results.AddRange(ConvertResultToMetrics(result));
                if (!result.Successful)
                {
                    failedRunResult.Add(result.ReportedException);
                }
            }

            performanceCaseResult.StopTimer();
            performanceCaseResult.Metrics = results.ToArray();

            Assert.False(failedRunResult.Any(), failedRunResult.Any() ? failedRunResult.First().Message : string.Empty);
            Assert.False(results.Count == 0, "tests returned no results");

            WriteResultFiles(resultDirectory, results, performanceCaseResult);
        }
Ejemplo n.º 4
0
        public void Run(string resultDirectory)
        {
            var performanceCaseResult = new PerformanceCaseResult();
            performanceCaseResult.StartTimer();

            var result = Run(_test);

            performanceCaseResult.StopTimer();
            performanceCaseResult.Metrics = ConvertResultToMetrics(result).ToArray();

            PrintSummary(result);

            if (!result.Successful)
            {
                // log the failure using an Assert that will always fail
                Assert.True(false, result.ReportedException.Message);
            }

            WriteResultFile(resultDirectory, _test.TestName, performanceCaseResult);
        }
Ejemplo n.º 5
0
        public void Run(string resultDirectory)
        {
            var performanceCaseResult = new PerformanceCaseResult();

            performanceCaseResult.StartTimer();

            var result = Run(_test);

            performanceCaseResult.StopTimer();
            performanceCaseResult.Metrics = ConvertResultToMetrics(result).ToArray();

            PrintSummary(result);

            if (!result.Successful)
            {
                // log the failure using an Assert that will always fail
                Assert.True(false, result.ReportedException.Message);
            }

            WriteResultFile(resultDirectory, _test.TestName, performanceCaseResult);
        }