Features, Scenarios and Steps¶
Feature¶
- 
class 
aloe.parser.Feature¶ A complete Gherkin feature.
Features can either be constructed
from_file()orfrom_string().- 
description¶ The description of the feature (the text that comes directly under the feature).
- 
dialect¶ The Gherkin dialect for the feature.
- 
classmethod 
from_file(filename, language=None)¶ Parse a file or filename into a
Feature.
- 
classmethod 
from_string(string, language=None)¶ Parse a string into a
Feature.
- 
location¶ Location as ‘filename:line’
- 
classmethod 
parse(string=None, filename=None, language=None)¶ Parse either a string or a file.
Tags for a feature.
Tags are applied to a feature using the appropriate Gherkin syntax:
@tag1 @tag2 Feature: Eat leaves
- 
 
Background¶
Scenario¶
- 
class 
aloe.parser.Scenario¶ A scenario within a
Feature.- 
name¶ The name of this scenario.
- 
feature¶ The
Featurethis scenario belongs to.
- 
outlines¶ The examples for this scenario outline as a list of dicts mapping column name to value.
- 
location¶ Location as ‘filename:line’
- 
outlines_table¶ Return the scenario outline examples as a table.
Tags for the
featureand the scenario.
- 
 
Step¶
- 
class 
aloe.parser.Step¶ A single statement within a test.
A
ScenarioorBackgroundis composed of multipleStep.- 
scenario¶ The
Scenariothis step belongs to (if inside a scenario).
- 
background¶ The
Backgroundthis step belongs to (if inside a background).
- 
test¶ The instance of
unittest.TestCaserunning the current test, or None if not currently in a test (e.g. in aeach_feature()callback).
- 
testclass¶ The
unittest.TestCaseused to run this test. Usetestfor the instance of the test case.
- 
passed¶ The step passed (used in
afterandaround).
- 
failed¶ The step failed (used in
afterandaround).
- 
behave_as(sentence)¶ Execute another step.
Example:
self.behave_as("Given I am at the market")
- 
given(sentence)¶ Execute another step.
Example:
self.given("I am at the market")
- 
when(sentence)¶ Execute another step.
Example:
self.when("I buy two oranges")
- 
then(sentence)¶ Execute another step.
Example:
self.then("I will be charged 60c")
- 
container¶ The background or scenario that contains this step.
- 
feature¶ The
Featurethis step is a part of.
- 
hashes¶ Return the table attached to the step as an iterable of hashes, where the first row - the column headings - supplies keys for all the others.
e.g.:
Then I have fruit: | apples | oranges | | 0 | 2 |
Becomes:
({ 'apples': '0', 'oranges': '2', },)
- 
keys¶ Return the first row of a table if this statement contains one.
- 
location¶ Location as ‘filename:line’
- 
multiline= None¶ A Gherkin multiline string with the appropriate indenting removed.
Then I have poem: """ Glittering-Minded deathless Aphrodite, I beg you, Zeus’s daughter, weaver of snares, Don’t shatter my heart with fierce Pain, goddess, """
- 
outline= None¶ If this step is a part of an outline, the reference to the outline.
- 
parse_steps_from_string(string, **kwargs)¶ Parse a number of steps, returns an iterable of
Step.This is used by
step.behave_as().
- 
sentence= None¶ The sentence parsed for this step.
- 
table= None¶ A Gherkin table as an iterable of rows, themselves iterables of cells.
e.g.:
Then I have fruit: | apples | oranges | | 0 | 2 |
Becomes:
(('apples', 'oranges'), ('0', '2'))
-