z, ? | toggle help (this) |
space, → | next slide |
shift-space, ← | previous slide |
d | toggle debug mode |
## <ret> | go to slide # |
c, t | table of contents (vi) |
f | toggle footer |
r | reload slides |
n | toggle notes |
p | run preshow |
P | toggle pause |
Paul Hoadley / CC-BY-SA-2.5
Devon Fyson / CC-BY-SA-3.0
http://www.untoldentertainment.com
Hic sunt dracones
package org.openqa.selenium.example;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
public class Example {
public static void main(String[] args) {
// Create a new instance of the html unit driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new HtmlUnitDriver();
// And now use this to visit Google
driver.get("http://www.google.com");
// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to search for
element.sendKeys("Cheese!");
// Now submit the form. WebDriver will find the form for us from the element
element.submit();
// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
}
}
Given I am at "http://www.google.com"
When I enter "Cheese!" for "Search"
And click "Google Search"
Then I should see the text "results"
Feature: Do not let anonymous people use the PHP filter
In order to prevent site hacking
As a site owner
I need to know that my site is properly configured
Scenario: No php filter for comments
Given I am on the homepage
When I follow "Articles"
And I follow "Read more"
Then I should not see "You may post PHP code.
You should include <?php ?> tag"
Given: Put the system in a known state
When: Act on the system
Then: Describe the result of the action
Feature: Do not let anonymous people use the PHP filter
In order to prevent site hacking
As a site owner
I need to know that my site is properly configured
Scenario: No php filter for comments
Given I am on the homepage
When I follow "Articles"
And I follow "Read more"
Then I should not see "You may post PHP code.
You should include <?php ?> tag"
1 scenario (1 passed)
4 steps (4 passed)
0m0.545s
Feature: Do not let anonymous people use the PHP filter
In order to prevent site hacking
As a site owner
I need to know that my site is properly configured
Scenario: No php filter for comments
Given I am on the homepage
When I follow "Articles"
And I follow "Read more"
Then I should not see "You may post PHP code.
You should include <?php ?> tag"
The text "You may post PHP code. You should include <?php ?>
tag" appears in the text of this page, but it should not.
1 scenario (1 failed)
4 steps (3 passed, 1 failed)
0m0.545s
Separates the concept of testing web applications from the actual browser used.
Provides language and corresponding step-definitions for testing web applications.
Provides language and corresponding step-definitions for testing web applications.
Given I visit "http://google.com"
When I fill in "Drupal" for "Search"
And press "Search"
Then I should see the link "http://drupal.org"
Given I am logged in as a user with the "administrator" role
When I am at "node/add"
Then I should see the link "Article"
And I should see the link "Basic page"
Sample composer.json
file
{
"require": {
"drupal/drupal-extension": "*"
},
"minimum-stability": "dev",
"config": {
"bin-dir": "bin/"
}
}
You'll need to install Composer (http://getcomposer.org). I install
it globally so I can just call composer
.
$ composer install
Sample behat.yml
file
default:
paths:
features: 'features'
extensions:
Behat\MinkExtension\Extension:
goutte: ~
selenium2: ~
base_url: http://git6site.devdrupal.org/
Drupal\DrupalExtension\Extension:
blackbox: ~
List of available step definitions
bin/behat -dl
Live demo
Provide reusable language and supporting step definitions common to most Drupal sites.
(Will be ongoing)
Provide multiple ways of manipulating the backend (Drivers).
Support multiple major versions of Drupal
Slides available at http://jhedstrom.github.com
Slides powered by http://github.com/schacon/showoff