public void ShouldGetAlphaProject() { var teamCityListener = new TeamCityListener(); var state = teamCityListener.GetState(Projects.Alpha); Assert.IsNotNull(state); }
public void GetAlphaState() { var teamCityListener = new TeamCityListener(); var state = teamCityListener.GetState(Projects.Alpha); state.Wait(); Assert.IsNotNull(state.Result); }
public void ShouldReportResultsToTheConsoleInTeamCityFormat() { using (var console = new RedirectedConsole()) using (var listener = new TeamCityListener()) { var convention = SelfTestConvention.Build(); convention.CaseExecution.Skip(x => x.Method.Has <SkipAttribute>(), x => x.Method.GetCustomAttribute <SkipAttribute>().Reason); typeof(PassFailTestClass).Run(listener, convention); var testClass = typeof(PassFailTestClass).FullName; console.Lines() .Select(x => Regex.Replace(x, @":line \d+", ":line #")) //Avoid brittle assertion introduced by stack trace line numbers. .Select(x => Regex.Replace(x, @"duration='\d+'", "duration='#'")) //Avoid brittle assertion introduced by durations. .ShouldEqual( "##teamcity[testSuiteStarted name='Fixie.Tests.dll']", "##teamcity[testIgnored name='" + testClass + ".SkipWithReason' message='Skipped with reason.']", "##teamcity[testIgnored name='" + testClass + ".SkipWithoutReason' message='']", "Console.Out: FailA", "Console.Error: FailA", "Console.Out: FailB", "Console.Error: FailB", "Console.Out: PassA", "Console.Error: PassA", "Console.Out: PassB", "Console.Error: PassB", "Console.Out: PassC", "Console.Error: PassC", "##teamcity[testStarted name='" + testClass + ".FailA']", "##teamcity[testStdOut name='" + testClass + ".FailA' out='Console.Out: FailA|r|nConsole.Error: FailA|r|n']", "##teamcity[testFailed name='" + testClass + ".FailA' message='|'FailA|' failed!' details='|'FailA|' failed!|r|n at Fixie.Tests.ConsoleRunner.TeamCityListenerTests.PassFailTestClass.FailA() in " + PathToThisFile() + ":line #']", "##teamcity[testFinished name='" + testClass + ".FailA' duration='#']", "##teamcity[testStarted name='" + testClass + ".FailB']", "##teamcity[testStdOut name='" + testClass + ".FailB' out='Console.Out: FailB|r|nConsole.Error: FailB|r|n']", "##teamcity[testFailed name='" + testClass + ".FailB' message='|'FailB|' failed!' details='|'FailB|' failed!|r|n at Fixie.Tests.ConsoleRunner.TeamCityListenerTests.PassFailTestClass.FailB() in " + PathToThisFile() + ":line #']", "##teamcity[testFinished name='" + testClass + ".FailB' duration='#']", "##teamcity[testStarted name='" + testClass + ".PassA']", "##teamcity[testStdOut name='" + testClass + ".PassA' out='Console.Out: PassA|r|nConsole.Error: PassA|r|n']", "##teamcity[testFinished name='" + testClass + ".PassA' duration='#']", "##teamcity[testStarted name='" + testClass + ".PassB']", "##teamcity[testStdOut name='" + testClass + ".PassB' out='Console.Out: PassB|r|nConsole.Error: PassB|r|n']", "##teamcity[testFinished name='" + testClass + ".PassB' duration='#']", "##teamcity[testStarted name='" + testClass + ".PassC']", "##teamcity[testStdOut name='" + testClass + ".PassC' out='Console.Out: PassC|r|nConsole.Error: PassC|r|n']", "##teamcity[testFinished name='" + testClass + ".PassC' duration='#']", "##teamcity[testSuiteFinished name='Fixie.Tests.dll']"); } }
public void ShouldReportResultsToTheConsoleInTeamCityFormat() { var listener = new TeamCityListener(); using (var console = new RedirectedConsole()) { Run(listener); console .Output .CleanStackTraceLineNumbers() .Lines() .Select(x => Regex.Replace(x, @"duration='\d+'", "duration='#'")) .ShouldBe( "##teamcity[testSuiteStarted name='Fixie.Tests']", "Console.Out: Fail", "Console.Error: Fail", "##teamcity[testStarted name='" + TestClass + ".Fail']", "##teamcity[testStdOut name='" + TestClass + ".Fail' out='Console.Out: Fail|r|nConsole.Error: Fail|r|n']", "##teamcity[testFailed name='" + TestClass + ".Fail' message='|'Fail|' failed!' details='Fixie.Tests.FailureException|r|n" + At("Fail()") + "']", "##teamcity[testFinished name='" + TestClass + ".Fail' duration='#']", "Console.Out: FailByAssertion", "Console.Error: FailByAssertion", "##teamcity[testStarted name='" + TestClass + ".FailByAssertion']", "##teamcity[testStdOut name='" + TestClass + ".FailByAssertion' out='Console.Out: FailByAssertion|r|nConsole.Error: FailByAssertion|r|n']", "##teamcity[testFailed name='" + TestClass + ".FailByAssertion' message='Expected: 2|r|nActual: 1' details='Fixie.Tests.Assertions.AssertException|r|n" + At("FailByAssertion()") + "']", "##teamcity[testFinished name='" + TestClass + ".FailByAssertion' duration='#']", "Console.Out: Pass", "Console.Error: Pass", "##teamcity[testStarted name='" + TestClass + ".Pass']", "##teamcity[testStdOut name='" + TestClass + ".Pass' out='Console.Out: Pass|r|nConsole.Error: Pass|r|n']", "##teamcity[testFinished name='" + TestClass + ".Pass' duration='#']", "##teamcity[testStarted name='" + TestClass + ".SkipWithReason']", "##teamcity[testIgnored name='" + TestClass + ".SkipWithReason' message='|0x26a0 Skipped with reason.']", "##teamcity[testFinished name='" + TestClass + ".SkipWithReason' duration='#']", "##teamcity[testStarted name='" + TestClass + ".SkipWithoutReason']", "##teamcity[testIgnored name='" + TestClass + ".SkipWithoutReason' message='']", "##teamcity[testFinished name='" + TestClass + ".SkipWithoutReason' duration='#']", "##teamcity[testSuiteFinished name='Fixie.Tests']"); } }
public void ShouldReportResultsToTheConsoleInTeamCityFormat() { using (var console = new RedirectedConsole()) { var listener = new TeamCityListener(); new SelfTestConvention().Execute(listener, typeof(PassFailTestClass)); var testClass = typeof(PassFailTestClass).FullName; console.Lines() .Select(x => Regex.Replace(x, @":line \d+", ":line #")) //Avoid brittle assertion introduced by stack trace line numbers. .Select(x => Regex.Replace(x, @"duration='\d+'", "duration='#'")) //Avoid brittle assertion introduced by durations. .ShouldEqual( "##teamcity[testIgnored name='" + testClass + ".SkipA']", "Console.Out: FailA", "Console.Error: FailA", "Console.Out: FailB", "Console.Error: FailB", "Console.Out: PassA", "Console.Error: PassA", "Console.Out: PassB", "Console.Error: PassB", "Console.Out: PassC", "Console.Error: PassC", "##teamcity[testStarted name='" + testClass + ".FailA']", "##teamcity[testStdOut name='" + testClass + ".FailA' out='Console.Out: FailA|r|nConsole.Error: FailA|r|n']", "##teamcity[testFailed name='" + testClass + ".FailA' message='|'FailA|' failed!' details='|'FailA|' failed!|r|n at Fixie.Tests.Listeners.TeamCityListenerTests.PassFailTestClass.FailA() in " + PathToThisFile() + ":line #']", "##teamcity[testFinished name='" + testClass + ".FailA' duration='#']", "##teamcity[testStarted name='" + testClass + ".FailB']", "##teamcity[testStdOut name='" + testClass + ".FailB' out='Console.Out: FailB|r|nConsole.Error: FailB|r|n']", "##teamcity[testFailed name='" + testClass + ".FailB' message='|'FailB|' failed!' details='|'FailB|' failed!|r|n at Fixie.Tests.Listeners.TeamCityListenerTests.PassFailTestClass.FailB() in " + PathToThisFile() + ":line #']", "##teamcity[testFinished name='" + testClass + ".FailB' duration='#']", "##teamcity[testStarted name='" + testClass + ".PassA']", "##teamcity[testStdOut name='" + testClass + ".PassA' out='Console.Out: PassA|r|nConsole.Error: PassA|r|n']", "##teamcity[testFinished name='" + testClass + ".PassA' duration='#']", "##teamcity[testStarted name='" + testClass + ".PassB']", "##teamcity[testStdOut name='" + testClass + ".PassB' out='Console.Out: PassB|r|nConsole.Error: PassB|r|n']", "##teamcity[testFinished name='" + testClass + ".PassB' duration='#']", "##teamcity[testStarted name='" + testClass + ".PassC']", "##teamcity[testStdOut name='" + testClass + ".PassC' out='Console.Out: PassC|r|nConsole.Error: PassC|r|n']", "##teamcity[testFinished name='" + testClass + ".PassC' duration='#']"); } }
public MessagesController() { _teamCityListener = new TeamCityListener(); }