SlideShare a Scribd company logo
Designing Top-Class Test Suites
  FOR WEB APPLICATIONS




                             Lukas Fryc
$ whoami

       Lukas Fryc
      @LFryc

JBoss Software Engineer
  Arquillian Commiter
Agenda
●   Agility in Testing
●   Testing: Basics & Principles
●   Client-Side Testing
    ●   Unit Testing
    ●   UI Automation
●   Foundations of Real Tests
    ●   JSFUnit.NG
●   Speeding up Development
    ●   JRebel extension
Testing
       Testing
       Testing
       Testing     #Agile
       Testing
       Testing
#TDD   Testing
       Testing
       Testing
       Testing   “You can hear about testing
       Testing   from everywhere!”
“How would you complete
equation?

What word do you
imagine when someone
says testing?”




                          Testing = ?
Testing = Pain
“What about changing
that equation a little bit?”




                    Testing = Enjoyable!
“But testing of large
enterprise application can
hardly can be enjoyable.”




     Enterprise Java Web Application


                             “You need to write all the
                             test harness at own and
                             study all the tools.”
Reinventing the Wheel
No one saves the World?
“There is one: his name is
Ike. He comes from far,
deep space from planet
Arquillian...”
“Ike brings heavy gear for
fighting with alien
bugs...”
“...and he is proud to
share his powerful gear
with us!”
“At first, he comes with
   Ability to split one big
  deployment into many
small - testing as little as
 components as possible
            in separation.”
“And he makes sure
these deployments work
    on various of Earth's
    application servers.”
“...and once he deploys
        the deployment into
 container, he makes sure
you have all the goodness
       from inside available
          using dependency
                  injection.”
“...and that all backed
with strong development
                     tools.”
“You can run it just from
                  your IDE, re-using what
                      you already know.”




JUnit   TestNG
Testing Revolution
Ike brings tests to the Server
But what about the Client?
The little bit of Theory...
Designing Top-Class Test Suites for Web Applications
Designing Top-Class Test Suites for Web Applications
Designing Top-Class Test Suites for Web Applications
Designing Top-Class Test Suites for Web Applications
“Let's have ideal testing
pyramid in mind,
otherwise...”
Enough Theory!
Let's bring tests to the Client
JUnit
TestNG
“But it isn't as simple as
in Java - many different
environments.”
“Fortunately there is tool
which allows you to write
tests in unified API for all
those browsers.”
“And the even supports
mocked browsers with
same API.”
W3C: Browser Automation Spec
Oh, such a great tool!
Let's invade client!
“Ouch, we need some
        abstraction!”
“Even if we use favorite
programming language,
we can end up with many
tests which take days to
pass and may quickly
turn out into maintenance
burden!”                     Java
                              C#
                            Python
                             Ruby
                             PHP
                             Perl
At least, the app is covered...
“But this is what actually
Selenium see.”
Black Box
“Selenium is able to test
transitions between
pages.”




                      State Transitions
“...and a portion of all the
page source code –
JavaScript handlers,
selected CSS and DOM
changes as reaction to
user interaction.”




                   A little bit of...
                DOM / JavaScript / CSS
Let's change the game...
Right tool for the Job
“Let's take an
outstanding UI
automation tool...”
“and add your favorite
language.”
“and little bit of Alien
technology.”
Arquillian Drone
 Ike's Hard-Worker
Designing Top-Class Test Suites for Web Applications
“Drone comes to bring
the browser to your test.”
Help Devs get along with QA
 Developers focused on tests
 QA focused on automation
   arquillian.xml configuration for cross-browser testing
Let Ike invade the Client
“But something else is
needed to make your
tests green.”
“Something enough
strong to handle all the
inconsistencies.”
“Let's deploy that to the
browser page and see
what happens!”
Arquillian Graphene
Shielding Ike from Maintenance Burden
Strongly type-safe
Proven to handle AJAX
 Request Guards
 jQuery Selectors
guardXhr(button).click();
guardHttp(button).click();
Strongly type-safe
Proven to handle AJAX
 Request Guards
 jQuery Selectors


Page Extensions – Script Injection
Cross-cutting concerns
 Interceptors
@JavaScript(“document”)
public interface Document() {
    String getTitle();
}


@Inject
Document document;

// calls 'return document.title;'
document.getTitle();
Isn't that too low-level?
“Let's look for something
on higher level.”




                Reusable Abstractions
“Introducing well-known
Selenium pattern:”




                          Page Objects
“Imagine you have
page with all the
elements and you
express them as
fields in the class.”
“Page Objects allows
you to abstract page-
oriented logic into
objects.”
Designing Top-Class Test Suites for Web Applications
“But for modern AJAX-
based application, it's
simply not enough.”
“In enterprise
applications, you use
UI components that
encapsulates low-
level logic.”
“We could create the
model of these
components from
their user's point of
view?”
@FindBy(id=”form:calendar”)
Calendar calendar;


calendar.setDate(new Date());
@Component
public class Calendar {

    @Root
    WebElement driver;

    @FindBy(css=”.dateButton”)
    WebElement button;

    public void setDate() {
        input.click();
    }
}
Component Objects
Will be part of Arquillian Graphene 2.x
“When each
framework and library
providing UI
components will
design component
objects the same as it
share their code, it
will be testing much
more simpler.”

                         Call to Action:
                 Write & Share Component Objects
Let's do the review...
“Now, we can simply
write tests on proper
level of abstraction
with minimum
efforts.”
3   Missing
    Pieces
“What is missing here?

         No manual coverage and
           no unit and integration
             tests for client-side!”




 JUnit
TestNG
How to avoid manual testing?
“We can automatically
                  snap screen-shots of the
                          whole pages and
                       compare them with
                       historical data – it's
                 proven that rendering on
                    one particular browser
                 and platform, images will
                         be binary same.”



Screen-shot Comparison
Automated Visual Verification
The Music of the Future?
Arquillian RushEye
  Google Summer of Code 2012
“Server is already
         covered with unit and
          integration tests, but
         what about the same
          goodness for client?”




 JUnit
TestNG
“Unit testing of client
is even more
important than unit
testing of server,
since it suffers from
environment
diversity.”




                      Unit Testing Client
Unit Testing Frameworks
 QUnit, Jasmine, JsMockito


Test Runners
 JSTD, Selenium, Maven
“But once those unit
tests are written, how
to automate them?

Without automation,
they are not tests.”




       Yet another tool to configure?
Reuse the Automation Setup
“For writing actual
tests, you can use
your favorite JS client
testing tool.

We are actually
working on
integration with
QUnit.”




                             Arquillian
                          Drone + QUnit | JSTD
                          Maven / Jenkins / IDE
“JavaScript testing does not
          scale!”

                            ~John Resig


   http://ejohn.org/blog/javascript-testing-does-not-scale/
TestSwarm
Crowd-sourcing for Browser Coverage
        Jenkins integration



                             “But it is rather for
                             open source projects,
                             right?”
“For corporates, it is
more suitable to use
cloud services:”




           Browser Tests in the Cloud
                     SauceLabs On Demand
               Integration with Arquillian comming
“And once the client is
                  covered too, only
         integration tests for client
                      are missing.”




 JUnit
TestNG
“The integration
testing of client is
actually making sure
it communicates with
server as expected.”




          Client + Server Integration
“We have browser and
  test on one side and
server on opposite side.”
“With UI automation, we
are sending request from
  client to the server.”
“And server generates
     response.”
Black Box
“On the other hand, when
  we are testing server
  from its JVM, we are
 mocking requests, which
   invokes verification
         code.”
Don't mock me
The Tour to the Server
   There and Back Again
“Let's make the
connection between client
    and server live.”
“Once the requests goes
 to the server, the test
 code is serialized and
   sent as part of the
        request.”
“Server de-serializes the
testing code from request
and uses it for verification
   of the server state in
several lifecycle phases.”
“Offering all the gear
  which Arquillian offers,
including test enrichment
    for injection of test
      dependencies.”
“Then the testing object
 is serialized again and
 sent back to the client,
 which can validate it.”
“Client can verify the
 response and send
subsequent request.”
Crazy idea?
“But it is already
possible!”




                     JSFUnit
JSFUnit
 HtmlUnit
 Asserts end of the Request State
 JSF only


JSFUnit .NG (next generation)
 Selenium / any other HTTP client
 Lifecycle
 Any injectable resource
 Any Servlet based framework
“Now, we are covered!”




 JUnit
TestNG
Client Invasion
That's it...
No, It can't be without....
Mobile
Designing Top-Class Test Suites for Web Applications
“Drone can instantiate
   browser emulator or
connect to real device.”
Designing Top-Class Test Suites for Web Applications
“And create the browser
              within the
      emulator/device.”
Arquillian Android
Emulating Mobile Platform
Designing Top-Class Test Suites for Web Applications
Development on Steroids
Speeding up Development
  Reusable Browser Session
  Arquillian JRebel Extension
Arquillian
Experience the Future Now
I must know more...
http://bit.ly/arq-preview
http://bit.ly/arq-users
Getting Involved
http://github.com/arquillian
http://bit.ly/arq-devs
http://bit.ly/jboss-testing
#jbosstesting @ irc.freenode.net
#Arquillian
Enjoy the Testing!
Questions for Ike?


    @LFryc

http://bit.ly/arq-blog
http://bit.ly/lfryc
Some photographs and pictures used in this
   presentation are authored by various authors
    and released under the Creative Commons
                      license


http://www.flickr.com/photos/nickrussill/150410613/
http://www.flickr.com/photos/audreyjm529/1240909256/
http://www.flickr.com/photos/jo-h/6200225665/
http://www.flickr.com/photos/stevendepolo/3796415185/
http://watirmelon.com/2012/01/31/introducing-the-software-
testing-ice-cream-cone/

More Related Content

PDF
Serverless in production, an experience report (codemotion milan)
PDF
Serverless in production, an experience report (NDC London 2018)
PDF
Serverless in production, an experience report (microservices london)
PPTX
A. De Biase/C. Quatrini/M. Barsocchi - API Release Process: how to make peopl...
PDF
Serverless in production, an experience report (BuildStuff)
PDF
Serverless in production, an experience report (London js community)
PPTX
An overview of selenium webdriver
PDF
Serverless in production, an experience report (Going Serverless)
Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (NDC London 2018)
Serverless in production, an experience report (microservices london)
A. De Biase/C. Quatrini/M. Barsocchi - API Release Process: how to make peopl...
Serverless in production, an experience report (BuildStuff)
Serverless in production, an experience report (London js community)
An overview of selenium webdriver
Serverless in production, an experience report (Going Serverless)

What's hot (20)

PDF
2015 in tothebox-introtddbdd
PPTX
HoloLens Unity Build Pipelines on Azure DevOps
PDF
From zero to hero with React Native!
KEY
Kirin - Making Single Page Web Apps with a Native UI
PDF
Front-End Testing: Demystified
PDF
GlobalLogic Test Automation Online TechTalk “Playwright — A New Hope”
PDF
learning react
PDF
Test your Javascript! v1.1
PPTX
Automated Smoke Tests with Protractor
PDF
Introducing Playwright's New Test Runner
PPTX
Better Page Object Handling with Loadable Component Pattern
PPTX
Protractor Testing Automation Tool Framework / Jasmine Reporters
PDF
A Closer Look At React Native
PPTX
Protractor overview
PPTX
Web Performance & Latest in React
PDF
AngularJS Beginner Day One
PDF
OSMC 2009 | Application Monitoring - Bridging the gap... by Michael Medin
PPTX
Selenium Interview Questions and Answers | Selenium Tutorial | Selenium Train...
PDF
Need forbuildspeed agile2012
PPTX
Introduction to Node.JS
2015 in tothebox-introtddbdd
HoloLens Unity Build Pipelines on Azure DevOps
From zero to hero with React Native!
Kirin - Making Single Page Web Apps with a Native UI
Front-End Testing: Demystified
GlobalLogic Test Automation Online TechTalk “Playwright — A New Hope”
learning react
Test your Javascript! v1.1
Automated Smoke Tests with Protractor
Introducing Playwright's New Test Runner
Better Page Object Handling with Loadable Component Pattern
Protractor Testing Automation Tool Framework / Jasmine Reporters
A Closer Look At React Native
Protractor overview
Web Performance & Latest in React
AngularJS Beginner Day One
OSMC 2009 | Application Monitoring - Bridging the gap... by Michael Medin
Selenium Interview Questions and Answers | Selenium Tutorial | Selenium Train...
Need forbuildspeed agile2012
Introduction to Node.JS
Ad

Viewers also liked (11)

PPTX
Test coverage in a jiffy v0 9
PPTX
Toronto alm v1
PPTX
Pytest testmon - executing large test suites quickly
PPT
Kanban 101 - 0 - Introduction
PPTX
Storyboarding an existing concept
PPT
Acceptance Test Driven Development using Robot Framework
PPTX
Web testing automation
PDF
PowerStory - a better way to define requirements and test cases
PDF
JavaCro'14 - Test Automation using RobotFramework Libraries – Stojan Peshov
PPTX
Software Testing Basics
PPT
Test link
Test coverage in a jiffy v0 9
Toronto alm v1
Pytest testmon - executing large test suites quickly
Kanban 101 - 0 - Introduction
Storyboarding an existing concept
Acceptance Test Driven Development using Robot Framework
Web testing automation
PowerStory - a better way to define requirements and test cases
JavaCro'14 - Test Automation using RobotFramework Libraries – Stojan Peshov
Software Testing Basics
Test link
Ad

Similar to Designing Top-Class Test Suites for Web Applications (20)

PDF
Arquillian: Effective tests from the client to the server
PPTX
JLove - Replicating production on your laptop using the magic of containers
PPTX
JBCN_Testing_With_Containers
PPTX
Visual Testing Of Web Apps in a Headless Environment
PDF
Serverless in production (O'Reilly Software Architecture)
PPTX
Java script unit testing
PPT
The Future of Selenium Testing for Mobile Web and Native Apps
PPTX
vodQA(Pune) 2018 - Visual testing of web apps in headless environment manis...
PDF
NodeSummit - MEAN Stack
PDF
Yan Cui - Serverless in production, an experience report - Codemotion Milan 2017
PPT
Building Rich User Experiences Without JavaScript Spaghetti
PPT
Using Selenium to Test Native Apps (Wait, you can do that?)
PDF
Javascript spaghetti stirtrek_5_17
PPTX
Foolangjs
PPTX
Angular Unit testing.pptx
PPTX
How we tested our code "Google way"
PDF
Continous UI testing with Espresso and Jenkins
PPTX
Dependency Injection in .NET applications
PPTX
7 automated visual testing tools for you
Arquillian: Effective tests from the client to the server
JLove - Replicating production on your laptop using the magic of containers
JBCN_Testing_With_Containers
Visual Testing Of Web Apps in a Headless Environment
Serverless in production (O'Reilly Software Architecture)
Java script unit testing
The Future of Selenium Testing for Mobile Web and Native Apps
vodQA(Pune) 2018 - Visual testing of web apps in headless environment manis...
NodeSummit - MEAN Stack
Yan Cui - Serverless in production, an experience report - Codemotion Milan 2017
Building Rich User Experiences Without JavaScript Spaghetti
Using Selenium to Test Native Apps (Wait, you can do that?)
Javascript spaghetti stirtrek_5_17
Foolangjs
Angular Unit testing.pptx
How we tested our code "Google way"
Continous UI testing with Espresso and Jenkins
Dependency Injection in .NET applications
7 automated visual testing tools for you

More from Lukáš Fryč (9)

PDF
Role of QA in Continuous Delivery
PDF
Arquillian: Helping web developers and QA get along
PDF
JSF 2.2 Deep Dive with RichFaces 5
PDF
Web Components: Rethinking Web App Development
PDF
Web Technologies in Java EE 7
PDF
Going mobile with RichFaces
PDF
RichFaces CDK: Rapid JSF Component Development
ODP
Testing JSF with Arquillian and Selenium
ODP
RichFaces 4 rolling to Mobile Era
Role of QA in Continuous Delivery
Arquillian: Helping web developers and QA get along
JSF 2.2 Deep Dive with RichFaces 5
Web Components: Rethinking Web App Development
Web Technologies in Java EE 7
Going mobile with RichFaces
RichFaces CDK: Rapid JSF Component Development
Testing JSF with Arquillian and Selenium
RichFaces 4 rolling to Mobile Era

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Big Data Technologies - Introduction.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
cuic standard and advanced reporting.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation theory and applications.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Machine learning based COVID-19 study performance prediction
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Big Data Technologies - Introduction.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Agricultural_Statistics_at_a_Glance_2022_0.pdf
The AUB Centre for AI in Media Proposal.docx
Review of recent advances in non-invasive hemoglobin estimation
Network Security Unit 5.pdf for BCA BBA.
Per capita expenditure prediction using model stacking based on satellite ima...
cuic standard and advanced reporting.pdf
Approach and Philosophy of On baking technology
Encapsulation theory and applications.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Unlocking AI with Model Context Protocol (MCP)
Machine learning based COVID-19 study performance prediction
sap open course for s4hana steps from ECC to s4
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Spectroscopy.pptx food analysis technology
Digital-Transformation-Roadmap-for-Companies.pptx
Programs and apps: productivity, graphics, security and other tools
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

Designing Top-Class Test Suites for Web Applications