Originally: "Still Testing Your Software with Computers?" Presented at the DC Selenium and DCAST Meetups. Discusses BDD cross browser testing with integration to SauceLabs.
In order to learn about the worlds buildings As an architecture geek I want to view basic building dimensions Scenario: I can see available buildings Given I am on homepage Then I should see "Freedom Tower" And I should see "Burj Khalifa" Scenario: I can view a building's top floor Given I am on homepage And I follow "Freedom Tower" Then I should see "Freedom Tower" And I should not see "Burj Khalifa" And I should see "Top Floor: 1268 ft" Thursday, July 18, 13
/** * Initializes context. * Every scenario gets it's own context object. * * @param array $parameters context parameters (set them up through behat.yml) */ public function __construct(array $parameters) { $this-‐>parameters = $parameters; } } Thursday, July 18, 13
specific features for the purposes of the demo tags: "@demo1" extensions: Behat\MinkExtension\Extension: selenium2: wd_host: username:[email protected]/ wd/hub capabilities: { "browser": "googlechrome", "platform": "OS X 10.6", "name": "Behat PHP Demo" } Thursday, July 18, 13
order to understand the dimensions of a building As a metric system user I want to toggle between dimension systems @demo2 Scenario: There is a toggle button Given I am on "/building/freedom-‐tower" Then I should see "Switch to Metric" @demo2 @selenium Scenario: Clicking on the toggle button will switch dimensions Given I am on "/building/freedom-‐tower" When I follow "Switch to Metric" Then I should see "Top Floor: 386.4864 m" And I should see "Tip: 541.3248 m" Thursday, July 18, 13
private final WebDriver webDriver; public NavigationStepdefs(SharedDriver webDriver) { this.webDriver = webDriver; } @Given("^I am on the front page$") public void i_am_on_the_front_page() { webDriver.get("http://localhost:" + ServerHooks.PORT); } } Thursday, July 18, 13