Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lettuce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
lettuce
Commits
65daa975
Commit
65daa975
authored
May 23, 2010
by
Gabriel Falcão
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
starting to refactor the documentation
parent
56674ecc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
62 deletions
+101
-62
docs/_static/djangodocs.css
+1
-3
docs/_templates/layout.html
+1
-7
docs/index.rst
+3
-3
docs/tutorial/scenario-outlines.rst
+49
-0
docs/tutorial/simple.rst
+0
-46
docs/tutorial/tables.rst
+47
-3
No files found.
docs/_static/djangodocs.css
View file @
65daa975
...
@@ -86,10 +86,8 @@ em { font-style: italic}
...
@@ -86,10 +86,8 @@ em { font-style: italic}
ins
{
font-weight
:
bold
;
text-decoration
:
none
}
ins
{
font-weight
:
bold
;
text-decoration
:
none
}
/*** lists ***/
/*** lists ***/
ul
{
padding-left
:
30px
}
ol
{
padding-left
:
30px
}
ol
.arabic
li
{
list-style-type
:
decimal
}
ol
.arabic
li
{
list-style-type
:
decimal
}
ul
li
{
list-style-type
:
squar
e
;
font-size
:
14px
}
ul
li
{
list-style-type
:
non
e
;
font-size
:
14px
}
ol
li
{
margin-bottom
:
.4em
}
ol
li
{
margin-bottom
:
.4em
}
ul
ul
{
padding-left
:
1.2em
}
ul
ul
{
padding-left
:
1.2em
}
ul
ul
ul
{
padding-left
:
1em
}
ul
ul
ul
{
padding-left
:
1em
}
...
...
docs/_templates/layout.html
View file @
65daa975
{% extends "!layout.html" %}
{% extends "!layout.html" %}
{% set script_files = script_files + [pathto("_static/jquery-1.4.2.min.js", 1)] %}
{%- macro secondnav() %}
{%- macro secondnav() %}
{%- if prev %}
{%- if prev %}
«
<a
href=
"{{ prev.link|e }}"
title=
"{{ prev.title|e }}"
>
previous
</a>
«
<a
href=
"{{ prev.link|e }}"
title=
"{{ prev.title|e }}"
>
previous
</a>
...
@@ -98,10 +98,4 @@ try {
...
@@ -98,10 +98,4 @@ try {
var
pageTracker
=
_gat
.
_getTracker
(
"UA-1277640-6"
);
var
pageTracker
=
_gat
.
_getTracker
(
"UA-1277640-6"
);
pageTracker
.
_trackPageview
();
pageTracker
.
_trackPageview
();
}
catch
(
err
)
{}
</script>
}
catch
(
err
)
{}
</script>
<script
type=
"text/javascript"
>
$
(
function
(){
});
</script>
{% endblock %}
{% endblock %}
docs/index.rst
View file @
65daa975
...
@@ -104,9 +104,9 @@ walkthrough
...
@@ -104,9 +104,9 @@ walkthrough
**tutorials**
**tutorials**
* :ref:`writ
ting
your first feature <tutorial-simple>`
* :ref:`writ
e
your first feature <tutorial-simple>`
* :ref:`
steps
with tables <tutorial-tables>`
* :ref:`
handling data
with tables <tutorial-tables>`
* :ref:`s
cenario O
utlines <tutorial-scenario-outlines>`
* :ref:`s
ay "no" to repetition, meet scenario o
utlines <tutorial-scenario-outlines>`
* :ref:`taking actions before and after tests <tutorial-hooks>`
* :ref:`taking actions before and after tests <tutorial-hooks>`
furthermore
furthermore
...
...
docs/tutorial/scenario-outlines.rst
View file @
65daa975
...
@@ -3,3 +3,52 @@
...
@@ -3,3 +3,52 @@
=================
=================
Scenario Outlines
Scenario Outlines
=================
=================
On our :ref:`first description file<tutorial-simple>`, `zero.feature`, all scenarios were
similar. This made us repeat most of the text again and again.
**Isn't there a better way to deal with this - when several scenarios are almost equal and only some values change?**
Yes, there is! :) You just need to use scenarios outlines.
An example is shown bellow:
.. highlight:: ruby
::
Feature: Compute factorial
In order to play with Lettuce
As beginners
We'll implement factorial
Scenario Outline: Factorials [0-4]
Given I have the number <number>
When I compute its factorial
Then I see the number <result>
Examples:
| number | result |
| 0 | 1 |
| 1 | 1 |
| 2 | 2 |
| 3 | 6 |
| 4 | 24 |
This way, you will only need to provide the values that really change,
reducing "copy & paste" work and making your tests more clear.
.. Note::
If you overwrite zero.feature using the example above, and goto
step [e], you'll see your description expanding to the five
previous scenarious:
.. image:: ./screenshot7.png
.. _Lettuce: http://lettuce.it
.. _Python: http://python.org
.. _Cucumber: http://cukes.info
.. _Ruby: http://ruby-lang.org/
.. _BDD: http://en.wikipedia.org/wiki/Behavior_Driven_Development
docs/tutorial/simple.rst
View file @
65daa975
...
@@ -411,52 +411,6 @@ quality of your software depends on these.
...
@@ -411,52 +411,6 @@ quality of your software depends on these.
Have a nice lettuce...! ;)
Have a nice lettuce...! ;)
Tips for describing similar features
====================================
On our first description file, `zero.feature`, all scenarios were
similar. This made us repeat most of the text again and again.
**Isn't there a better way to deal with this - when several scenarios are almost equal and only some values change?**
Yes, there is! :) You just need to use scenarios outlines.
An example is shown bellow:
.. highlight:: ruby
::
Feature: Compute factorial
In order to play with Lettuce
As beginners
We'll implement factorial
Scenario Outline: Factorials [0-4]
Given I have the number <number>
When I compute its factorial
Then I see the number <result>
Examples:
| number | result |
| 0 | 1 |
| 1 | 1 |
| 2 | 2 |
| 3 | 6 |
| 4 | 24 |
This way, you will only need to provide the values that really change,
reducing "copy & paste" work and making your tests more clear.
.. Note::
If you overwrite zero.feature using the example above, and goto
step [e], you'll see your description expanding to the five
previous scenarious:
.. image:: ./screenshot7.png
.. _Lettuce: http://lettuce.it
.. _Lettuce: http://lettuce.it
.. _Python: http://python.org
.. _Python: http://python.org
.. _Cucumber: http://cukes.info
.. _Cucumber: http://cukes.info
...
...
docs/tutorial/tables.rst
View file @
65daa975
.. _tutorial-tables:
.. _tutorial-tables:
======
Handling data with tables
Tables
=========================
======
Let us put that you are writting a MVC application. Along the tests
you will stumble in a kind of situation in which there is a few models
that must be added to the database. Maybe you will also need to check
the new state of those.
It means that as you write tests with lettuce, it can be very useful
to handle data within steps.
Step tables are here for you:
.. highlight:: ruby
::
Feature: bill students alphabetically
In order to bill students properly
As a finantial specialist
I want to bill those which name starts with some letter
Scenario: Bill students which name starts with "G"
Given I have the following students in my database:
| name | monthly due | billed |
| Anton | $ 500 | no |
| Jack | $ 400 | no |
| John | $ 540 | no |
| Garrick | $ 438.11 | no |
| Gabriel | $ 300 | no |
| Gloria | $ 442.65 | no |
| Gaye | $ 630.22 | no |
| Ken | $ 907.86 | no |
| Leonard | $ 742.84 | no |
When I bill names starting with "G"
Then I see those billed students:
| Garrick | $ 438.11 | yes |
| Gabriel | $ 300 | yes |
| Gloria | $ 442.65 | yes |
| Gaye | $ 630.22 | yes |
And those that weren't:
| Anton | $ 500 | no |
| Jack | $ 400 | no |
| John | $ 540 | no |
| Ken | $ 907.86 | no |
| Leonard | $ 742.84 | no |
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment