SlideShare a Scribd company logo
1 of 30
Download to read offline
ADF and Selenium
Component Based Unit Testing
About Us
Richard Olrichs
MN
www.olrichs.nl
@richardolrichs
Wilfred van der Deijl
The Future Group
www.redheap.com
@wilfreddeijl
Agenda
Selenium Demo
Plain Selenium Examples
Page Objects
ADF Selenium Demo
ADF Selenium Tools
Testing Your Bounded Taskflows
Selenium 101 Demo
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
● Uses JavaScript injection to emulate user interaction
Very flaky with modern apps
● Used in OTN Article (don’t do that)
Selenium v2 (aka WebDriver)
● Native events to drive browser
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
Also advocated by Selenium team
ADF Selenium Demo
Basic JUnit Example
@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());
}
Basic JUnit Example
@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());
}
Page Object
Basic JUnit Example
@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());
}
ADF Component Object
Basic JUnit Example
@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
Basic JUnit Example
@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 Assertion
Acquiring ADF Page Object
@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());
}
public class CalendarTest {
@ClassRule
public static WebDriverResource driver = new FirefoxDriverResource();
WebDriverResource starts (and stops) a web browser to run the tests
@ClassRule: invoke JUnit rule once per test class
@Rule: invoke JUnit rule for each test method
Acquiring ADF Page Object
public class CalendarTest {
@ClassRule
public static WebDriverResource driver = new WebDriverResource();
@Rule
public PageProvider<CalendarDemoPage> pages =
new PageProvider(CalendarDemoPage.class, PAGE_URL,
driver.getDriver());
PageProvider takes a WebDriver (browser) and knows how to navigate to a URL
and instantiate a Page Object
@Rule triggers provider for each test so we start fresh
Acquiring ADF Page Object
Acquiring ADF Component
@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());
}
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
Acquiring ADF Component
Interacting with ADF Components
@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());
}
Interacting with ADF Components
import com.redheap.selenium.component.AdfComponent;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
public class AdfCalendar extends AdfComponent {
public void hoverActivityInView(int index) {
WebElement element = findAllActivitiesInView().get(index);
// move mouse to element and wait for ADF to detect hover
new Actions(getDriver()).moveToElement(element).pause(1000).perform();
waitForPpr();
}
}
Component class encapsulates interaction with HTML elements
Selenium Actions can interact with browser and mouse
AdfComponent.waitForPpr waits for any PPR and complete javascript processing
Interacting with ADF Components
@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());
}
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());
}
}
CalendarDemoPage.findPopupNote returns AdfOutputText component
Component classes frequently use javascript to interact with components
AdfComponent base class offers protected executeScript method
Every component becomes a client component with
oracle.adf.view.rich.automation.ENABLED=true in web.xml
Interacting with ADF Components
ADF Selenium Tools
ADF Selenium Tools
github.com/wvanderdeijl/adf-selenium
Two JDev 12c Projects:
● SeleniumTools - Library JAR
● RichClientDemoTest - Sample JUnit tests against ADF 12c component demo
Selenium Tools Component Classes
● Re-use a lot of logic that would otherwise live in Page Objects
● Rely heavily on ADF JavaScript API
● All extend from AdfComponent
○ click(), contextClick(), doubleClick()
○ dragAndDropTo(AdfComponent target)
○ findAdfComponent(String childId)
○ isDisabled(), isDisplayed()
○ scrollIntoView()
○ and a few more
Component Class Example: AdfTable
long getRowCount()
findAdfComponent(String child, int row)
scrollToRowIndex(int row)
discloseRowDetail(int row)
List<Integer> getDisclosedRows()
selectRow(int row)
selectToRow(int row)
selectAdditionalRow(int row)
... and all AdfComponent methods
Testing Your Bounded Taskflows
Bounded Taskflow Recap
JUnit Test your taskflows
Use TaskFlow Tester for isolated tests - java.net/projects/adf-task-flow-tester
PerceptualDiffMatcher - bit.ly/pdiff
or look at more powerful Depicted at github.com/bslatkin/dpxdt
JaCoCo Code Coverage
JUnit Rule to dump execution data - bit.ly/jacoco-rule
Optional reporter to write html report - bit.ly/jacoco-report
Browser of choice: Firefox, PhantomJS or any other...
Resources
github.com/wvanderdeijl/adf-selenium
www.seleniumhq.org
seleniumhq.github.io/docs/

More Related Content

What's hot

Quick: Better Tests via Incremental Setup
Quick: Better Tests via Incremental SetupQuick: Better Tests via Incremental Setup
Quick: Better Tests via Incremental SetupBrian Gesiak
 
Angular2 & ngrx/store: Game of States
Angular2 & ngrx/store: Game of StatesAngular2 & ngrx/store: Game of States
Angular2 & ngrx/store: Game of StatesOren Farhi
 
Testing view controllers with Quick and Nimble
Testing view controllers with Quick and NimbleTesting view controllers with Quick and Nimble
Testing view controllers with Quick and NimbleMarcio Klepacz
 
ASP.NET MVC Internals
ASP.NET MVC InternalsASP.NET MVC Internals
ASP.NET MVC InternalsVitaly Baum
 
Fullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterFullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterMek Srunyu Stittri
 
Switch to React.js from AngularJS developer
Switch to React.js from AngularJS developerSwitch to React.js from AngularJS developer
Switch to React.js from AngularJS developerEugene Zharkov
 
React native app with type script tutorial
React native app with type script tutorialReact native app with type script tutorial
React native app with type script tutorialKaty Slemon
 
Revolution or Evolution in Page Object
Revolution or Evolution in Page ObjectRevolution or Evolution in Page Object
Revolution or Evolution in Page ObjectArtem Sokovets
 
Concepts of React
Concepts of ReactConcepts of React
Concepts of Reactinovex GmbH
 
Using ReactJS in AngularJS
Using ReactJS in AngularJSUsing ReactJS in AngularJS
Using ReactJS in AngularJSBoris Dinkevich
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework Yakov Fain
 
Getting started with ReactJS
Getting started with ReactJSGetting started with ReactJS
Getting started with ReactJSKrishna Sunuwar
 
Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6William Marques
 
Creating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with ReactCreating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with Reactpeychevi
 
React state management with Redux and MobX
React state management with Redux and MobXReact state management with Redux and MobX
React state management with Redux and MobXDarko Kukovec
 
Reactive Streams and RxJava2
Reactive Streams and RxJava2Reactive Streams and RxJava2
Reactive Streams and RxJava2Yakov Fain
 
Introducing Playwright's New Test Runner
Introducing Playwright's New Test RunnerIntroducing Playwright's New Test Runner
Introducing Playwright's New Test RunnerApplitools
 

What's hot (20)

Quick: Better Tests via Incremental Setup
Quick: Better Tests via Incremental SetupQuick: Better Tests via Incremental Setup
Quick: Better Tests via Incremental Setup
 
Angular2 & ngrx/store: Game of States
Angular2 & ngrx/store: Game of StatesAngular2 & ngrx/store: Game of States
Angular2 & ngrx/store: Game of States
 
Testing view controllers with Quick and Nimble
Testing view controllers with Quick and NimbleTesting view controllers with Quick and Nimble
Testing view controllers with Quick and Nimble
 
ASP.NET MVC Internals
ASP.NET MVC InternalsASP.NET MVC Internals
ASP.NET MVC Internals
 
Fullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterFullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year later
 
Switch to React.js from AngularJS developer
Switch to React.js from AngularJS developerSwitch to React.js from AngularJS developer
Switch to React.js from AngularJS developer
 
React native app with type script tutorial
React native app with type script tutorialReact native app with type script tutorial
React native app with type script tutorial
 
Revolution or Evolution in Page Object
Revolution or Evolution in Page ObjectRevolution or Evolution in Page Object
Revolution or Evolution in Page Object
 
Concepts of React
Concepts of ReactConcepts of React
Concepts of React
 
Using ReactJS in AngularJS
Using ReactJS in AngularJSUsing ReactJS in AngularJS
Using ReactJS in AngularJS
 
AngularJs Crash Course
AngularJs Crash CourseAngularJs Crash Course
AngularJs Crash Course
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework
 
Getting started with ReactJS
Getting started with ReactJSGetting started with ReactJS
Getting started with ReactJS
 
Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6
 
Creating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with ReactCreating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with React
 
Redux vs Alt
Redux vs AltRedux vs Alt
Redux vs Alt
 
React state management with Redux and MobX
React state management with Redux and MobXReact state management with Redux and MobX
React state management with Redux and MobX
 
METEOR 101
METEOR 101METEOR 101
METEOR 101
 
Reactive Streams and RxJava2
Reactive Streams and RxJava2Reactive Streams and RxJava2
Reactive Streams and RxJava2
 
Introducing Playwright's New Test Runner
Introducing Playwright's New Test RunnerIntroducing Playwright's New Test Runner
Introducing Playwright's New Test Runner
 

Viewers also liked

Viewers also liked (20)

Leveraging FMW for UX
Leveraging FMW for UXLeveraging FMW for UX
Leveraging FMW for UX
 
Oracle OpenWorld 2014 Review Part Six - Summary and Finale
Oracle OpenWorld 2014 Review Part Six - Summary and FinaleOracle OpenWorld 2014 Review Part Six - Summary and Finale
Oracle OpenWorld 2014 Review Part Six - Summary and Finale
 
ADF Performance Monitor
ADF Performance MonitorADF Performance Monitor
ADF Performance Monitor
 
AMIS Oracle OpenWorld 2015 Review – part 4- PaaS Application Development, Jav...
AMIS Oracle OpenWorld 2015 Review – part 4- PaaS Application Development, Jav...AMIS Oracle OpenWorld 2015 Review – part 4- PaaS Application Development, Jav...
AMIS Oracle OpenWorld 2015 Review – part 4- PaaS Application Development, Jav...
 
Overview Oracle Identity Management tijdens AMIS Simplified Security seminar
Overview Oracle Identity Management tijdens AMIS Simplified Security seminarOverview Oracle Identity Management tijdens AMIS Simplified Security seminar
Overview Oracle Identity Management tijdens AMIS Simplified Security seminar
 
Oracle documents cloud service
Oracle documents cloud serviceOracle documents cloud service
Oracle documents cloud service
 
AMIS Oracle OpenWorld 2015 Review –part 1– Overview, Main Themes, Announcemen...
AMIS Oracle OpenWorld 2015 Review –part 1– Overview, Main Themes, Announcemen...AMIS Oracle OpenWorld 2015 Review –part 1– Overview, Main Themes, Announcemen...
AMIS Oracle OpenWorld 2015 Review –part 1– Overview, Main Themes, Announcemen...
 
AMIS Oracle OpenWorld 2015 Review – part 2- Hardware & IaaS and PaaS Cloud Fo...
AMIS Oracle OpenWorld 2015 Review – part 2- Hardware & IaaS and PaaS Cloud Fo...AMIS Oracle OpenWorld 2015 Review – part 2- Hardware & IaaS and PaaS Cloud Fo...
AMIS Oracle OpenWorld 2015 Review – part 2- Hardware & IaaS and PaaS Cloud Fo...
 
Seminar Simplified Security
Seminar Simplified SecuritySeminar Simplified Security
Seminar Simplified Security
 
Integration Cloud Service Deep dive
Integration Cloud Service Deep diveIntegration Cloud Service Deep dive
Integration Cloud Service Deep dive
 
UX in de praktijk Matthieu de Graaf
UX in de praktijk   Matthieu de GraafUX in de praktijk   Matthieu de Graaf
UX in de praktijk Matthieu de Graaf
 
UI frameworks - R. van Amerongen
UI frameworks - R. van AmerongenUI frameworks - R. van Amerongen
UI frameworks - R. van Amerongen
 
Amis Puppet WebLogic / FMW & Database Building blocks
Amis Puppet WebLogic / FMW & Database Building blocks Amis Puppet WebLogic / FMW & Database Building blocks
Amis Puppet WebLogic / FMW & Database Building blocks
 
Visualization one picture beats a 1000 words - User Experience Event AMIS
Visualization one picture beats a 1000 words - User Experience Event AMISVisualization one picture beats a 1000 words - User Experience Event AMIS
Visualization one picture beats a 1000 words - User Experience Event AMIS
 
Oracle and Mobile, From Design to Device; The tools that make it happen - Use...
Oracle and Mobile, From Design to Device; The tools that make it happen - Use...Oracle and Mobile, From Design to Device; The tools that make it happen - Use...
Oracle and Mobile, From Design to Device; The tools that make it happen - Use...
 
SOA_BPM_12c_launch_event_SOA_track_deepdive_developerproductivityandperforman...
SOA_BPM_12c_launch_event_SOA_track_deepdive_developerproductivityandperforman...SOA_BPM_12c_launch_event_SOA_track_deepdive_developerproductivityandperforman...
SOA_BPM_12c_launch_event_SOA_track_deepdive_developerproductivityandperforman...
 
UX Directions with HTML 5, and More
UX Directions with HTML 5, and MoreUX Directions with HTML 5, and More
UX Directions with HTML 5, and More
 
ADF Data Visualisatie sessie - Introductie DVT componenten
ADF Data Visualisatie sessie - Introductie DVT componentenADF Data Visualisatie sessie - Introductie DVT componenten
ADF Data Visualisatie sessie - Introductie DVT componenten
 
Oaux wearables uob_rh.klm
Oaux wearables uob_rh.klmOaux wearables uob_rh.klm
Oaux wearables uob_rh.klm
 
SOA_BPM_12c_launch_event_BPM_track_developer_productivity_lucasjellema
SOA_BPM_12c_launch_event_BPM_track_developer_productivity_lucasjellemaSOA_BPM_12c_launch_event_BPM_track_developer_productivity_lucasjellema
SOA_BPM_12c_launch_event_BPM_track_developer_productivity_lucasjellema
 

Similar to Automated testing by Richard Olrichs and Wilfred vd Deijl

Component Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with SeleniumComponent Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with SeleniumRichard Olrichs
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instrumentsArtem Nagornyi
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsSami Ekblad
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hellNikita Simonovets
 
Controllers & actions
Controllers & actionsControllers & actions
Controllers & actionsEyal Vardi
 
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018Tobias Schneck
 
Advanced Selenium Workshop
Advanced Selenium WorkshopAdvanced Selenium Workshop
Advanced Selenium WorkshopClever Moe
 
Java. Explicit and Implicit Wait. Testing Ajax Applications
Java. Explicit and Implicit Wait. Testing Ajax ApplicationsJava. Explicit and Implicit Wait. Testing Ajax Applications
Java. Explicit and Implicit Wait. Testing Ajax ApplicationsМарія Русин
 
Selenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver TutorialSelenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver TutorialAlan Richardson
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and EasybIakiv Kramarenko
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginnersDivakar Gu
 
Selenium Commands (Short Interview Preparation)
Selenium Commands (Short Interview Preparation)Selenium Commands (Short Interview Preparation)
Selenium Commands (Short Interview Preparation)Yogesh Thalkari
 
Getting up and running with selenium for automated Code palousa
Getting up and running with selenium for automated  Code palousaGetting up and running with selenium for automated  Code palousa
Getting up and running with selenium for automated Code palousaEmma Armstrong
 

Similar to Automated testing by Richard Olrichs and Wilfred vd Deijl (20)

Component Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with SeleniumComponent Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with Selenium
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instruments
 
Selenium
SeleniumSelenium
Selenium
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
 
Web driver training
Web driver trainingWeb driver training
Web driver training
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hell
 
Controllers & actions
Controllers & actionsControllers & actions
Controllers & actions
 
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Advanced Selenium Workshop
Advanced Selenium WorkshopAdvanced Selenium Workshop
Advanced Selenium Workshop
 
Java. Explicit and Implicit Wait. Testing Ajax Applications
Java. Explicit and Implicit Wait. Testing Ajax ApplicationsJava. Explicit and Implicit Wait. Testing Ajax Applications
Java. Explicit and Implicit Wait. Testing Ajax Applications
 
Selenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver TutorialSelenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver Tutorial
 
Web ui testing
Web ui testingWeb ui testing
Web ui testing
 
Rcp by example
Rcp by exampleRcp by example
Rcp by example
 
Easy tests with Selenide and Easyb
Easy tests with Selenide and EasybEasy tests with Selenide and Easyb
Easy tests with Selenide and Easyb
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
Selenium Commands (Short Interview Preparation)
Selenium Commands (Short Interview Preparation)Selenium Commands (Short Interview Preparation)
Selenium Commands (Short Interview Preparation)
 
Introduction to selenium web driver
Introduction to selenium web driverIntroduction to selenium web driver
Introduction to selenium web driver
 
Getting up and running with selenium for automated Code palousa
Getting up and running with selenium for automated  Code palousaGetting up and running with selenium for automated  Code palousa
Getting up and running with selenium for automated Code palousa
 

More from Getting value from IoT, Integration and Data Analytics

More from Getting value from IoT, Integration and Data Analytics (20)

AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
AMIS Oracle OpenWorld en Code One Review 2018 - Blockchain, Integration, Serv...
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: Custom Application ...
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaSAMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 2: SaaS
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: DataAMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Data
 
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
AMIS Oracle OpenWorld en Code One Review 2018 - Pillar 1: Cloud Infrastructure
 
10 tips voor verbetering in je Linkedin profiel
10 tips voor verbetering in je Linkedin profiel10 tips voor verbetering in je Linkedin profiel
10 tips voor verbetering in je Linkedin profiel
 
Iot in de zorg the next step - fit for purpose
Iot in de zorg   the next step - fit for purpose Iot in de zorg   the next step - fit for purpose
Iot in de zorg the next step - fit for purpose
 
Iot overview .. Best practices and lessons learned by Conclusion Conenct
Iot overview .. Best practices and lessons learned by Conclusion Conenct Iot overview .. Best practices and lessons learned by Conclusion Conenct
Iot overview .. Best practices and lessons learned by Conclusion Conenct
 
IoT Fit for purpose - how to be successful in IOT Conclusion Connect
IoT Fit for purpose - how to be successful in IOT Conclusion Connect IoT Fit for purpose - how to be successful in IOT Conclusion Connect
IoT Fit for purpose - how to be successful in IOT Conclusion Connect
 
Industry and IOT Overview of protocols and best practices Conclusion Connect
Industry and IOT Overview of protocols and best practices  Conclusion ConnectIndustry and IOT Overview of protocols and best practices  Conclusion Connect
Industry and IOT Overview of protocols and best practices Conclusion Connect
 
IoT practical case using the people counter sensing traffic density build usi...
IoT practical case using the people counter sensing traffic density build usi...IoT practical case using the people counter sensing traffic density build usi...
IoT practical case using the people counter sensing traffic density build usi...
 
R introduction decision_trees
R introduction decision_treesR introduction decision_trees
R introduction decision_trees
 
Introduction overviewmachinelearning sig Door Lucas Jellema
Introduction overviewmachinelearning sig Door Lucas JellemaIntroduction overviewmachinelearning sig Door Lucas Jellema
Introduction overviewmachinelearning sig Door Lucas Jellema
 
IoT and the Future of work
IoT and the Future of work IoT and the Future of work
IoT and the Future of work
 
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
Oracle OpenWorld 2017 Review (31st October 2017 - 250 slides)
 
Ethereum smart contracts - door Peter Reitsma
Ethereum smart contracts - door Peter ReitsmaEthereum smart contracts - door Peter Reitsma
Ethereum smart contracts - door Peter Reitsma
 
Blockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
Blockchain - Techniek en usecases door Robert van Molken - AMIS - ConclusionBlockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
Blockchain - Techniek en usecases door Robert van Molken - AMIS - Conclusion
 
kennissessie blockchain - Wat is Blockchain en smart contracts @Conclusion
kennissessie blockchain -  Wat is Blockchain en smart contracts @Conclusion kennissessie blockchain -  Wat is Blockchain en smart contracts @Conclusion
kennissessie blockchain - Wat is Blockchain en smart contracts @Conclusion
 
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
Internet of Things propositie - Enterprise IOT - AMIS - Conclusion
 
Omc AMIS evenement 26012017 Dennis van Soest
Omc AMIS evenement 26012017 Dennis van SoestOmc AMIS evenement 26012017 Dennis van Soest
Omc AMIS evenement 26012017 Dennis van Soest
 

Recently uploaded

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 

Recently uploaded (20)

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 

Automated testing by Richard Olrichs and Wilfred vd Deijl

  • 1. ADF and Selenium Component Based Unit Testing
  • 2. About Us Richard Olrichs MN www.olrichs.nl @richardolrichs Wilfred van der Deijl The Future Group www.redheap.com @wilfreddeijl
  • 3. Agenda Selenium Demo Plain Selenium Examples Page Objects ADF Selenium Demo ADF Selenium Tools Testing Your Bounded Taskflows
  • 5. 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(); }
  • 6. Selenium History Selenium v1 ● Uses JavaScript injection to emulate user interaction Very flaky with modern apps ● Used in OTN Article (don’t do that) Selenium v2 (aka WebDriver) ● Native events to drive browser
  • 8. 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 Also advocated by Selenium team
  • 10. Basic JUnit Example @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()); }
  • 11. Basic JUnit Example @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()); } Page Object
  • 12. Basic JUnit Example @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()); } ADF Component Object
  • 13. Basic JUnit Example @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
  • 14. Basic JUnit Example @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 Assertion
  • 15. Acquiring ADF Page Object @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()); }
  • 16. public class CalendarTest { @ClassRule public static WebDriverResource driver = new FirefoxDriverResource(); WebDriverResource starts (and stops) a web browser to run the tests @ClassRule: invoke JUnit rule once per test class @Rule: invoke JUnit rule for each test method Acquiring ADF Page Object
  • 17. public class CalendarTest { @ClassRule public static WebDriverResource driver = new WebDriverResource(); @Rule public PageProvider<CalendarDemoPage> pages = new PageProvider(CalendarDemoPage.class, PAGE_URL, driver.getDriver()); PageProvider takes a WebDriver (browser) and knows how to navigate to a URL and instantiate a Page Object @Rule triggers provider for each test so we start fresh Acquiring ADF Page Object
  • 18. Acquiring ADF Component @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()); }
  • 19. 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 Acquiring ADF Component
  • 20. Interacting with ADF Components @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()); }
  • 21. Interacting with ADF Components import com.redheap.selenium.component.AdfComponent; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; public class AdfCalendar extends AdfComponent { public void hoverActivityInView(int index) { WebElement element = findAllActivitiesInView().get(index); // move mouse to element and wait for ADF to detect hover new Actions(getDriver()).moveToElement(element).pause(1000).perform(); waitForPpr(); } } Component class encapsulates interaction with HTML elements Selenium Actions can interact with browser and mouse AdfComponent.waitForPpr waits for any PPR and complete javascript processing
  • 22. Interacting with ADF Components @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()); }
  • 23. 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()); } } CalendarDemoPage.findPopupNote returns AdfOutputText component Component classes frequently use javascript to interact with components AdfComponent base class offers protected executeScript method Every component becomes a client component with oracle.adf.view.rich.automation.ENABLED=true in web.xml Interacting with ADF Components
  • 25. ADF Selenium Tools github.com/wvanderdeijl/adf-selenium Two JDev 12c Projects: ● SeleniumTools - Library JAR ● RichClientDemoTest - Sample JUnit tests against ADF 12c component demo
  • 26. Selenium Tools Component Classes ● Re-use a lot of logic that would otherwise live in Page Objects ● Rely heavily on ADF JavaScript API ● All extend from AdfComponent ○ click(), contextClick(), doubleClick() ○ dragAndDropTo(AdfComponent target) ○ findAdfComponent(String childId) ○ isDisabled(), isDisplayed() ○ scrollIntoView() ○ and a few more
  • 27. Component Class Example: AdfTable long getRowCount() findAdfComponent(String child, int row) scrollToRowIndex(int row) discloseRowDetail(int row) List<Integer> getDisclosedRows() selectRow(int row) selectToRow(int row) selectAdditionalRow(int row) ... and all AdfComponent methods
  • 28. Testing Your Bounded Taskflows
  • 29. Bounded Taskflow Recap JUnit Test your taskflows Use TaskFlow Tester for isolated tests - java.net/projects/adf-task-flow-tester PerceptualDiffMatcher - bit.ly/pdiff or look at more powerful Depicted at github.com/bslatkin/dpxdt JaCoCo Code Coverage JUnit Rule to dump execution data - bit.ly/jacoco-rule Optional reporter to write html report - bit.ly/jacoco-report Browser of choice: Firefox, PhantomJS or any other...