used functionality • Tests that take a lot of effort and time when manual testing • Tests that run on several different hardware or software platforms and configurations. • ...
easy to learn by non-programmers, yet structured enough to allow concise description of examples to illustrate business rules in most real-world domains”. https://cucumber.io/docs/reference
in as "invalid" Then I should see the message "The email and password you entered did not match our records. Please double-check and try again." Scenario: Tweet like a crazy teenager > 140 chars Given I am logged in as "me" When I write the tweet "Restart não presta mais porque eu cheguei aqui 8 horas da manhã e eles não vieram falar com a gente. Não, eu não vou perdoar. Eu vou xingar no twitter hoje, muito. Sério." Then I should not be able to submit the tweet Scenario: Tweet like a pro Given I am logged in as "me" When I write the tweet "This is my first tweet using automation \o/ #selenium #python" And I press "js-tweet-btn" button Then I should see my tweet
step, world from lettuce_webdriver.util import assert_true, assert_false, AssertContextManager from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait @step('I write the tweet "(.*?)"$') def I_write_twitter_post(step, tweet): with AssertContextManager(step): WebDriverWait(world.browser, 10).until( EC.presence_of_element_located((By.ID, "tweet-box-home-timeline"))) element = world.browser.find_element_by_id("tweet-box-home-timeline") element.clear() element.send_keys(tweet) @step('I should see the message "([^"]+)"$') def should_see(step, text): assert_true(step, contains_content(world.browser, text.encode('utf-8'))) ...
requires chromedriver 2.3+ • Use Selenium explicit/implicit wait instead of python time.sleep function ◦ Better, faster and stronger • Use find_by_id (or similar) instead of find_by_xpath ◦ IE provides no native XPath-over-HTML solution