I'm starting a new project and I'm trying to set up a way to develop it BDD-style. I've not used any BDD framework in C# before but your library seems really neat. I'm saying this just because it's very likely the issue I've encountered is to do with my inexperience with these tools rather than a bug with the tools themselves.
I originally considered doing this project in Python and used Behave to let me write a series of specification files in Cucumber. Behave lets you create 'Scenario Outlines' where you run a scenario using different example data, but it also lets you associate tabular data with individual steps. I've made use of both features in my Behave-style feature specs and I'm trying to port them to Specify/BDDfy.
Here's a scenario I made in Behave but I'm having trouble replicating in Specify:
Mofichan Is Greeted
Given Mofichan is configured to use the following behaviours:
| behaviour |
| identity |
| greeting |
And Mofichan is running
When I say "<greeting> Mofichan"
Then Mofichan should greet me back
Examples:
| greeting |
| hey |
| hi |
| hello |
In Specify, I've tried to do the following in a specification context class without adding examples:
public void Setup()
{
this.Container.Set<IMofichanBackend>(new MockBackend("mock"));
}
[RunStepWithArgs("identity", StepTextTemplate = AddBehaviourTemplate)]
[RunStepWithArgs("greeting", StepTextTemplate = AddBehaviourTemplate)]
public void Given_Mofichan_is_configured_with_the_following_behaviours(string behaviour)
{
this.Container.Set<IMofichanBehaviour>(new MockBehaviour(behaviour), key: behaviour);
}
public void AndGiven_Mofichan_is_running()
{
//var mofichan = this.Container.SystemUnderTest;
throw new NotImplementedException();
}
public void When_I_say__greeting__mofichan(string greeting)
{
throw new NotImplementedException();
}
public void Then_Mofichan_should_greet_me_back()
{
throw new NotImplementedException();
}
This produces the following report:
This is pretty much what I want - to have the same 'Given' method run twice with different arguments and have that shown in the report.
Not only is the report much less informative, but it also causes incorrect test behaviour; Given_Mofichan_is_configured_with_the_following_behaviours is only called once even if
RunStepWithArgs is applied to it multiple times.
I'm starting a new project and I'm trying to set up a way to develop it BDD-style. I've not used any BDD framework in C# before but your library seems really neat. I'm saying this just because it's very likely the issue I've encountered is to do with my inexperience with these tools rather than a bug with the tools themselves.
I originally considered doing this project in Python and used Behave to let me write a series of specification files in Cucumber. Behave lets you create 'Scenario Outlines' where you run a scenario using different example data, but it also lets you associate tabular data with individual steps. I've made use of both features in my Behave-style feature specs and I'm trying to port them to Specify/BDDfy.
Here's a scenario I made in Behave but I'm having trouble replicating in Specify:
In Specify, I've tried to do the following in a specification context class without adding examples:
This produces the following report:
This is pretty much what I want - to have the same 'Given' method run twice with different arguments and have that shown in the report.
If I now try to add examples:
Then I get the following report:
Not only is the report much less informative, but it also causes incorrect test behaviour;
Given_Mofichan_is_configured_with_the_following_behaviours
is only called once even ifRunStepWithArgs
is applied to it multiple times.