6

how to specify which lettuce scenario to run?

in using python lettuce test framework, I ran frequently into this case, one scenario failed and then I want to zoom in to this scenario to fix this scenario

can we specify which lettuce scenario to run in the feature file ?

zinking
  • 5,561
  • 5
  • 49
  • 81
  • 1
    you should search before asking here: http://lettuce.it/reference/cli.html#running-only-some-scenarios-of-a-specific-feature-file – John Wang Aug 28 '12 at 07:49
  • @JohnWang do you know how to insert SPACE into the table column in the lettuce test case? this is puzzling me for a while as well. though I should read documentation carefully as well. – zinking Sep 05 '12 at 11:06

2 Answers2

13

You can use tags for the desired tests. For example:

    Scenario: Set off time in free time slot
        Given I click first free time slot
        And I choose menu item "Off"
        And I enter time that is in free interval
        When I click button "Ok"
        Then I see offtime time slot with title that matches with saved interval

    @wip
    Scenario: Set free time on off time
        Given I click last off time slot
        And I choose menu item "Set working"
        And I enter time that is in last off interval
        When I click button "Ok"
        Then I see freetime time slot with title that matches with saved interval

Then when you run lettuce just use

./manage.py harvest -t wip

It will run only those scenarios that are marked with tag @wip, in my case wip is for Work in Progress

If it is without django and just lettuce then use

lettuce -t wip

Azamat Tokhtaev
  • 447
  • 3
  • 8
  • this seems to be integrating with DJANGO, right ? will it work out of DJANGO ? – zinking May 28 '13 at 13:31
  • Thanks! This is not documented yet: https://groups.google.com/forum/#!topic/lettuce-developers/GXAaxluNeAE – ptim Apr 01 '15 at 06:51
4

in the documentation specified by JohnWang we have documentations like this to achieve:

lettuce xxx.feature -s 1,2,3
ptim
  • 14,902
  • 10
  • 83
  • 103
zinking
  • 5,561
  • 5
  • 49
  • 81