Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
About Us
Richard Olrichs
MN
www.olrichs.nl
www.redheap.com
@richardolrichs
@wilfreddeijl
Agenda
Demo: Selenium
Plain Selenium Examples
Page Objects
Demo: ADF Selenium
ADF Selenium Tools
Demo: Testing Your Bounded Taskflows
Selenium 101
public void simpleTest() {
WebDriver driver = new FirefoxDriver();
driver.get("http://google.com/?hl=en");
WebElement searchBox =
driver.findElement(name("q"));
searchBox.sendKeys("adf selenium");
searchBox.submit();
}
Selenium History
Selenium v1
Page Objects
Page Objects
Martin Fowler:
It should provide an interface that's easy to
program to and hides the underlying
widgetry in the window
Source: martinfowler.com/bliki/PageObject.html
@Test
public void testHover() {
CalendarDemoPage page = pages.goHome();
AdfCalendar calendar = page.findCalendar();
calendar.hoverActivityInView(0);
assertEquals("NOTE: This popup is for demo purposes only;...",
page.findPopupNote().getValue());
}
@Test
public void testHover() {
CalendarDemoPage page = pages.goHome();
AdfCalendar calendar = page.findCalendar();
calendar.hoverActivityInView(0);
assertEquals("NOTE: This popup is for demo purposes only;...",
page.findPopupNote().getValue());
}
Interact with
ADF Component
Test Assertion
SeleniumTools
Selenium
CustomCode
SeleniumTools
Selenium
CustomCode
SeleniumTools
Selenium
CustomCode
import com.redheap.selenium.component.AdfCalendar;
import com.redheap.selenium.page.Page;
public class CalendarDemoPage extends Page {
public AdfCalendar findCalendar() {
return findAdfComponent("dmoTpl:cal");
}
com.redheap.selenium.page.Page base class offers protected utility methods
findAdfComponent uses (relative) JSF selectors
SeleniumTools
Selenium
CustomCode
SeleniumTools
Selenium
CustomCode
import com.redheap.selenium.component.AdfComponent;
public class AdfOutputText extends AdfComponent {
public Object getValue() {
return executeScript("var cmp=AdfPage.PAGE.findComponentByAbsoluteId(arguments[0]);"
+ "return cmp.getValue()",
getClientId());
}
}
Resources
github.com/wvanderdeijl/adf-selenium
www.seleniumhq.org - mostly v1 docs
seleniumhq.github.io/docs/ - new v2 docs
Demo shots
(reference material)
Example Test
Basic assertions
Compare screenshot
Taskflow running in
Taskflow Tester
Validation Error
triggered by test
Known good
reference
Actual screenshot
during test
Diffs indicated