Web ui testing

Radim Pavlicek
Radim PavlicekSenior Java Developer at Laurinka à Laurinka
Web UI testing in Scala
Radim.pavlicek@gmail.com
@radimpavlicek
Why should I care?
●
●
●
●
●

regression errors
cross web browser (Firefox/IE/Chrome)
cross OS (Mac/Linux/Windows)
cross versions (browsers)
use cases documentation
Selenium
● open-source
● Domain Specific Language support in
ScalaTest 2.0
What’s needed?
● continuous integration (Jenkins)
● server with browser installation
● test-cases from domain users
Recorder
Recorder cont.
+ quickly record
+ no knowledge required
- fragile test cases
- spaghetti test-case
Example
Scenario
Continuous integration
Jenkins

Java application
JSF

Scala code
Selenium
Invoked on Jenkins?
● @Midnight
● Maven
clean integration-test -P ui-test
Maven settings.xml
<profile>
<id>ui-test</id>
<properties>
<onlineUsers.login>rpavlicek</onlineUsers.login>
<onlineUsers.password>*******</onlineUsers.password>
<onlineUsers.url>localhost</onlineUsers.url>
<onlineUsers.port>9090</onlineUsers.port>
</properties>
</profile>
Scala part
Input parameters
object Settings {
val url = System.getProperty ("onlineUsers.url" )
val login = System.getProperty ("onlineUsers.login" )
val password = System.getProperty ("onlineUsers.password" )
val port = {
val tmp = System.getProperty ("onlineUsers.port" )
if (null == tmp)
new Integer(9090)
else new Integer(tmp)
}
}
WebDriver
object WebDriverAccess {
val defaultDriver : WebDriver = {
print("Creating WebDriver... " )
try {
new FirefoxDriver()
} finally { println( "Done.") }
}
}
WebDriver cont.
trait WebDriverAccess {
implicit val driver = WebDriverAccess.defaultDriver
}

implicit = if a parameter value is not supplied
then the compiler will search for an "implicit"
value defined within scope
Page objects pattern
●
●
●
●

model UI as services
not exposing internals
model just what is tested
public service methods return PageObjects
Wait
protected def waitUntil(f: => Boolean): Unit = {
new WebDriverWait(driver, 25, 50) until
(new ExpectedCondition[Boolean] {
def apply(input: WebDriver) = f
})
}
WebDriverWait(WebDriver driver, Clock clock, Sleeper sleeper, long timeOutInSeconds, long
sleepTimeOut)
waitUntil {

!driver.findElements(By.id(“ mainForm:isLoggedIn ”)).isEmpty }
PageObject implementation
abstract class Page[T <: Page[T]]( expectedId: String, val driver:
WebDriver) {
self: T =>
waitUntil {

!driver.findElements(By.id(expectedId)).isEmpty }

private val tmpId: By = By.id(expectedId)
try { driver.findElement(tmpId)
} catch {
case nsee: NoSuchElementException =>
Assert.fail( "ID not found:" +expectedId)
}
}
PageObject cont.
class HomePage( driver: WebDriver) extends Page[HomePage]( "mainForm:
isLoggedIn" , driver) {
def goToUserManagementPage () =
click(id("mainForm:mainNavPTS:0:usersPTText" ))
.expecting[UserManagementPage]

def goToReportPage () =
click(id("mainForm:mainNavPTS:0:reportsPTText" ))
.expecting[ReportPage]
}
Use case
class UserManagementWebTest extends WebDriverAccess {
var homePage: HomePage = _
@Test
def shouldLandOnUserManagement {
val loginPage: LoginPage = LoginPage.open(
server = Settings.url, port = Settings.
port)
homePage = loginPage.login()
val mngPage: UserManagementPage = homePage.goToUserManagementPage()
assertThat(mngPage.text, containsString( "Create new User" ))
}
That’s it!

Q&A
1 sur 20

Recommandé

Testing frontends with nightwatch & saucelabs par
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTudor Barbu
1.4K vues22 diapositives
Building a js widget par
Building a js widgetBuilding a js widget
Building a js widgetTudor Barbu
990 vues44 diapositives
20160905 - BrisJS - nightwatch testing par
20160905 - BrisJS - nightwatch testing20160905 - BrisJS - nightwatch testing
20160905 - BrisJS - nightwatch testingVladimir Roudakov
756 vues52 diapositives
Vuejs testing par
Vuejs testingVuejs testing
Vuejs testingGreg TAPPERO
17.2K vues14 diapositives
Игорь Фесенко "Web Apps Performance & JavaScript Compilers" par
Игорь Фесенко "Web Apps Performance & JavaScript Compilers"Игорь Фесенко "Web Apps Performance & JavaScript Compilers"
Игорь Фесенко "Web Apps Performance & JavaScript Compilers"Fwdays
575 vues35 diapositives
Protractor framework – how to make stable e2e tests for Angular applications par
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsLudmila Nesvitiy
4.4K vues39 diapositives

Contenu connexe

Tendances

AngularJS for Java Developers par
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java DevelopersLoc Nguyen
4.1K vues45 diapositives
Better Testing With PHP Unit par
Better Testing With PHP UnitBetter Testing With PHP Unit
Better Testing With PHP Unitsitecrafting
812 vues23 diapositives
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen) par
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)Scrum Breakfast Vietnam
879 vues29 diapositives
Fullstack End-to-end test automation with Node.js, one year later par
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
4.9K vues49 diapositives
Introduction to Protractor par
Introduction to ProtractorIntroduction to Protractor
Introduction to ProtractorJie-Wei Wu
4.8K vues23 diapositives
The Road to Native Web Components par
The Road to Native Web ComponentsThe Road to Native Web Components
The Road to Native Web ComponentsMike North
1.1K vues51 diapositives

Tendances(20)

AngularJS for Java Developers par Loc Nguyen
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java Developers
Loc Nguyen4.1K vues
Better Testing With PHP Unit par sitecrafting
Better Testing With PHP UnitBetter Testing With PHP Unit
Better Testing With PHP Unit
sitecrafting812 vues
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen) par Scrum Breakfast Vietnam
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)
Fullstack End-to-end test automation with Node.js, one year later par Mek Srunyu Stittri
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
Mek Srunyu Stittri4.9K vues
Introduction to Protractor par Jie-Wei Wu
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
Jie-Wei Wu4.8K vues
The Road to Native Web Components par Mike North
The Road to Native Web ComponentsThe Road to Native Web Components
The Road to Native Web Components
Mike North1.1K vues
Node.js and Selenium Webdriver, a journey from the Java side par Mek Srunyu Stittri
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java side
Mek Srunyu Stittri25.9K vues
CasperJs Enjoy Functional Testing par Fabien POMEROL
CasperJs Enjoy Functional TestingCasperJs Enjoy Functional Testing
CasperJs Enjoy Functional Testing
Fabien POMEROL3.8K vues
Transakcyjność w django par Marcin Baran
Transakcyjność w djangoTransakcyjność w django
Transakcyjność w django
Marcin Baran815 vues

En vedette

Scala taxonomy par
Scala taxonomyScala taxonomy
Scala taxonomyRadim Pavlicek
1.4K vues28 diapositives
Encontro com escritor joão morgado par
Encontro com escritor joão morgadoEncontro com escritor joão morgado
Encontro com escritor joão morgadojoaocarlosoliveiracamurca
436 vues4 diapositives
Introduction to Functional Programming with Scala par
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaDaniel Cukier
1.5K vues30 diapositives
Internal combustion engine par
Internal combustion engineInternal combustion engine
Internal combustion engineDeepak Chaand
743 vues10 diapositives
Tjänster.unicode par
Tjänster.unicodeTjänster.unicode
Tjänster.unicodeSari Salmi
245 vues1 diapositive
Functions In Scala par
Functions In Scala Functions In Scala
Functions In Scala Knoldus Inc.
2.2K vues33 diapositives

En vedette(20)

Introduction to Functional Programming with Scala par Daniel Cukier
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scala
Daniel Cukier1.5K vues
Tjänster.unicode par Sari Salmi
Tjänster.unicodeTjänster.unicode
Tjänster.unicode
Sari Salmi245 vues

Similaire à Web ui testing

Web UI test automation instruments par
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instrumentsArtem Nagornyi
10K vues23 diapositives
Mastering Test Automation: How To Use Selenium Successfully par
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
1.5K vues61 diapositives
Selenium training par
Selenium trainingSelenium training
Selenium trainingSuresh Arora
594 vues24 diapositives
Web driver training par
Web driver trainingWeb driver training
Web driver trainingDipesh Bhatewara
813 vues29 diapositives
Android UI Testing with Appium par
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with AppiumLuke Maung
10.9K vues25 diapositives
Selenium Introduction by Sandeep Sharda par
Selenium Introduction by Sandeep ShardaSelenium Introduction by Sandeep Sharda
Selenium Introduction by Sandeep ShardaEr. Sndp Srda
126 vues25 diapositives

Similaire à Web ui testing(20)

Web UI test automation instruments par Artem Nagornyi
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instruments
Artem Nagornyi10K vues
Mastering Test Automation: How To Use Selenium Successfully par SpringPeople
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople1.5K vues
Android UI Testing with Appium par Luke Maung
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with Appium
Luke Maung10.9K vues
Selenium Introduction by Sandeep Sharda par Er. Sndp Srda
Selenium Introduction by Sandeep ShardaSelenium Introduction by Sandeep Sharda
Selenium Introduction by Sandeep Sharda
Er. Sndp Srda126 vues
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter par Boni García
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-JupiterToolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Boni García1.8K vues
Top100summit 谷歌-scott-improve your automated web application testing par drewz lin
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
drewz lin538 vues
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js par Mek Srunyu Stittri
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
Mek Srunyu Stittri2.1K vues
Automated acceptance test par Bryan Liu
Automated acceptance testAutomated acceptance test
Automated acceptance test
Bryan Liu1.2K vues
Selenium RC: Automated Testing of Modern Web Applications par qooxdoo
Selenium RC: Automated Testing of Modern Web ApplicationsSelenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web Applications
qooxdoo16.4K vues
Protractor framework architecture with example par shadabgilani
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
shadabgilani208 vues
Mastering selenium for automated acceptance tests par Nick Belhomme
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
Nick Belhomme20.1K vues
Improving Your Selenium WebDriver Tests - Belgium testing days_2016 par Roy de Kleijn
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Roy de Kleijn343 vues
Advanced SharePoint Web Part Development par Rob Windsor
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part Development
Rob Windsor4K vues
Good practices for debugging Selenium and Appium tests par Abhijeet Vaikar
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium tests
Abhijeet Vaikar233 vues
Automation Abstraction Layers: Page Objects and Beyond par Alan Richardson
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and Beyond
Alan Richardson67.3K vues
Testing in JavaScript - August 2018 - WebElement Bardejov par Marian Rusnak
Testing in JavaScript - August 2018 - WebElement BardejovTesting in JavaScript - August 2018 - WebElement Bardejov
Testing in JavaScript - August 2018 - WebElement Bardejov
Marian Rusnak49 vues

Dernier

Design Driven Network Assurance par
Design Driven Network AssuranceDesign Driven Network Assurance
Design Driven Network AssuranceNetwork Automation Forum
15 vues42 diapositives
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive par
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveNetwork Automation Forum
31 vues35 diapositives
PRODUCT PRESENTATION.pptx par
PRODUCT PRESENTATION.pptxPRODUCT PRESENTATION.pptx
PRODUCT PRESENTATION.pptxangelicacueva6
14 vues1 diapositive
Tunable Laser (1).pptx par
Tunable Laser (1).pptxTunable Laser (1).pptx
Tunable Laser (1).pptxHajira Mahmood
24 vues37 diapositives
Democratising digital commerce in India-Report par
Democratising digital commerce in India-ReportDemocratising digital commerce in India-Report
Democratising digital commerce in India-ReportKapil Khandelwal (KK)
15 vues161 diapositives
Melek BEN MAHMOUD.pdf par
Melek BEN MAHMOUD.pdfMelek BEN MAHMOUD.pdf
Melek BEN MAHMOUD.pdfMelekBenMahmoud
14 vues1 diapositive

Dernier(20)

Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive par Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
HTTP headers that make your website go faster - devs.gent November 2023 par Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn22 vues
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... par James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson85 vues
Business Analyst Series 2023 - Week 3 Session 5 par DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10248 vues
Five Things You SHOULD Know About Postman par Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman33 vues
Piloting & Scaling Successfully With Microsoft Viva par Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Empathic Computing: Delivering the Potential of the Metaverse par Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Special_edition_innovator_2023.pdf par WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2217 vues

Web ui testing