You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BDDfy is the simplest BDD framework to use, customize and extend! The framework is explained on Mehdi Khalili's blog series in full details [here] (http://www.mehdi-khalili.com/bddify-in-action/introduction). This is a very short tutorial and quickstart.
2
-
3
-
To use BDDfy:
4
-
5
-
- Install NuGet if you have not already.
6
-
- Go to 'Tools', 'Library Package Manager', and click 'Package Manager Console'.
7
-
- In the console, type 'Install-Package TestStack.BDDfy' and enter.
8
-
9
-
This adds BDDfy assembly and its dependencies to your test project. If this is the first time you are using BDDfy you may want to check out the samples on NuGet. Just run Install-Package TestStack.BDDfy.Samples and it will load two fully working samples to your project.
1
+
BDDfy is the simplest BDD framework to use, customize and extend!
10
2
11
3
A few quick facts about BDDfy:
12
4
- It can run with any testing framework. Actually you don't have to use a testing framework at all. You can just apply it on your POCO (test) classes!
@@ -16,61 +8,64 @@ A few quick facts about BDDfy:
16
8
- You do not have to explain your scenarios or stories or steps in string, but you can if you need full control over what gets printed into console and HTML reports.
17
9
- BDDfy is very extensible: it's core barely has any logic in it and it delegates all it's responsibilities to it's extensions all of which are configurable; e.g. if you don't like the reports it generates, you can write your custom reporter in a few lines of code.
18
10
19
-
##Quick start
20
-
Now that you have installed BDDfy, write your first test (this test is borrowed from ATM sample that you can install using nuget packageTestStack.BDDfy.Samples):
11
+
##Usage
12
+
To use BDDfyinstall TestStack.BDDfy nuget package: `Install-Package TestStack.BDDfy`
21
13
22
-
[Story(
23
-
AsA = "As an Account Holder",
24
-
IWant = "I want to withdraw cash from an ATM",
25
-
SoThat = "So that I can get money when the bank is closed")]
26
-
public class AccountHasInsufficientFund
27
-
{
28
-
private Card _card;
29
-
private Atm _atm;
30
-
31
-
// You can override step text using executable attributes
32
-
[Given(StepText = "Given the account balance is $10")]
This adds BDDfy assembly and its dependencies to your test project. If this is the first time you are using BDDfy you may want to check out the samples on NuGet. Just run `Install-Package TestStack.BDDfy.Samples` and it will load two fully working samples to your project.
15
+
16
+
Now that you have installed BDDfy, write your first test (this test is borrowed from ATM sample that you can install using nuget package TestStack.BDDfy.Samples):
73
17
18
+
[Story(
19
+
AsA = "As an Account Holder",
20
+
IWant = "I want to withdraw cash from an ATM",
21
+
SoThat = "So that I can get money when the bank is closed")]
22
+
public class AccountHasInsufficientFund
23
+
{
24
+
private Card _card;
25
+
private Atm _atm;
26
+
27
+
// You can override step text using executable attributes
28
+
[Given(StepText = "Given the account balance is $10")]
@@ -91,7 +86,6 @@ This is just the console report. Have a look at your output folder and you shoul
91
86
92
87
If you want more control you can also use BDDfy's Fluent API. Here is another example done using the Fluent API:
93
88
94
-
95
89
[Test]
96
90
public void CardHasBeenDisabled()
97
91
{
@@ -110,41 +104,12 @@ which gives you a report like:
110
104
Then the ATM should retain the card
111
105
And the atm should say the card has been retained
112
106
107
+
## Authors
108
+
* Mehdi Khalili (@MehdiK)
109
+
* Michael Whelan (@mwhelan)
113
110
114
-
##How does BDDfy work?
115
-
BDDfy uses quite a few conventions to make it frictionless to use. For your convenience, I will try to provide a quick tutorial below:
116
-
117
-
###Finding steps
118
-
BDDfy scans your BDDfyed classes for steps. Currently it has three ways of finding a step:
119
-
120
-
* Using attributes
121
-
* Using method name conventions
122
-
* And using fluent API.
123
-
124
-
BDDfy runs your steps in the following order: SetupState, ConsecutiveSetupState, Transition, ConsecutiveTransition, Assertion, ConsecutiveAssertion and TearDown. Some of these steps are reported in the console and html reports and some of them are not. Please read below for further information.
125
-
126
-
###Attributes
127
-
BDDfy looks for a custom attribute called ExecutableAttribute on your method. To make it easier to use, ExecutableAttribute has a few subclasses that you can use: you may apply Given, AndGiven, When, AndWhen, Then, and AndThen attributes on any method you want to make available to BDDfy.
128
-
129
-
###Method name convention
130
-
BDDfy uses reflection to scan your classes for steps. In this mode, known as reflective mode, it has two ways of finding a step: using attributes and method name conventions. The following is the list of method name conventions:
131
-
132
-
* Method name ending with `Context` is considered a setup method but doesn't get shown in the reports
133
-
* Method name equaling `Setup` is a setup method but doesn't get showin in the reports
134
-
* Method name starting with `Given` is a setup step that gets reported in the reports
135
-
* Method name starting with `AndGiven` and 'And_given_' are considered setup steps running after 'Given' steps which is reported.
136
-
* Method name starting with `When` is considered a state transition step and is reported
137
-
* Method name starting with `AndWhen` and `And_when_` are considered state transition steps running after 'When' steps and is reported
138
-
* Method name starting with `Then` is an asserting step and is reported
139
-
* Method name starting with `And` and `AndThen` and `And_then_` are considered an asserting steps running after 'Then' step and is reported
140
-
* Method name starting with `TearDown` is considered as tear down method that is always run at the end but doesn't get shown in the reports.
141
-
142
-
As you see in the above example you can mix and match the executable attributes and method name conventions to acheive great flexibility and power.
143
-
144
-
###Fluent API
145
-
Fluent API gives you the absolute power over step selection and their titles. When you use Fluent API for a test, the attributes and method name conventions are ignored for that test.
146
-
147
-
Please note that you can have some tests using fluent API and some using a combination of attributes and method name conventions. Each .BDDfy() test works in isolation of others.
111
+
## Documentation
112
+
BDDfy is part of [TestStack](http://teststack.net/) organization. You might see full documentation of BDDfy on the [TestStack documentation website](http://docs.teststack.net/bddfy/index.html).
148
113
149
-
###Other conventions
150
-
BDDfy prefers convention over configuration; but it also allows you to configure pretty much all the conventions.
114
+
##License
115
+
BDDfy is released under the MIT License. See the bundled license.txt file for details.
0 commit comments