-
Notifications
You must be signed in to change notification settings - Fork 1
Lettuce
Documentation: http://lettuce.it
Description: Lettuce is a Behaviour-Driven Development (BDD) tool that integrates with Django. It allows you to write steps in plain English (so anyone can write them) and implement them in python.
Usage:
-
Execute all tests according to a settings file:
python manage.py harvest --settings=secondfunnel.settings_file -
Execute all tests that
lettucefindspython manage.py harvest- Note, this will likely find apps that we haven't written
lettuce expects all test outlines, and step definitions to be located within a features folder within your app.
Test outlines are contained within a FEATURE_NAME.feature file. This file is a plain text file that describes the feature, and a few scenarios testing that feature. For example:
Feature: Account functionality
In order to access the application
As a customer
I want to be able to access my account
Scenario: Logout
Given I login with username "nterwoord" and password "asdf"
When I click "Logout"
Then I see the "login" page
Test steps are contained within a FEATURE_NAME_steps.py file. This file converts the plain English steps into something that can be executed, and tested. For example:
from lettuce import step, world
from lettuce_webdriver.webdriver import *
@step(u'I login with username "(.*?)" and password "(.*?)"$')
def successful_login(step, user, password):
world.visit_page(step, "login")
fill_in_textfield(step, "username", user)
fill_in_textfield(step, "password", password)
press_button(step, "login")
If there are common steps between multiple features in an app, you can put these common steps in a terrain.py file, and they will only be used for that app. If you have steps that you want to be available across apps, they belong in a terrain.py file located in the root of the SecondFunnel folder.