Skip to content

Commit 6caf253

Browse files
Danielle Madeleykoterpillar
authored andcommitted
Remove duplicate info from README
1 parent 7244ae1 commit 6caf253

File tree

1 file changed

+7
-220
lines changed

1 file changed

+7
-220
lines changed

README.md

Lines changed: 7 additions & 220 deletions
Original file line numberDiff line numberDiff line change
@@ -4,228 +4,11 @@ Aloe
44
A [Gherkin][gherkin] runner for Python based on [Nose][nose] and
55
[Lettuce][lettuce].
66

7-
Quick start
8-
===========
7+
Install:
98

10-
Install: `pip install aloe`
9+
pip install aloe
1110

12-
In `features/calculator.feature`:
13-
14-
```gherkin
15-
Feature: Add up numbers
16-
17-
As a mathematically challenged user
18-
I want to add numbers
19-
So that I know the total
20-
21-
Scenario: Add two numbers
22-
Given I have entered 50 into the calculator
23-
And I have entered 30 into the calculator
24-
When I press add
25-
Then the result should be 80 on the screen
26-
```
27-
28-
Now run `aloe features/calculator.feature` and see it fail because there are no
29-
step definitions:
30-
31-
```
32-
$ aloe features/calculator.feature
33-
(...)
34-
aloe.exceptions.NoDefinitionFound: The step r"Given I have entered 50 into the
35-
calculator" is not defined
36-
37-
----------------------------------------------------------------------
38-
Ran 1 test in 0.001s
39-
40-
FAILED (errors=1)
41-
```
42-
43-
Now add the definitions in `features/steps.py`:
44-
45-
```python
46-
from aloe import before, step, world
47-
48-
49-
@before.each_example
50-
def clear(*args):
51-
"""Reset the calculator state before each scenario."""
52-
world.numbers = []
53-
world.result = 0
54-
55-
56-
@step(r'I have entered (\d+) into the calculator')
57-
def enter_number(self, number):
58-
world.numbers.append(float(number))
59-
60-
61-
@step(r'I press add')
62-
def press_add(self):
63-
world.result = sum(world.numbers)
64-
65-
66-
@step(r'The result should be (\d+) on the screen')
67-
def assert_result(self, result):
68-
assert world.result == float(result)
69-
```
70-
71-
This works:
72-
73-
```
74-
$ aloe features/calculator.feature
75-
(...)
76-
Ran 1 test in 0.001s
77-
78-
OK
79-
```
80-
81-
Features
82-
========
83-
84-
The standard [Gherkin syntax][gherkin-syntax] is supported, including scenario
85-
outlines, doc strings, data tables and internationalization.
86-
87-
Feature and scenario tags can be used and are converted to Nose tags, see
88-
[Attribute selector plugin][nose-plugin-attrib].
89-
90-
If features are not specified on the command line, Aloe will look for features
91-
in directories that:
92-
93-
* Are named `features`;
94-
* Are located in a directory containing packages, that is, all their parent
95-
directories have an `__init__.py` file.
96-
97-
For example, given the following directory structure, only `one`, `three` and
98-
`four` features will be run.
99-
100-
```
101-
one/
102-
__init__.py
103-
features/
104-
one.feature
105-
two/
106-
three.feature
107-
four.feature
108-
examples/
109-
five.feature
110-
two/
111-
features/
112-
six.feature
113-
```
114-
115-
Steps
116-
=====
117-
118-
Steps are defined in Python using the `step` decorator. The primary method for
119-
defining a step is using the `step` decorator:
120-
121-
```python
122-
from aloe import step
123-
124-
@step(r'The (\w+) is (\w+)')
125-
def has_color(self, thing, color):
126-
# ...
127-
```
128-
129-
### World
130-
131-
As a convenience, Aloe provides a `world` object that can be used to store
132-
information related to the test process. Typical usage includes storing the
133-
expected results between steps, or objects or functions that are useful for
134-
every step, such as an instance of a Selenium browser.
135-
136-
Aloe does not explicitly reset `world` between scenarios or features, so any
137-
clean-up must be done by the callbacks.
138-
139-
### Step loading
140-
141-
Steps can and should be defined in separate modules to the main application
142-
code. Aloe searches for modules to load steps from inside the `features`
143-
directories found.
144-
145-
### Step objects
146-
147-
Each step definition function receives the step object as the first argument.
148-
Step objects have the following properties:
149-
150-
* `sentence` - the sentence that invoked the step.
151-
* `hashes` - a list of hashes corresponding to the data table, where the first
152-
table row is assumed to be the keys.
153-
* `table` - the data table as a list of (ordered) lists.
154-
* `scenario` - the scenario containing this step. Not defined for steps that
155-
are part of a background.
156-
* `background` - the background containing this step. Not defined for steps
157-
that are part of a scenario.
158-
159-
Callbacks
160-
=========
161-
162-
Aloe provides a way to execute Python code on certain events when running
163-
Gherkin code. A callback can run before, after or wrap the particular event (as
164-
a context decorator).
165-
166-
### Callback events
167-
168-
* `each_step` - running a single step. The callback receives the step object as
169-
a sole argument.
170-
* `each_example` - running an example, that is, either a standalone scenario,
171-
or an example in a scenario outline.Note that this includes running the
172-
corresponding background. The callback receives the following arguments:
173-
- `scenario` - the scenario being run. In case of an example in a scenario
174-
outline, this is the scenario outline with all the example definitions
175-
filled in.
176-
- `outline` - a hash of parameters substituted in the scenario outline, or
177-
`None` if the scenario does not have examples.
178-
- `steps` - a list of steps in the scenario.
179-
* `each_feature` - running a single feature. Receives the feature object as a
180-
sole argument.
181-
* `all` - running the whole test suite (or only the features/scenarios
182-
specified for running). The callback receives no arguments.
183-
184-
Each callback can be executed before, after or around the event. The decorators
185-
above are available on `before`, `after` and `around` objects:
186-
187-
```python
188-
@before.all
189-
def before_all_callback():
190-
print("This will be executed once before running any features.")
191-
192-
193-
from contextlib import contextmanager
194-
@around.each_feature
195-
@contextmanager
196-
def around_feature_callback(feature):
197-
print("This will execute once before every feature.")
198-
yield
199-
print("This will execute once after every feature.")
200-
201-
202-
@after.each_step
203-
def after_step_callback(step):
204-
print("This will be executed once after each step runs.")
205-
```
206-
207-
The most specific callbacks run closer to the event than the least specific.
208-
That is, a "before feature" callback will run before a "before example"
209-
callback, but an "after example" callback will run after an "after step"
210-
callback. "Around" callbacks are wrapped similarly - the least specific ones
211-
will be entered into first and exited from last.
212-
213-
Between the same level of callbacks (e.g. feature callbacks), the order is as
214-
follows:
215-
216-
* Before
217-
* Around (entering part)
218-
* The actual event
219-
* Around (exit part)
220-
* After
221-
222-
An optional `priority` argument can be given to the decorators to establish
223-
priority between the same type and level of callbacks. Default priority is 0.
224-
Lower priority means farther from the event - a "before" callback with a
225-
priority of 1 will run later than a "before" callback with a zero priority,
226-
but an "after" callback with run earlier.
227-
228-
Order of running callbacks of the same type, level and priority is unspecified.
11+
Read the [documentation][docs].
22912

23013
Invocation
23114
==========
@@ -270,6 +53,9 @@ License
27053

27154
Aloe - Cucumber runner for Python based on Lettuce and Nose
27255
Copyright (C) <2015> Alexey Kotlyarov <a@koterpillar.com>
56+
Copyright (C) <2014-2015 Danielle Madeley <danielle@madeley.id.au>
57+
Copyright (C) <2010-2012> Gabriel Falcão <gabriel@nacaolivre.org>
58+
27359

27460
This program is free software: you can redistribute it and/or modify
27561
it under the terms of the GNU General Public License as published by
@@ -290,3 +76,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
29076
[lettuce]: http://lettuce.it/
29177
[gherkin-syntax]: https://cucumber.io/docs/reference
29278
[aloe-django]: https://github.com/koterpillar/aloe_django
79+
[docs]: http://aloe.readthedocs.org/en/latest/

0 commit comments

Comments
 (0)