<commit_before>Salad is a helpful mix of some great BDD packages like lettuce and splinter, seasoned with some common modules.  Its goal is to get rid of any excuses you had for not writing acceptance tests.


Installing
==========

1. Make a virtualenv.

1. `pip install salad`

1. There is no step 3. 


Installing with django
----------------------

Same as above. If you want lettuce-django integration, also add `lettuce.django` to your `INSTALLED_APPS`.


Usage
=====

Salad is mostly lettuce.
------------------------

Salad is mostly lettuce.  So, you should use [great documentation](http://lettuce.it/) with gusto.  If you're interacting with the browser, you're doing it through [splinter](http://splinter.cobrateam.info/docs/), and their docs are great as well.

Salad includes some steps and terrains
--------------------------------------

To make it even easier to test, salad includes a number of common steps and terrains you can import into your files and use.

For example, if you're writing a django app, you can:

my_app_steps.py

```python
from salad.steps.common import *
from salad.steps.django import *
```

and

my_app_terrain.py

```python
from salad.terrains.browser import *
from salad.terrains.django import *
```

and you're done.


Writing your first lettuce feature
----------------------------------

1. Create a "features" directory in your app.

    ```bash
    mkdir features
    ```

1. Inside the features directory, create a filename with `.feature` as its extension.

    ```bash
    touch our-website-is-up.feature
    ```

1. Write your first feature.

    ```gherkin
    Feature: Ensuring that Lettuce works, and W+K's website loads
    In order to make sure that lettuce works
    As a developer
    I open the Wieden+Kennedy website using lettuce

    Scenario: Opening the W+K website works
        Given I access the url "http://www.wk.com/"
        When I look around
        Then I should see "Wieden+Kennedy"
    ```

1. Inside the features directory, create a steps file for this feature.
    
    ```bash
    touch our-website-is-up-steps.py
    ```

1. In `our-website-is-up-steps.py`, import the `salad` libraries

    ```python
    from salad.steps.common import *
    ```

1. Also inside the features directory, create a terrain file, to be used for all features in the folder
    
    ```python
    from salad.terrains.common import *
    ```


That's it, you're ready to run the tests!


Running your first lettuce test
-------------------------------


In the directory above features (your project root), run:

```
lettuce
```

That should be it - you should see:

```
Feature: Ensuring that Lettuce works, and W+K's website loads # features/our-website-is-up.feature:1
  In order to make sure that lettuce works                    # features/our-website-is-up.feature:2
  As a developer                                              # features/our-website-is-up.feature:3
  I open the Wieden+Kennedy website using lettuce             # features/our-website-is-up.feature:4

  Scenario: Opening the W+K website works                     # features/our-website-is-up.feature:6
    Given I access the url "http://www.wk.com/"               # features/our-website-is-up-steps.py:8
    When I look around                                        # features/our-website-is-up-steps.py:80
    Then I should see "Wieden+Kennedy"                        # features/our-website-is-up-steps.py:37

1 feature (1 passed)
1 scenario (1 passed)
3 steps (3 passed)
```


Keeping tests organized
-----------------------

As you've noticed above, we use the convention of naming the steps file the same as the feature file, with `-steps` appended.  It's worked well so far. For django apps, it's easiest to keep the features for each app within the app structure.

We're still early in using lettuce on larger projects, and as better advice comes out, we'll be happy to share it.  If you have advice, type it up in a pull request, or open an issue!


Django and South
----------------

Salad plays nicely with both django and south, but doesn't require them.  

Include the django steps and terrains into your steps and terrains, and you're all set. `manage.py harvest` and all of the lettuce goodies should just work. 


Roadmap<commit_msg>language tweak<commit_after>Salad is a helpful mix of some great BDD packages like lettuce and splinter, seasoned with some common modules.  Its goal is to get rid of any excuses you had for not writing acceptance tests.


Installing
==========

1. Make a virtualenv.

1. `pip install salad`

1. There is no step 3. 


Installing with django
----------------------

Same as above. If you want lettuce-django integration, also add `lettuce.django` to your `INSTALLED_APPS`.


Usage
=====

Salad is mostly lettuce.
------------------------

Salad is mostly lettuce.  So, you should use [great documentation](http://lettuce.it/) with gusto.  If you're interacting with the browser, you're doing it through [splinter](http://splinter.cobrateam.info/docs/), and their docs are great as well.

Salad includes some steps and terrains
--------------------------------------

To make it even easier to test, salad includes a number of common steps and terrains you can import into your files and use.

For example, if you're writing a django app, you can:

my_app_steps.py

```python
from salad.steps.common import *
from salad.steps.django import *
```

and

my_app_terrain.py

```python
from salad.terrains.browser import *
from salad.terrains.django import *
```

and you're done.


Writing your first lettuce feature
----------------------------------

1. Create a "features" directory in your app.

    ```bash
    mkdir features
    ```

1. Inside the features directory, create a filename with `.feature` as its extension.

    ```bash
    touch our-website-is-up.feature
    ```

1. Write your first feature.

    ```gherkin
    Feature: Ensuring that Lettuce works, and W+K's website loads
    In order to make sure that lettuce works
    As a developer
    I open the Wieden+Kennedy website using lettuce

    Scenario: Opening the W+K website works
        Given I access the url "http://www.wk.com/"
        When I look around
        Then I should see "Wieden+Kennedy"
    ```

1. Inside the features directory, create a steps file for this feature.
    
    ```bash
    touch our-website-is-up-steps.py
    ```

1. In `our-website-is-up-steps.py`, import the `salad` libraries

    ```python
    from salad.steps.common import *
    ```

1. Also inside the features directory, create a terrain file, to be used for all features in the folder
    
    ```python
    from salad.terrains.common import *
    ```


That's it, you're ready to run the tests!


Running your first lettuce test
-------------------------------


In the directory above features (your project root), run:

```
lettuce
```

That should be it - you should see:

```
Feature: Ensuring that Lettuce works, and W+K's website loads # features/our-website-is-up.feature:1
  In order to make sure that lettuce works                    # features/our-website-is-up.feature:2
  As a developer                                              # features/our-website-is-up.feature:3
  I open the Wieden+Kennedy website using lettuce             # features/our-website-is-up.feature:4

  Scenario: Opening the W+K website works                     # features/our-website-is-up.feature:6
    Given I access the url "http://www.wk.com/"               # features/our-website-is-up-steps.py:8
    When I look around                                        # features/our-website-is-up-steps.py:80
    Then I should see "Wieden+Kennedy"                        # features/our-website-is-up-steps.py:37

1 feature (1 passed)
1 scenario (1 passed)
3 steps (3 passed)
```

Easy.

Keeping tests organized
-----------------------

As you've noticed above, we use the convention of naming the steps file the same as the feature file, with `-steps` appended.  It's worked well so far. For django apps, it's also been easiest to keep the features for each app within the app structure.

We're still early in using lettuce on larger projects, and as better advice comes out, we'll be happy to share it.  If you have advice, type it up in a pull request, or open an issue!


Django and South
----------------

Salad plays nicely with both django and south, but doesn't require them.  

Include the django steps and terrains into your steps and terrains, and you're all set. `manage.py harvest` and all of the lettuce goodies should just work. 


Roadmap
{'fraction_non_alphanumeric': 0.12157594125189417, 'fraction_numerical': 0.006061312507285231, 'mean_word_length': 2.426517571884984, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2156113', 'n_tokens_mistral': 2491, 'n_tokens_neox': 2287, 'n_words': 1041}