1

Closed

Empty scenario file causes NullReferenceException in NBehave-Console.exe

description

When running NBehave-Console.exe with the /sf argument, against a file that (stupidly) had no "Given", "When" or "Then" lines in it (it had them in lowercase :P), i encountered the following exception:
 
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at NBehave.Narrator.Framework.ScenarioStepRunner.RunScenario(ScenarioSteps scenarioSteps, Int32 scenarioCounter)
at NBehave.Narrator.Framework.ScenarioStepRunner.RunScenarios(IEnumerable`1 scenarios, StoryResults storyResults)
at NBehave.Narrator.Framework.TextRunner.RunStories(StoryResults storyResults)
at NBehave.Narrator.Framework.TextRunner.RunStories(StoryResults results, IEventListener listener)
at NBehave.Narrator.Framework.RunnerBase.Run(IEventListener listener)
at NBehave.Console.Program.Main(String[] args)
 
While the obvious workaround to this is to not have empty scenario files, as a new user of NBehave, I would find it easier to get up to speed if this was replaced with an informative error message.
 
This is against build 4.5 (http://nbehave.codeplex.com/releases/view/36413)
Closed Mar 1, 2011 at 8:51 PM by naeemkhedarun

comments