resharpernbehave

NBehave story output in resharper


I wrote a bunch of stories using NBehave.

Now I have seen examples where the output is display in human readily format (see this example)Wayback machine link

Is there any way to get this output in resharper?


Solution

  • This was posted by Jörg Jenni on his blog. He shows how to get nBehave output to display:

    When working with the latest build of NBehave 0.4 you may notice that there is no output written to the ReSharper Testrunner Output anymore.

    Here is how I did workaround the problem. I derived the specs from the following class and every thing was fine again:

    public class SpecBaseWithConsoleOutput: SpecBase
    {
      private EventHandler<EventArgs<MessageEventData>> addedHandler;
      private EventHandler<EventArgs<Scenario>> scenarioCreatedHandler;   
      private EventHandler<EventArgs<Story>> storyCreatedHandler;
      public override void MainSetup()
      {
        base.MainSetup();
        addedHandler = (o, a) => Console.WriteLine(a.EventData.Message);
        scenarioCreatedHandler = (o, a) => Console.WriteLine(a.EventData.Title);
        storyCreatedHandler = (o, a) => Console.WriteLine(a.EventData.Title);
        Story.MessageAdded += addedHandler;
        Story.ScenarioCreated += scenarioCreatedHandler;
        Story.StoryCreated += storyCreatedHandler;
      }
      public override void MainTeardown()
      {
        Story.MessageAdded -= addedHandler;
        Story.ScenarioCreated -= scenarioCreatedHandler;
        Story.StoryCreated -= storyCreatedHandler;
        base.MainTeardown();
      }
    }