Search code examples
pythonlettuce

Lettuce: Continue testing after an assertion


How can I continue testing after a test fails?

Feature: some feature
  Scenario Outline: some scenario outline
    Given I prepare everything
    Then there is a test that could fail
    And some other test I still want to run

I want "some other test I still want to run" to run, even though "there is a test that could fail" failed.


Solution

  • In the Unit testing framework which is natively supported by Python, the framework will run all tests and give an output, e.g. 8/10 have passed. So for example you could write 20 test scenarios and write your code against the tests, bringing up to coverage. A testing framework should usually run all tests (unless they take very long, which should usually not be the case).

    Have a look at: http://docs.python.org/library/unittest.html