Lettuce requests that "Given" or "Then" be part of my step declaration

100 views
Skip to first unread message

Lucas Vickers

unread,
Mar 13, 2013, 11:18:29 AM3/13/13
to lettuc...@googlegroups.com
Hello,

I'm new to lettuce, and having some beginner difficulties.  Right off the bat I'll admit that my setup is advanced, as I'm working off of the lettuce-webdriver setup provided via https://github.com/blossom/lettuce-webdriver-setup .

I am creating some test cases and I am seeing inconsistencies in when lettuce correctly pics up my rules.

I create a feature file, and in it I have:
    Scenario: We call a bad url and expect the 404 error message
      Given I direct request the url "http://localhost:5000/abc"
      Then I should see a direct response that contains "404"

Now, nuances of how the "404" will be handled aside, I get the following


@step(u'Given I direct request the url "([^"]*)"')
def given_i_direct_request_the_url_group1(step, group1):
    assert False, 'This step must be implemented'

@step(u'Then I should see a direct response that contains "([^"]*)"')
def then_i_should_see_a_direct_response_that_contains_group1(step, group1):
    assert False, 'This step must be implemented'


Last night before I sent off this email the rules started to work without any code changes, so I held off.  Now this morning I am seeing almost identical issues with a new rule of mine.
As vague as this question is sounding, are there any types of caching or extra tricks I'm not catching that could cause lettuce to incorrectly read my files?

thanks,
Lucas

Lucas Vickers

unread,
Mar 13, 2013, 11:24:25 AM3/13/13
to lettuc...@googlegroups.com
Post did not have complete information.

To be clear I had defined rules such as
@step('I direct request the url "([^"]*)"')
and
@step('I should see a direct response that contains "([^"]*)"')

And those rules randomly started to work for me.

Steve Schwarz

unread,
Mar 13, 2013, 11:26:37 AM3/13/13
to lettuc...@googlegroups.com
Hi Lucas,

Make sure your regexps aren't overlapping. I like to start them all with ^ and end them all with $. 
A while back I created a feature request to optionally have lettuce test for multiple rules matching scenario statements for this reason.

Best Regards,
Steve

Lucas Vickers

unread,
Mar 13, 2013, 11:31:35 AM3/13/13
to lettuc...@googlegroups.com
Hi Steve,

regexps could definitely be my problem point.  Does Lettuce support a full regexp, or a subset?
I can go read up on this now.

thanks!


--
You received this message because you are subscribed to a topic in the Google Groups "Lettuce Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lettuce-users/ELqnQ41MkTU/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to lettuce-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages