This project is read-only.

How to use tables and examples with fluent syntax?

Feb 16, 2011 at 3:28 AM

I found that using ScenarioWithSteps I can add examples but I don't how to add tables. As I see all examples which included in NBehave package defined tables and examples in feature file. It would be nice if the dev can provide examples about using tables and examples with fluent syntax.

Feb 16, 2011 at 10:49 AM

The fluent syntax for unit tests does not really support examples or tables at the moment.  We took the view that example are probably best handled by the unit testing framework itself, e.g. by using TestCase attribute with NUnit. If you would like to see NBehave fluent syntax supporting examples better than it currently does, then please create an issue on the Google code site.  It would be helpful if you can share some of the code you already have.

With regards to tables in the fluent syntax, can you please open an issue on the Google code site and give an example of the sort of syntax that you would like to see.  In the past, I've used repeated steps for this sort of behaviour, e.g.:

Given("A user Sally in France")
.And("A user Bob in England")
.And("A user Joe in Brazil") 

This approach is not as expressive as tables, so I'm sure we can improve on it.