Skip to content

Commit 2fe8cef

Browse files
committed
Merge pull request #24 from MehdiK/readme
removed some text from readme & pointed to the new docos website
2 parents c194ee3 + 92ca1f2 commit 2fe8cef

File tree

1 file changed

+65
-99
lines changed

1 file changed

+65
-99
lines changed

readme.md

Lines changed: 65 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
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!
102

113
A few quick facts about BDDfy:
124
- 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:
168
- 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.
179
- 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.
1810

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 package TestStack.BDDfy.Samples):
11+
## Usage
12+
To use BDDfy install TestStack.BDDfy nuget package: `Install-Package TestStack.BDDfy`
2113

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")]
33-
void GivenAccountHasEnoughBalance()
34-
{
35-
_card = new Card(true, 10);
36-
}
37-
38-
void AndGivenTheCardIsValid()
39-
{
40-
}
41-
42-
void AndGivenTheMachineContainsEnoughMoney()
43-
{
44-
_atm = new Atm(100);
45-
}
46-
47-
void WhenTheAccountHolderRequests20()
48-
{
49-
_atm.RequestMoney(_card, 20);
50-
}
51-
52-
void ThenTheAtmShouldNotDispenseAnyMoney()
53-
{
54-
Assert.AreEqual(0, _atm.DispenseValue);
55-
}
56-
57-
void AndTheAtmShouldSayThereAreInsufficientFunds()
58-
{
59-
Assert.AreEqual(DisplayMessage.InsufficientFunds, _atm.Message);
60-
}
61-
62-
void AndTheCardShouldBeReturned()
63-
{
64-
Assert.IsFalse(_atm.CardIsRetained);
65-
}
66-
67-
[Test]
68-
public void Execute()
69-
{
70-
this.BDDfy();
71-
}
72-
}
14+
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):
7317

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")]
29+
void GivenAccountHasEnoughBalance()
30+
{
31+
_card = new Card(true, 10);
32+
}
33+
34+
void AndGivenTheCardIsValid()
35+
{
36+
}
37+
38+
void AndGivenTheMachineContainsEnoughMoney()
39+
{
40+
_atm = new Atm(100);
41+
}
42+
43+
void WhenTheAccountHolderRequests20()
44+
{
45+
_atm.RequestMoney(_card, 20);
46+
}
47+
48+
void ThenTheAtmShouldNotDispenseAnyMoney()
49+
{
50+
Assert.AreEqual(0, _atm.DispenseValue);
51+
}
52+
53+
void AndTheAtmShouldSayThereAreInsufficientFunds()
54+
{
55+
Assert.AreEqual(DisplayMessage.InsufficientFunds, _atm.Message);
56+
}
57+
58+
void AndTheCardShouldBeReturned()
59+
{
60+
Assert.IsFalse(_atm.CardIsRetained);
61+
}
62+
63+
[Test]
64+
public void Execute()
65+
{
66+
this.BDDfy();
67+
}
68+
}
7469

7570
And this gives you a report like:
7671

@@ -91,7 +86,6 @@ This is just the console report. Have a look at your output folder and you shoul
9186

9287
If you want more control you can also use BDDfy's Fluent API. Here is another example done using the Fluent API:
9388

94-
9589
[Test]
9690
public void CardHasBeenDisabled()
9791
{
@@ -110,41 +104,13 @@ which gives you a report like:
110104
Then the ATM should retain the card
111105
And the atm should say the card has been retained
112106

107+
This is only the tip of iceberg. Absolutely everything you do with BDDfy is extensible and customizable.
108+
You might see full documentation of BDDfy on the [TestStack documentation website](http://docs.teststack.net/bddfy/index.html).
109+
Oh and while you are there don't forget to checkout other cool projects from [TestStack](http://teststack.net/).
113110

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+
## Authors
112+
* Mehdi Khalili (@MehdiK)
113+
* Michael Whelan (@mwhelan)
148114

149-
###Other conventions
150-
BDDfy prefers convention over configuration; but it also allows you to configure pretty much all the conventions.
115+
## License
116+
BDDfy is released under the MIT License. See the bundled license.txt file for details.

0 commit comments

Comments
 (0)