Behaviour-driven development is a very good approach for maintaining
the workflow plain, so you only spend time with what really matters:
...
...
@@ -31,8 +32,9 @@ outside-in testing development. With this approach you can build your
software starting with the most external layer, and go deeper until
reach unitary tests.
*******************
Introducing Lettuce
===================
*******************
Lettuce is a very simple BDD tool based on the Cucumber, which
currently has many more features than Lettuce.
...
...
@@ -40,16 +42,18 @@ currently has many more features than Lettuce.
Lettuce aims the most common tasks on BDD and it focus specially on
those that make BDD so fun :)
**************
Lettuce pragma
==============
**************
Provide to the developers the ability of describing :ref:`features <intro-wtf>` in a natural language, by creating one or more scenarios
Each scenario has one possible behaviour of the feature you want to implement.
To make the scenarios run python code, it is necessary to define :ref:`steps <reference-features>`.
*********
Hands on!
=========
*********
This documentation will drive you through all the Lettuce features.
When you feel a bit comfortable, go to the :ref:`first part of the tutorial <tutorial-simple>`, or go further on the :ref:`reference <reference-features>`.
Our tests should be as expressive as possible. However, we also want to re-use steps that we've seen before. With the tools we've used so far, you could end up with seriously long step definitions.
...
...
@@ -39,9 +40,10 @@ Lettuce affords you the ability to write such a "step of steps" with a set of he
step.given('I go to the home page')
step.given('I click the login button')
# ... and so on.
***********************
running blocks of steps
-----------------------
***********************
It is sometimes even desirable to run blocks of steps, copy-and-pasted directly from Feature specifications. The ``Step.behave_as`` method lets you do this, and you can use ``str.format`` to fill in parameters dynamically. For example, we can write the above step definition like so: