Skip to content

Instantly share code, notes, and snippets.

@GabiThume
Last active August 4, 2018 15:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save GabiThume/5880058 to your computer and use it in GitHub Desktop.
Save GabiThume/5880058 to your computer and use it in GitHub Desktop.
A simple test using behave and selenium
from selenium import webdriver
def before_all(context):
context.browser = webdriver.Firefox()
def after_all(context):
context.browser.quit()
Feature: testing browser title
Scenario Outline: visit <browser page> and check
When we visit <browser page>
Then it should have a title "<browser title>"
Examples: Browser
| browser page | browser title |
| https://crash-stats.mozilla.com/ | Crash Data for Firefox |
@when('we visit https://crash-stats.mozilla.com/')
def step(context):
context.browser.get("https://crash-stats.mozilla.com/")
@then('it should have a title "Crash Data for Firefox"')
def step(context):
assert context.browser.title == "Crash Data for Firefox"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment