Exemplo n.º 1
0
        public void ReportOn(HarnessResult result)
        {
            var harnessResultsOverview = new List<CaseResult>();
            result.AffectedSuites.ForEach(
                suite => suite.Descriptions.ForEach(description =>
                {
                    PrintSuiteInformation(description);

                    if (description.HasExecutedCases())
                    {
                        description.Cases.Where(c => c.CanBeReportedOn()).ForEach(@case =>
                        {
                            if (@case.Result.Success)
                            {
                                PrintPassedCase(@case);
                                harnessResultsOverview.Add(CaseResult.Passed);
                            }
                            else
                            {
                                PrintFailedCase(@case);
                                harnessResultsOverview.Add(CaseResult.Failed);
                            }
                        });
                    }
                    else
                    {
                        PrintDescriptionWithoutExecutedCases(description);
                        harnessResultsOverview.Add(CaseResult.Inconclusive);
                    }

                }));

            PrintResultsOverview(harnessResultsOverview);
            PrintResultSummary(result);
        }
Exemplo n.º 2
0
        public void ReportOn(HarnessResult result)
        {
            var frameworkName = result.Harness.Framework.Name;
            var harnessResultsOverview = new List<CaseResult>();
            result.AffectedSuites.ForEach(
                suite => suite.Descriptions.ForEach(description =>
                {
                    if (description.HasExecutedCases())
                    {
                        description.Cases.Where(c => c.CanBeReportedOn()).ForEach(@case =>
                        {

                            if (@case.Result.Success)
                            {
                                _workerApi.AddTest(
                                    string.Format("{0}-{1}-{2}", description.Suite.FriendlyName(), description.FriendlyName(), @case.FriendlyName()),
                                    frameworkName,
                                    description.File.Filename,
                                    AppVeyorCaseResult.Passed,
                                    null,
                                    null,
                                    null,
                                    @case.Result.Message,
                                    null);

                            }
                            else
                            {
                                _workerApi.AddTest(
                                    string.Format("{0}-{1}-{2}", description.Suite.FriendlyName(), description.FriendlyName(), @case.FriendlyName()),
                                    frameworkName,
                                    description.File.Filename,
                                    AppVeyorCaseResult.Failed,
                                    null,
                                    null,
                                    null,
                                    @case.Result.Message,
                                    @case.Result.Message);
                            }
                        });
                    }
                    else
                    {
                        _workerApi.AddTest(
                                    string.Format("{0}-{1}", description.Suite.FriendlyName(), description.FriendlyName()),
                                    frameworkName,
                                    description.File.Filename,
                                    AppVeyorCaseResult.Failed,
                                    null,
                                    null,
                                    null,
                                    null,
                                    null);
                    }

                }));
        }
Exemplo n.º 3
0
 public void HarnessChanged(HarnessChangeType changeType, HarnessResult result)
 {
     GrowlHelper.simpleGrowl("Forseti", string.Format(
         
         "Run complete with {0}\n"+
         "Took {1} seconds\n\n"+
         "Total tests : {2}\n"+
         "Successful tests : {3}\n"+
         "Failed tests : {4}"
     , 
     result.Harness.Framework.Name,
     result.TotalTime.TotalSeconds,
     result.TotalCaseCount, 
     result.SuccessfulCaseCount, 
     result.FailedCaseCount));
 }
Exemplo n.º 4
0
        public HarnessResult Execute(Harness harness, IEnumerable<Suite> suites)
        {
			Console.WriteLine("<--- Run Suite(s) for {0} on {1} framework --->", harness.Name, harness.Framework.Name);

            var result = new HarnessResult(harness);
            result.StartTime = DateTime.Now;
			if( suites.Count() == 0 ) 
			{
				Console.WriteLine ("No suites");
                _harnessChangeManager.NotifyChange(result, HarnessChangeType.RunComplete);
				return null;
			}
            suites.ForEach(s => 
                            {
                                s = PrepareSuiteForReporting(s);
                                result.AddAffectedSuite(s); 
                            });
			
            
            var timeBefore = DateTime.Now;
            var cases = PrepareCasesForSuite(harness, suites);
			
			if( harness.Cases.Count () == 0 )
			{
				Console.WriteLine("no cases");
			} else 
			{
	            var page = _pageGenerator.GenerateFrom(harness);

                // Todo: this is no good - just a temporary testing thing....
                HarnessCaseReporter.HarnessResult = result;
	            _scriptEngine.Execute(page);
			}

            result.EndTime = DateTime.Now;
            var delta = DateTime.Now.Subtract(timeBefore);

            
            _harnessChangeManager.NotifyChange(result, HarnessChangeType.RunComplete);

            Console.WriteLine("<--- Took {0} seconds --->\r\n", delta.TotalSeconds);

            return result;
        }
Exemplo n.º 5
0
 public void NotifyChange(HarnessResult harnessResult, HarnessChangeType changeType)
 {
     foreach (var watcher in _watchers)
         watcher.HarnessChanged(changeType, harnessResult);
 }
Exemplo n.º 6
0
        void PrintResultSummary(HarnessResult result)
        {
            Console.WriteLine("");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.Write(" " + result.SuccessfulCaseCount);
            Console.ResetColor();
            Console.Write(" Passed(.), ");

            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write(result.FailedCaseCount);
            Console.ResetColor();
            Console.Write("  Failed(x), ");

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write(result.InconclusiveCaseCount);
            Console.ResetColor();
            Console.Write("  Inconclusive(-). Total {0} tests run.\r\n", result.TotalCaseCount);
        }
Exemplo n.º 7
0
 public void HarnessChanged(HarnessChangeType changeType, HarnessResult result)
 {
     _reporter.ReportOn(result);
 }