This project is read-only.

Narrative-only parameter in Given, When, Then

Apr 15, 2010 at 10:31 AM
Edited Apr 15, 2010 at 10:35 AM
Hi there.

First off - excellent tool you are building. We use it extensively for most of our projects and we have experienced a boost in productivity as well as quality in the services and products we deliver due to BDD and StoryQ!

Then my question:

I am wondering why the following methods are protected:

Scenario.Given(string text)
Condition.When(string text)
Operation.Then(string text)
Condition.And(string text)
Operation.And(string text)
Outcome.And(string text)

Changing their access modifier to public resulted in "object reference not set to an instance of an object" exception due to a call to a non-existing Action delegate in Step.Execute().

I added the following check to said method:
// checking if Action exist, otherwise return pending result
if (Action != null)
return Result.ForResultType(Prefix, IndentLevel, Text, tags, ResultType.Passed);
return Result.ForResultType(Prefix, IndentLevel, Text, tags, ResultType.Pending);

And then everything worked again as expected.

BUT are you moving away from pure narrative method parameters?
Apr 15, 2010 at 12:10 PM

Hi Martin

We are in fact looking at moving away from string-based parameters - but I was really just waiting for someone to complain.

Please have a look at our associated issue:

And let me know what you think...




Apr 15, 2010 at 2:46 PM
Edited Apr 15, 2010 at 2:46 PM
Hi Rob.

It is a real pain that ReSharper cannot suggest to create a new method based on the Action parameter when it is trailing a string parameter. Really strange. I have filed the issue with the ReSharper dev team.

But, I really need to write scenarios using only a text narrative as single parameter. We have business specialists writing these scenarios and they enter these directly into our solution into a specification project. In this way it functions as a product backlog (scrum style) and our developers are instantly aware that new stories/scenarios have been submitted. I fear that asking our business specialists to write the scenario parts using camelcase will be met with resistance.

However, I have made the necessary modifications to the template file and to the Step class so we have the overloads we need. So it is not an issue I will press further. Just a heads up on what our day-to-day needs/usage are.
Apr 15, 2010 at 3:22 PM

It's really useful to hear about our user's actual workflows - so thanks for that.

I am not sure why i made the method protected instead of simply deleting it. I am glad that you were able to modify the source to suit your needs (did you clone the repository with mercurial? It will make merging in future features easier...), but i'm worried that we are breaking things for other users with this change...

Can you think of any other options? We could prefix the string based step methods (PendingGiven, PendingAnd, FailingAnd), which might be better for your non-technical coders than just using an underscore. I am curious as to why your business specialists don't just use the WPF converter, though? Even as a developer, I find it's easier to use - especially now that there's a rudimentary form of code completion...

Regards - Rob

Apr 19, 2010 at 11:10 PM

I have had another thought, and will spike it out soon:

What if we created extension methods for these string based executable steps, and put the class with these methods into another namespace.

So if you wanted to use them, you'd need "using StoryQ.AllowTextualSteps" at the top of your file?

Apr 20, 2010 at 6:23 PM

Hi Martin

Can you please have a look at the source code in the latest changeset (d8472e2e6cba) and tell me if that covers your workflow?

Regards - Rob