public void Should_serialize_run_finished_message() { var runreport = new RunReport(); runreport.AddBuild("project 1", new TimeSpan(23), true); runreport.AddBuild("project 2", new TimeSpan(12), false); runreport.AddTestRun("project 2", "assembly", new TimeSpan(52), 12, 1, 2); runreport.WasAborted(); var message = new RunFinishedMessage(runreport); var output = serializeDeserialize <RunFinishedMessage>(message); output.Report.NumberOfBuildsSucceeded.ShouldEqual(1); output.Report.NumberOfBuildsFailed.ShouldEqual(1); output.Report.RunActions[0].Project.ShouldEqual("project 1"); output.Report.RunActions[0].Type.ShouldEqual(InformationType.Build); output.Report.RunActions[0].Succeeded.ShouldEqual(true); output.Report.RunActions[0].TimeSpent.ShouldEqual(new TimeSpan(23)); output.Report.RunActions[1].Project.ShouldEqual("project 2"); output.Report.RunActions[1].Type.ShouldEqual(InformationType.Build); output.Report.RunActions[1].Succeeded.ShouldEqual(false); output.Report.RunActions[1].TimeSpent.ShouldEqual(new TimeSpan(12)); output.Report.Aborted.ShouldBeTrue(); output.Report.NumberOfTestsPassed.ShouldEqual(12); output.Report.NumberOfTestsFailed.ShouldEqual(2); output.Report.NumberOfTestsIgnored.ShouldEqual(1); output.Report.RunActions[2].Project.ShouldEqual("project 2"); output.Report.RunActions[2].Assembly.ShouldEqual("assembly"); output.Report.RunActions[2].Type.ShouldEqual(InformationType.TestRun); output.Report.RunActions[2].Succeeded.ShouldEqual(false); output.Report.RunActions[2].TimeSpent.ShouldEqual(new TimeSpan(52)); }
public void Should_add_test_run() { _report.AddTestRun("Project", "Assembly", new TimeSpan(0, 0, 30), 10, 20, 30); _report.RunActions[0].Type.ShouldEqual(InformationType.TestRun); _report.RunActions[0].Project.ShouldEqual("Project"); _report.RunActions[0].Assembly.ShouldEqual("Assembly"); _report.RunActions[0].TimeSpent.ShouldEqual(new TimeSpan(0, 0, 30)); _report.NumberOfTestsPassed.ShouldEqual(10); _report.NumberOfTestsIgnored.ShouldEqual(20); _report.NumberOfTestsFailed.ShouldEqual(30); _report.NumberOfTestsRan.ShouldEqual(60); }
public void Should_build_tooltip_string() { var report = new RunReport(); report.AddBuild(Path.GetFullPath("Project1.csproj"), new TimeSpan(0, 0, 0, 2, 234), true); report.AddBuild(Path.GetFullPath("Project2.csproj"), new TimeSpan(0, 0, 0, 3, 154), false); report.AddTestRun(Path.GetFullPath("Project3.csproj"), Path.GetFullPath("Assembly.dll"), new TimeSpan(0, 0, 0, 6, 211), 0, 0, 0); var builder = new SummaryBuilder(report); var output = builder.Build(); output.ToString().ShouldEqual(getResult()); }
public void Should_build_tooltip_string() { var report = new RunReport(); report.AddBuild(Path.GetFullPath("Project1.csproj"), new TimeSpan(0, 0, 0, 2, 234), true); report.AddBuild(Path.GetFullPath("Project2.csproj"), new TimeSpan(0, 0, 0, 3, 154), false); report.AddTestRun(Path.GetFullPath("Project3.csproj"), Path.GetFullPath("Assembly.dll"), new TimeSpan(0, 0, 0, 6, 211), 0, 0, 0); var builder = new SummaryBuilder(report); var output = builder.Build(); output.ToString().ShouldEqual(getResult()); }
private void mergeReport(TestRunResults[] results, RunReport report, TestRunInfo[] runInfos) { var modifiedResults = new List<TestRunResults>(); foreach (var result in results) { var modified = _removedTestLocator.SetRemovedTestsAsPassed(result, runInfos); report.AddTestRun( modified.Project, modified.Assembly, modified.TimeSpent, modified.Passed.Length, modified.Ignored.Length, modified.Failed.Length); _bus.Publish(new TestRunMessage(modified)); modifiedResults.Add(modified); } informPreProcessor(modifiedResults.ToArray()); }
private void runTests(ITestRunner testRunner, TestRunInfo[] runInfos, Action <AutoTest.TestRunners.Shared.Targeting.Platform, Action <System.Diagnostics.ProcessStartInfo> > processWrapper, RunReport runReport) { var results = runTests(testRunner, runInfos, processWrapper); var modifiedResults = new List <TestRunResults>(); foreach (var result in results) { runReport.AddTestRun( result.Project, result.Assembly, result.TimeSpent, result.Passed.Length, result.Ignored.Length, result.Failed.Length); var modified = _removedTestLocator.SetRemovedTestsAsPassed(result, runInfos); _bus.Publish(new TestRunMessage(modified)); modifiedResults.Add(modified); } informPreProcessor(modifiedResults.ToArray()); }
public void Handle(List <ChangedFile> files) { IsRunning = true; _bus.Publish(new RunStartedMessage(files.ToArray())); var runReport = new RunReport(); AutoTest.Core.DebugLog.Debug.WriteDebug("Reading configuration"); var configsString = _config.AllSettings("php.phpunit.configs"); var configs = configsString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var config in configs) { var configLocation = _config.AllSettings("php.phpunit." + config + ".configlocation"); var patterns = _config.AllSettings("php.phpunit." + config + ".Convention.Pattern"); var testPaths = _config.AllSettings("php.phpunit." + config + ".Convention.TestPaths"); var testLocations = new List <string>(); if (patterns.Length == 0 && testPaths.Length == 0) { testLocations.Add(""); } else { var matcher = new PhpFileConventionMatcher( _config.WatchPath, patterns.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries), testPaths.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)); foreach (var file in files) { foreach (var location in matcher.Match(file.FullName)) { if (!Directory.Exists(location)) { continue; } if (!testLocations.Contains(location)) { testLocations.Add(location); } } } } if (configLocation != "") { configLocation = "-c " + configLocation + " "; } AutoTest.Core.DebugLog.Debug.WriteDebug("Running tests for test locations"); foreach (var location in testLocations) { var results = new PhpUnitRunner(_cache) .Run( configLocation + location, _config.WatchPath, location, (line) => { sendLiveFeedback(line); }); AutoTest.Core.DebugLog.Debug.WriteDebug("Returned " + results.Count.ToString() + " results"); var resultList = new List <TestRunResults>(); var runInfos = results.Select(x => new TestRunInfo(new Project(x.Project, null), x.Assembly)).ToArray(); resultList.AddRange(results); resultList.AddRange(_removedTestLocator.RemoveUnmatchedRunInfoTests(results.ToArray(), runInfos)); foreach (var result in resultList) { AutoTest.Core.DebugLog.Debug.WriteDebug("Result contains " + result.All.Length.ToString() + " tests for " + result.Project); runReport.AddTestRun( result.Project, result.Assembly, result.TimeSpent, result.Passed.Length, result.Ignored.Length, result.Failed.Length); _bus.Publish(new TestRunMessage(result)); } } } // Oh my god.. please fix this // Issue with ordering of TestRunMessage and RunFinishedMessage System.Threading.Thread.Sleep(500); _bus.Publish(new RunFinishedMessage(runReport)); IsRunning = false; }
public void Handle(List<ChangedFile> files) { IsRunning = true; _bus.Publish(new RunStartedMessage(files.ToArray())); var runReport = new RunReport(); var configsString = _config.AllSettings("php.phpunit.configs"); var configs = configsString.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries); foreach (var config in configs) { var configLocation = _config.AllSettings("php.phpunit." + config + ".configlocation"); var patterns = _config.AllSettings("php.phpunit." + config + ".Convention.Pattern"); var testPaths = _config.AllSettings("php.phpunit." + config + ".Convention.TestPaths"); var testLocations = new List<string>(); if (patterns.Length == 0 && testPaths.Length == 0) { testLocations.Add(""); } else { var matcher = new PhpFileConventionMatcher( _config.WatchPath, patterns.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries), testPaths.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries)); foreach (var file in files) { foreach (var location in matcher.Match(file.FullName)) { if (!Directory.Exists(location)) continue; if (!testLocations.Contains(location)) testLocations.Add(location); } } } if (configLocation != "") configLocation = "-c " + configLocation + " "; foreach (var location in testLocations) { var results = new PhpUnitRunner(_cache) .Run( configLocation + location, _config.WatchPath, location, (line) => { sendLiveFeedback(line); }); AutoTest.Core.DebugLog.Debug.WriteDebug("Returned " + results.Count.ToString() + " results"); var resultList = new List<TestRunResults>(); var runInfos = results.Select(x => new TestRunInfo(new Project(x.Project, null), x.Assembly)).ToArray(); resultList.AddRange(results); resultList.AddRange(_removedTestLocator.RemoveUnmatchedRunInfoTests(results.ToArray(), runInfos)); foreach (var result in resultList) { AutoTest.Core.DebugLog.Debug.WriteDebug("Result contains " + result.All.Length.ToString() + " tests"); runReport.AddTestRun( result.Project, result.Assembly, result.TimeSpent, result.Passed.Length, result.Ignored.Length, result.Failed.Length); _bus.Publish(new TestRunMessage(result)); } } } // Oh my god.. please fix this // Issue with ordering of TestRunMessage and RunFinishedMessage System.Threading.Thread.Sleep(100); _bus.Publish(new RunFinishedMessage(runReport)); IsRunning = false; }