Commit 64999d1f by Chris Morgan

Docs: assorted spelling and grammar fixes.

Also done a fair bit of making sentences start with a capital letter. But I haven't touched headings at present.
parent 2a0a9e26
...@@ -6,7 +6,7 @@ Web development fun with Lettuce and Django ...@@ -6,7 +6,7 @@ Web development fun with Lettuce and Django
Django_ is a awesome web framework, very mature, aims for simplicity Django_ is a awesome web framework, very mature, aims for simplicity
and the best of all: it's fun to use it. and the best of all: it's fun to use it.
To make it even more fun, lettuce has builtin support to Django. To make it even more fun, lettuce has built-in support for Django.
Getting started Getting started
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
...@@ -14,7 +14,7 @@ Getting started ...@@ -14,7 +14,7 @@ Getting started
1. install the lettuce django app 1. install the lettuce django app
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pick up any django project, and add ``lettuce.django`` in its Pick up any Django project, and add ``lettuce.django`` in its
``settings.py`` configuration file: ``settings.py`` configuration file:
:: ::
...@@ -30,13 +30,13 @@ pick up any django project, and add ``lettuce.django`` in its ...@@ -30,13 +30,13 @@ pick up any django project, and add ``lettuce.django`` in its
'lettuce.django', # this guy will do the job :) 'lettuce.django', # this guy will do the job :)
) )
considering the configuration above, let's say we want to write tests Considering the configuration above, let's say we want to write tests
to ``my_app`` django application. for the ``my_app`` django application.
2. create the feature directories 2. create the feature directories
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lettuce will look for a ``features`` folder inside every installed app: Lettuce will look for a ``features`` folder inside every installed app:
:: ::
...@@ -106,7 +106,7 @@ lettuce will look for a ``features`` folder inside every installed app: ...@@ -106,7 +106,7 @@ lettuce will look for a ``features`` folder inside every installed app:
4. run the tests 4. run the tests
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
once you install the ``lettuce.django`` app, the command ``harvest`` will be available: Once you install the ``lettuce.django`` app, the command ``harvest`` will be available:
.. highlight:: bash .. highlight:: bash
...@@ -117,10 +117,10 @@ once you install the ``lettuce.django`` app, the command ``harvest`` will be ava ...@@ -117,10 +117,10 @@ once you install the ``lettuce.django`` app, the command ``harvest`` will be ava
5. specifying feature files 5. specifying feature files
^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
the `harvest` command accepts a path to feature files, in order to run The `harvest` command accepts a path to feature files, in order to run
only the features you want. only the features you want.
example: Example:
.. highlight:: bash .. highlight:: bash
...@@ -131,8 +131,8 @@ example: ...@@ -131,8 +131,8 @@ example:
6. grab actual example code 6. grab actual example code
^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
In order to assure that lettuce integrate well with django, it have a In order to assure that lettuce integrate well with Django, it have a
set of integration tests, there are a actual django project running set of integration tests, there are a actual Django project running
with lettuce. with lettuce.
You can grab the code at the alfaces_ folder of lettuce git repository You can grab the code at the alfaces_ folder of lettuce git repository
...@@ -146,17 +146,17 @@ can user tools like twill_, selenium_, webdriver_ and windmill_ ...@@ -146,17 +146,17 @@ can user tools like twill_, selenium_, webdriver_ and windmill_
red-tape-less builtin server red-tape-less builtin server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lettuce cleverly runs the a instance of django builtin http server in Lettuce cleverly runs an instance of the built-in Django HTTP server in
background, it tries to bind the HTTP server at localhost:8000 but if the background. It tries to bind the HTTP server at ``localhost:8000``
the port is busy, it keeps trying to run in higher ports: 8001, 8002 but if the port is busy, it keeps trying to run in higher ports: 8001,
and so on until it reaches the max port number 65535 8002 and so on until it reaches the maximum port number 65535.
.. note:: .. note::
you can override the default starting port from "8000" to any other You can override the default starting port from "8000" to any other
port you want. port you want.
to do so, refer to "running the HTTP server in other port than To do so, refer to "running the HTTP server in other port than
8000" below. 8000" below.
So that you can use browser-based tools such as those listed above to So that you can use browser-based tools such as those listed above to
...@@ -164,16 +164,16 @@ access Django. ...@@ -164,16 +164,16 @@ access Django.
.. warning:: .. warning::
when running the http server, lettuce sets the environment When running the http server, lettuce sets the environment
variables SERVER_NAME and SERVER_PORT. It was brought for a GAE_ variables SERVER_NAME and SERVER_PORT. It was brought for a GAE_
issue. If it can possibly bring any errors, be warned. issue. If it can possibly bring any errors, be warned.
figure out django urls figure out django urls
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
As django http server can be running in any port within the range As the Django HTTP server can be running in any port within the range
8000 - 65535, it could be hard to figure out the correct URL for your 8000 - 65535, it could be hard to figure out the correct URL for your
project, right ? project, right?
Wrong! Wrong!
...@@ -196,7 +196,7 @@ Lettuce is here for you. Within your steps you can use the ...@@ -196,7 +196,7 @@ Lettuce is here for you. Within your steps you can use the
what does ``django_url`` do ?!? what does ``django_url`` do ?!?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It prepends a django-internal url with the HTTP server address. It prepends a Django-internal URL with the HTTP server address.
In other words, if lettuce binds the http server to localhost:9090 and In other words, if lettuce binds the http server to localhost:9090 and
you call ``django_url`` with ``"/admin/login"``: you call ``django_url`` with ``"/admin/login"``:
...@@ -208,7 +208,7 @@ you call ``django_url`` with ``"/admin/login"``: ...@@ -208,7 +208,7 @@ you call ``django_url`` with ``"/admin/login"``:
from lettuce.django import django_url from lettuce.django import django_url
django_url("/admin/login") django_url("/admin/login")
it returns: It returns:
.. highlight:: python .. highlight:: python
...@@ -219,13 +219,13 @@ it returns: ...@@ -219,13 +219,13 @@ it returns:
terrain also available in django projects terrain also available in django projects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at this point you probably know how :ref:`terrain-py` works, and it At this point you probably know how :ref:`terrain-py` works, and it
also works with django projects. also works with Django projects.
you can setup environment and stuff like that within a ``terrain.py`` You can setup environment and stuff like that within a ``terrain.py``
file located at the root of your django project. file located at the root of your Django project.
taking the very first example of this documentation page, your django Taking the very first example of this documentation page, your Django
project layout would like like this: project layout would like like this:
:: ::
...@@ -249,18 +249,18 @@ project layout would like like this: ...@@ -249,18 +249,18 @@ project layout would like like this:
- second.feature - second.feature
- many_steps.py - many_steps.py
notice the ``terrain.py`` file at the project root, there you can Notice the ``terrain.py`` file at the project root, there you can
populate the :ref:`lettuce-world` and organize your features and steps populate the :ref:`lettuce-world` and organize your features and steps
with it :) with it :)
running without HTTP server Running without HTTP server
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
sometimes you may just do not want to run Django's builtin HTTP server Sometimes you may just do not want to run Django's built-in HTTP server
running in background, in those cases all you need to do is run the running in background, in those cases all you need to do is run the
`harvest` command with the `--no-server` or `-S` option. `harvest` command with the `--no-server` or `-S` option.
example: Example:
.. highlight:: bash .. highlight:: bash
...@@ -272,12 +272,12 @@ example: ...@@ -272,12 +272,12 @@ example:
running the HTTP server in other port than 8000 running the HTTP server in other port than 8000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if you face the problem of having lettuce running on port 8000, you If you face the problem of having lettuce running on port 8000, you
can change that behaviour. can change that behaviour.
Before running the server, lettuce will try to read the setting `LETTUCE_SERVER_PORT` which **must** be a **integer** Before running the server, lettuce will try to read the setting `LETTUCE_SERVER_PORT` which **must** be a **integer**
example: Example:
.. highlight:: python .. highlight:: python
...@@ -308,11 +308,11 @@ For those cases lettuce provides the `--debug-mode` or `-d` option. ...@@ -308,11 +308,11 @@ For those cases lettuce provides the `--debug-mode` or `-d` option.
running only the specified scenarios running only the specified scenarios
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
you can also specify the index of the scenarios you want to run You can also specify the index of the scenarios you want to run
through the command line, to do so, run with `--scenarios` or `-s` through the command line, to do so, run with `--scenarios` or `-s`
options followed by the scenario numbers separated by commas. options followed by the scenario numbers separated by commas.
for example, let's say you want to run the scenarios 4, 7, 8 and 10: For example, let's say you want to run the scenarios 4, 7, 8 and 10:
.. highlight:: bash .. highlight:: bash
...@@ -321,8 +321,8 @@ for example, let's say you want to run the scenarios 4, 7, 8 and 10: ...@@ -321,8 +321,8 @@ for example, let's say you want to run the scenarios 4, 7, 8 and 10:
python manage.py harvest --scenarios=4,7,8,10 python manage.py harvest --scenarios=4,7,8,10
python manage.py harvest -s 4,7,8,10 python manage.py harvest -s 4,7,8,10
to run or not to run ? That is the question ! to run or not to run? That is the question!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
During your development workflow you may face two situations: During your development workflow you may face two situations:
...@@ -343,7 +343,7 @@ For example, the command below would run ONLY the tests within the apps `myapp` ...@@ -343,7 +343,7 @@ For example, the command below would run ONLY the tests within the apps `myapp`
python manage.py harvest --a myapp,foobar python manage.py harvest --a myapp,foobar
you can also specify it at `settings.py` so that you won't need to type the same command-line parameters all the time: You can also specify it at `settings.py` so that you won't need to type the same command-line parameters all the time:
.. highlight:: python .. highlight:: python
...@@ -376,7 +376,7 @@ For example, the command below would run ALL the tests BUT those within the apps ...@@ -376,7 +376,7 @@ For example, the command below would run ALL the tests BUT those within the apps
python manage.py harvest --avoid-apps=another_app,foobar python manage.py harvest --avoid-apps=another_app,foobar
you can also specify it at `settings.py` so that you won't need to type the same command-line parameters all the time: You can also specify it at `settings.py` so that you won't need to type the same command-line parameters all the time:
.. highlight:: python .. highlight:: python
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
Lettuce recipe: Using nose for pretty assertions Lettuce recipe: Using nose for pretty assertions
================================================ ================================================
lettuce uses python's builtin exception :exc:`AssertionError` to mark Lettuce uses python's builtin exception :exc:`AssertionError` to mark
tests as failed. tests as failed.
although in order to describe the assertion with a custom string you Although in order to describe the assertion with a custom string you
would need to do something like: would need to do something like:
.. highlight:: python .. highlight:: python
...@@ -25,7 +25,7 @@ already have a nice description, and fortunately it still uses ...@@ -25,7 +25,7 @@ already have a nice description, and fortunately it still uses
:exc:`AssertionError`, which makes nose_ totally compliant with :exc:`AssertionError`, which makes nose_ totally compliant with
lettuce. lettuce.
the example below shows how the step above could be written taking advantage of nose_: The example below shows how the step above could be written taking advantage of nose_:
.. highlight:: python .. highlight:: python
...@@ -38,6 +38,6 @@ the example below shows how the step above could be written taking advantage of ...@@ -38,6 +38,6 @@ the example below shows how the step above could be written taking advantage of
def some_step(step, from): def some_step(step, from):
assert_equals(from, 'expectation') assert_equals(from, 'expectation')
it rocks, huh?! It rocks, huh?!
.. _nose: http://code.google.com/p/python-nose/ .. _nose: http://code.google.com/p/python-nose/
...@@ -10,12 +10,12 @@ Once in a shell, you can use lettuce in 2 ways: ...@@ -10,12 +10,12 @@ Once in a shell, you can use lettuce in 2 ways:
* in the :ref:`usual way <tutorial-simple>` * in the :ref:`usual way <tutorial-simple>`
which means having the simple features/step_definitions folder Which means having the simple features/step_definitions folder
somewhere in your project somewhere in your project
* within a :ref:`django-powered <recipes-django-lxml>` project. * within a :ref:`Django-powered <recipes-django-lxml>` project.
the difference between them is that within Django you have more The difference between them is that within Django you have more
options, but both ways have these common options: options, but both ways have these common options:
running a specific feature file running a specific feature file
...@@ -28,7 +28,7 @@ running a specific feature file ...@@ -28,7 +28,7 @@ running a specific feature file
user@machine:~/projects/myproj$ lettuce path/to/some/file.feature user@machine:~/projects/myproj$ lettuce path/to/some/file.feature
with this option, your feature can even be out of the default ***features*** folder With this option, your feature can even be out of the default ***features*** folder.
running only some scenarios of a specific feature file running only some scenarios of a specific feature file
------------------------------------------------------ ------------------------------------------------------
...@@ -40,7 +40,7 @@ running only some scenarios of a specific feature file ...@@ -40,7 +40,7 @@ running only some scenarios of a specific feature file
user@machine:~/projects/myproj$ lettuce path/to/some/file.feature -s 3,5,9 user@machine:~/projects/myproj$ lettuce path/to/some/file.feature -s 3,5,9
this will run the scenarios 3, 5 and 9 from file ***path/to/some/file.feature*** This will run the scenarios 3, 5 and 9 from file ***path/to/some/file.feature***
running only some scenarios all feature files running only some scenarios all feature files
--------------------------------------------- ---------------------------------------------
...@@ -53,9 +53,9 @@ Maybe you can find it senseless, but it works like that, and does not hurt so fa ...@@ -53,9 +53,9 @@ Maybe you can find it senseless, but it works like that, and does not hurt so fa
user@machine:~/projects/myproj$ lettuce -s 3,5,9 user@machine:~/projects/myproj$ lettuce -s 3,5,9
Yeah, guess what ? Yeah, guess what?
This command will run the scenarios 3, 5 and 9 of all feature files living on ***myproj/features*** folder This command will run the scenarios 3, 5 and 9 of all feature files living on ***myproj/features*** folder.
verbosity levels verbosity levels
---------------- ----------------
...@@ -71,9 +71,9 @@ level 1 - dots for each feature ...@@ -71,9 +71,9 @@ level 1 - dots for each feature
user@machine:~/projects/myproj$ lettuce --verbosity=1 user@machine:~/projects/myproj$ lettuce --verbosity=1
This is lettuce's minimum verbosity level. It shows dots for each step This is lettuce's minimum verbosity level. It shows dots for each step
run, regardless of what scenario or what feature is currently running run, regardless of what scenario or what feature is currently running.
for example, if you have a feature that looks like: For example, if you have a feature that looks like:
.. highlight:: ruby .. highlight:: ruby
...@@ -86,7 +86,7 @@ for example, if you have a feature that looks like: ...@@ -86,7 +86,7 @@ for example, if you have a feature that looks like:
Then I see the string is "LETTUCE LEAVES" Then I see the string is "LETTUCE LEAVES"
the output will be The output will be:
.. highlight:: bash .. highlight:: bash
...@@ -111,7 +111,7 @@ level 2 - scenario names ...@@ -111,7 +111,7 @@ level 2 - scenario names
In this mode, lettuce will print each scenario name that is currently being ran, followed by **OK**, **FAILED** or **ERROR** In this mode, lettuce will print each scenario name that is currently being ran, followed by **OK**, **FAILED** or **ERROR**
depending of the status of the steps within that scenario. depending of the status of the steps within that scenario.
for example, if you have a feature that looks like: For example, if you have a feature that looks like:
.. highlight:: ruby .. highlight:: ruby
...@@ -127,7 +127,7 @@ for example, if you have a feature that looks like: ...@@ -127,7 +127,7 @@ for example, if you have a feature that looks like:
Given I sum 2 and 5 Given I sum 2 and 5
Then I see the result is 9 Then I see the result is 9
the output will be The output will be:
.. highlight:: bash .. highlight:: bash
...@@ -151,14 +151,14 @@ level 3 - full feature print, but colorless ...@@ -151,14 +151,14 @@ level 3 - full feature print, but colorless
user@machine:~/projects/myproj$ lettuce --verbosity=3 user@machine:~/projects/myproj$ lettuce --verbosity=3
This mode is a lot more verbose than the later one. This mode is a lot more verbose than the later one.
It prints every single feature, with really useful informations like: It prints every single feature, with really useful information like:
* the relative path to the feature file being ran, and the current line in that file * the relative path to the feature file being ran, and the current line in that file
* the relative path to the step definition responsible for the step being ran, also followed by the current line * the relative path to the step definition responsible for the step being ran, also followed by the current line
* inline tracebacks when some feature fails * inline tracebacks when some feature fails
* "ready-to-use" snippets for undefined steps * "ready-to-use" snippets for undefined steps
for example, let's say you have the feature below, but only the step For example, let's say you have the feature below, but only the step
***Given I have the string "lettuce leaves"*** is defined ***Given I have the string "lettuce leaves"*** is defined
.. highlight:: ruby .. highlight:: ruby
...@@ -171,7 +171,7 @@ for example, let's say you have the feature below, but only the step ...@@ -171,7 +171,7 @@ for example, let's say you have the feature below, but only the step
When I put it in upper case When I put it in upper case
Then I see the string is "LETTUCE LEAVES" Then I see the string is "LETTUCE LEAVES"
your output will look like: Your output will look like:
.. highlight:: bash .. highlight:: bash
...@@ -205,8 +205,8 @@ your output will look like: ...@@ -205,8 +205,8 @@ your output will look like:
level 4 - full feature print, but colorful level 4 - full feature print, but colorful
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
this mode is almost **exactly** the same of level 3, the difference is This mode is almost **exactly** the same of level 3, the difference is
that it's colorful that it's colorful.
.. image:: ../tutorial/screenshot6.png .. image:: ../tutorial/screenshot6.png
...@@ -215,7 +215,7 @@ that it's colorful ...@@ -215,7 +215,7 @@ that it's colorful
If you are going to put lettuce running in a If you are going to put lettuce running in a
Continuous-Integration_ server, like Hudson_. You may choose the Continuous-Integration_ server, like Hudson_. You may choose the
levels 1, 2 or 3, so that the output won't look messy levels 1, 2 or 3, so that the output won't look messy.
getting help from shell getting help from shell
----------------------- -----------------------
...@@ -227,7 +227,7 @@ getting help from shell ...@@ -227,7 +227,7 @@ getting help from shell
user@machine:~/projects/myproj$ lettuce -h user@machine:~/projects/myproj$ lettuce -h
shows all the options described here Shows all the options described here.
.. _Continuous-Integration: http://www.martinfowler.com/articles/continuousIntegration.html .. _Continuous-Integration: http://www.martinfowler.com/articles/continuousIntegration.html
.. _Hudson: http://hudson-ci.org/ .. _Hudson: http://hudson-ci.org/
...@@ -38,7 +38,7 @@ Feature ...@@ -38,7 +38,7 @@ Feature
Feature.name Feature.name
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
a string containing the name of the feature A string containing the name of the feature
.. highlight:: python .. highlight:: python
...@@ -49,9 +49,9 @@ a string containing the name of the feature ...@@ -49,9 +49,9 @@ a string containing the name of the feature
Feature.scenarios Feature.scenarios
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
a list of scenario objects A list of scenario objects
the attribute `scenarios` could be used as follows The attribute `scenarios` could be used as follows
.. highlight:: python .. highlight:: python
...@@ -62,11 +62,11 @@ the attribute `scenarios` could be used as follows ...@@ -62,11 +62,11 @@ the attribute `scenarios` could be used as follows
Feature.described_at Feature.described_at
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
a FeatureDescription object, has the file and line which the feature A FeatureDescription object, has the file and line which the feature
was described. Lettuce uses it to output those metadata. was described. Lettuce uses it to output those metadata.
the attribute `described_at` could be used as follows The attribute `described_at` could be used as follows
:: ::
...@@ -82,13 +82,13 @@ the attribute `described_at` could be used as follows ...@@ -82,13 +82,13 @@ the attribute `described_at` could be used as follows
Feature.max_length Feature.max_length
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
A property that calculates the max length of all lines that built the A property that calculates the maximum length of all lines that built
feature. the feature.
Mostly used by shell output to find out where to print the feature Mostly used by shell output to find out where to print the feature
description. description.
example: Example:
:: ::
...@@ -97,16 +97,16 @@ example: ...@@ -97,16 +97,16 @@ example:
Feature.get_head Feature.get_head
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
does represent the feature with its first representation in current Does represent the feature with its first representation in current
language followed by a colon and the feature name. language followed by a colon and the feature name.
example: Example:
:: ::
feature.get_head() == 'Feature: some feature' feature.get_head() == 'Feature: some feature'
but if the same feature would written in brazillian portuguese, for example: But if the same feature would written in Brazilian Portuguese, for example:
.. highlight:: ruby .. highlight:: ruby
...@@ -124,7 +124,7 @@ but if the same feature would written in brazillian portuguese, for example: ...@@ -124,7 +124,7 @@ but if the same feature would written in brazillian portuguese, for example:
Cenário: ... Cenário: ...
... ...
then, `Feature.get_head()` would give: Then, `Feature.get_head()` would give:
:: ::
...@@ -137,32 +137,32 @@ TotalResult ...@@ -137,32 +137,32 @@ TotalResult
TotalResult.features_ran TotalResult.features_ran
^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
integer, the total of features ran Integer, the total of features ran
TotalResult.features_passed TotalResult.features_passed
^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
integer, the total of features passed Integer, the total of features passed
TotalResult.scenarios_ran TotalResult.scenarios_ran
^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^
integer, the total of scenarios ran Integer, the total of scenarios ran
TotalResult.scenarios_passed TotalResult.scenarios_passed
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
integer, the total of scenarios passed Integer, the total of scenarios passed
TotalResult.steps TotalResult.steps
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
integer, the number of steps that were supposed to run Integer, the number of steps that were supposed to run
TotalResult.proposed_definitions TotalResult.proposed_definitions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
a list of :ref:`step-class` that have no :ref:`step-definition` A list of :ref:`step-class` that have no :ref:`step-definition`
.. _scenario-class: .. _scenario-class:
Scenario Scenario
...@@ -171,9 +171,9 @@ Scenario ...@@ -171,9 +171,9 @@ Scenario
Scenario.steps Scenario.steps
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
a list of scenario objects A list of scenario objects
the attribute `scenarios` could be used as follows The attribute `scenarios` could be used as follows
.. highlight:: python .. highlight:: python
...@@ -188,7 +188,7 @@ Step ...@@ -188,7 +188,7 @@ Step
Step.sentence Step.sentence
^^^^^^^^^^^^^ ^^^^^^^^^^^^^
the string that represents the step The string that represents the step
.. highlight:: python .. highlight:: python
...@@ -200,7 +200,7 @@ the string that represents the step ...@@ -200,7 +200,7 @@ the string that represents the step
step definition step definition
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
a decorator that can be used on any python function, takes a regex string as parameter, so that the function can me matched against steps. A decorator that can be used on any python function, takes a regex string as parameter, so that the function can me matched against steps.
.. highlight:: python .. highlight:: python
......
...@@ -5,16 +5,16 @@ language support ...@@ -5,16 +5,16 @@ language support
Lettuce currently supports two languages: Lettuce currently supports two languages:
* english * English
* portuguese (brazillian) * Portuguese (Brazilian)
Althrough it's only about writting tests since the current version Although it's only about writing tests since the current version
does output only in english. does output only in English.
writting features in a specific language writing features in a specific language
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
you can tell lettuce the language of a feature file through adding a comment in the first line of the file, using the following syntax: You can tell lettuce the language of a feature file through adding a comment in the first line of the file, using the following syntax:
.. highlight:: python .. highlight:: python
...@@ -35,8 +35,8 @@ english example ...@@ -35,8 +35,8 @@ english example
Given I write a file which starts with "# language: en" Given I write a file which starts with "# language: en"
Then it must be parsed with proper english keywords Then it must be parsed with proper english keywords
brazillian portuguese example brazilian portuguese example
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. highlight:: ruby .. highlight:: ruby
...@@ -51,15 +51,15 @@ brazillian portuguese example ...@@ -51,15 +51,15 @@ brazillian portuguese example
adding support to other languages adding support to other languages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
we love contribution, so if you want to bring lettuce to your native We love contribution, so if you want to bring lettuce to your native
language there is a single and simple way. language there is a single and simple way.
fetch the code fetch the code
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
first of all, you must have git_ control version installed in your machine. First of all, you must have git_ control version installed in your machine.
once you have it installed, grab the code with Once you have it installed, grab the code with
.. highlight:: bash .. highlight:: bash
...@@ -67,13 +67,13 @@ once you have it installed, grab the code with ...@@ -67,13 +67,13 @@ once you have it installed, grab the code with
user@machine:~$ git clone git://github.com/gabrielfalcao/lettuce.git user@machine:~$ git clone git://github.com/gabrielfalcao/lettuce.git
and edit the file located at:: And edit the file located at::
lettuce/languages.py lettuce/languages.py
and add a new dictionary entry for your native language. And add a new dictionary entry for your native language.
let's see the brazillian portuguese translation to exemplify Let's see the Brazilian Portuguese translation to exemplify.
.. highlight:: python .. highlight:: python
...@@ -91,25 +91,25 @@ let's see the brazillian portuguese translation to exemplify ...@@ -91,25 +91,25 @@ let's see the brazillian portuguese translation to exemplify
}, },
} }
the key of the dict will be used as identifier for the comment The key of the dict will be used as identifier for the comment
``# language: identifier`` at feature files. ``# language: identifier`` at feature files.
the value must be a dict, where the keys are canonical representation The value must be a dict, where the keys are canonical representation
of keywords (string), and the values must be a pipe-separated string of keywords (string), and the values must be a pipe-separated string
with translation possibilities. with translation possibilities.
it allows different translations for the same keyword in the current It allows different translations for the same keyword in the current
language, which offers many possibilities for different semantical language, which offers many possibilities for different semantical
cases. cases.
for example, when using scenario outlines, it can be semantically nicer to write:: For example, when using scenario outlines, it can be semantically nicer to write::
Scenarios: Scenarios:
| name | age | | name | age |
| John | 22 | | John | 22 |
| Mary | 53 | | Mary | 53 |
instead of:: Instead of::
Examples: Examples:
| name | age | | name | age |
...@@ -119,9 +119,9 @@ instead of:: ...@@ -119,9 +119,9 @@ instead of::
add your translation add your translation
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
now you can add your own language to lettuce, save the ``languages.py`` file and commit in the source control with. Now you can add your own language to lettuce, save the ``languages.py`` file and commit in the source control with.
for example, let's suppose that you've added spanish support: For example, let's suppose that you've added Spanish support:
.. highlight:: bash .. highlight:: bash
...@@ -129,13 +129,13 @@ for example, let's suppose that you've added spanish support: ...@@ -129,13 +129,13 @@ for example, let's suppose that you've added spanish support:
user@machine:~/lettuce$ git commit lettuce/languages.py -m 'adding translation for spanish' user@machine:~/lettuce$ git commit lettuce/languages.py -m 'adding translation for spanish'
generate a patch: Generate a patch:
:: ::
user@machine:~/lettuce$ git format patch HEAD^1 user@machine:~/lettuce$ git format patch HEAD^1
and send to lettuce's ticket_ tracker as a gist_ or something like it. And send to lettuce's ticket_ tracker as a gist_ or something like it.
.. _git: http://git-scm.com/ .. _git: http://git-scm.com/
......
...@@ -6,9 +6,9 @@ awesome tool for testing websites. ...@@ -6,9 +6,9 @@ awesome tool for testing websites.
And as expected I am a hard user of Pyccuracy_, but since I met And as expected I am a hard user of Pyccuracy_, but since I met
Cucumber_, I fell in love for Scenario Outlines, global variables and Cucumber_, I fell in love for Scenario Outlines, global variables and
tables. Althrough, Pyccuracy_ does not aim to do the same that tables. Although Pyccuracy_ does not aim to do the same that Cucumber_
Cucumber_ does, sometimes it sucks, because Cucumber has very handy does, sometimes it sucks, because Cucumber has very handy features, that
features, that avoid code duplicity and so on. avoid code duplicity and so on.
Thus, Lettuce does not aim on website automated testing, Lettuce is a Thus, Lettuce does not aim on website automated testing, Lettuce is a
multi-purpose testing tool. multi-purpose testing tool.
......
...@@ -10,7 +10,7 @@ similar. This made us repeat most of the text again and again. ...@@ -10,7 +10,7 @@ similar. This made us repeat most of the text again and again.
Yes, there is! :) You just need to use scenarios outlines. Yes, there is! :) You just need to use scenarios outlines.
An example is shown bellow: An example is shown below:
.. highlight:: ruby .. highlight:: ruby
...@@ -41,7 +41,7 @@ reducing "copy & paste" work and making your tests more clear. ...@@ -41,7 +41,7 @@ reducing "copy & paste" work and making your tests more clear.
If you overwrite zero.feature using the example above, and goto If you overwrite zero.feature using the example above, and goto
step [e], you'll see your description expanding to the five step [e], you'll see your description expanding to the five
previous scenarious: previous scenarios:
.. image:: ./screenshot7.png .. image:: ./screenshot7.png
......
...@@ -17,7 +17,7 @@ Our tests should be as expressive as possible. However, we also want to re-use s ...@@ -17,7 +17,7 @@ Our tests should be as expressive as possible. However, we also want to re-use s
When I finally do something interesting When I finally do something interesting
Then I'm already too bored to care. Then I'm already too bored to care.
In this case, we probably had a test case (maybe several) for which it was actually valuable to express how the user interacted with the login form. That's where we got the step definitions for our login sequence. When the login form isn't especially interesting anymore, however, these steps are just noise. We'd really like to be able to define something like this without duplicating our step definitions. In this case, we probably had a test case (maybe several) for which it was actually valuable to express how the user interacted with the login form. That's where we got the step definitions for our login sequence. When the login form isn't especially interesting any more, however, these steps are just noise. We'd really like to be able to define something like this without duplicating our step definitions.
.. highlight:: ruby .. highlight:: ruby
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
handling data with tables handling data with tables
========================= =========================
Lets imagine writing a MVC application. While writing the tests Let's imagine writing a MVC application. While writing the tests
you will stumble in to a situation where there is a few models you will stumble in to a situation where there is a few models
that must be added to the database, maybe you will also need to check that must be added to the database, maybe you will also need to check
the new state of those models. the new state of those models.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment