Skip to content

Instantly share code, notes, and snippets.

@hltbra
Created August 26, 2010 02:39
Show Gist options
  • Save hltbra/550686 to your computer and use it in GitHub Desktop.
Save hltbra/550686 to your computer and use it in GitHub Desktop.
## shell
$ python manage.py harvest
Django's builtin server is running at 0.0.0.0:8000
Feature: WILLDO list # willdo/features/list_with_items.feature:1
In order to have a WILLDO list # willdo/features/list_with_items.feature:2
As a forgetful person # willdo/features/list_with_items.feature:3
I want to create lists to help me organize my work # willdo/features/list_with_items.feature:4
Scenario: Empty WILLDO list # willdo/features/list_with_items.feature:6
And I fill the following: # willdo/features/list_with_items.feature:9teps.py:15
| field_name | value | # willdo/features/step_definitions/willdo_steps.py:21
| description | my first list |
And I click "Save" # willdo/features/list_with_items.feature:12
Then I should see "my first list" with 0 items # willdo/features/list_with_items.feature:13
1 feature (0 passed)
1 scenario (0 passed)
5 steps (3 undefined, 2 passed)
You can implement step definitions for undefined steps with these snippets:
# -*- coding: utf-8 -*-
from lettuce import step
@step(u'And I fill the following:')
def and_i_fill_the_following(step):
assert False, 'This step must be implemented'
@step(u'And I click "(.*)"')
def and_i_click_group1(step, group1):
assert False, 'This step must be implemented'
@step(u'Then I should see "(.*)" with 0 items')
def then_i_should_see_group1_with_0_items(step, group1):
assert False, 'This step must be implemented'
## feature file
Feature: WILLDO list
In order to have a WILLDO list
As a forgetful person
I want to create lists to help me organize my work
Scenario: Empty WILLDO list
Given I am in the home page
When I click "New WILLDO list"
And I fill the following:
| field_name | value |
| description | my first list|
And I click "Save"
Then I should see "my first list" with 0 items
## step file
# -*- coding: utf-8 -*-
from lettuce import step, before, world
from django.core.urlresolvers import reverse
from django.test import Client
from should_dsl import should
@before.all
def create_django_client():
world.client = Client()
@step(u'Given I am in the home page')
def go_to_home_page(step):
response = world.client.get('/')
response.status_code |should| equal_to(200)
@step(u'When I click "New WILLDO list"')
def new_willdo(step):
response = world.client.get(reverse('new-willdo'))
@step(u'And I fill "(.*)" with "(.*)"')
def fill_field(step, field, value):
assert False, 'This step must be implemented'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment