SlideShare a Scribd company logo
1 of 17
Download to read offline
Leveraging Selenium
                         recorded tests to generate
                             more effective tests

                               Author: Cu D. Nguyen, PhD
                               http://selab.fbk.eu/dnguyen/




Tuesday, January 8, 13
Selenium tests
                      • A Selenium test consists of a sequence of
                            events and their input parameters.
                      • Example:

             Event

             open             /CuteNews/

             clickAndWait     link=Add News              link=Add News

             type             name=title                 afternoon news

             select           id=selecsinglecat          label=Hot

             clickAndWait     css=input[type="submit"]

             clickAndWait     link=Logout




Tuesday, January 8, 13
Selenium tests (contd.)
                     • Often capture/replay specific test scenarios
                          (or paths)
                     • Stick with specific input values
                        • The user might have to copy/paste/
                              modify recorded tests and specify new
                              inputs
                         ➜ often focus on some specific functionality
                         ➜ doesn’t scale, costly !


Tuesday, January 8, 13
We can do better with Selenium recored
                                         tests!
                     • How:
                         1. combining test paths (scenarios) to
                            create a test machine (a map, as an
                            analogy) to generate more paths
                         2. fusing available test inputs to infer input
                            partitions, and generate new inputs from
                            that
                         3. combining new paths + new inputs to
                            create new tests

Tuesday, January 8, 13
I. Inferring test machine



Tuesday, January 8, 13
Inferring test machine from available
                                         paths
                     • Simple example illustrating the value of
                          combining test paths
                           Available paths:   1. add, add
                                              2. add, remove, checkout


                                              1. add, add
                            Results by        2. add, remove, checkout
                         combining paths:     3. add, checkout
                                              4. add, add, checkout
                                                                 - +                     Buy                  +



                                                                                               that's easy!
                   Here we are testing a web page that has
                                                                       want to buy!


                   only three buttons: add, remove, and
                   checkout                                                  add      remove      checkout




Tuesday, January 8, 13
Inferring test machine (contd.)

                     • We can do even better: from existing test
                         paths, we infer a test machine (or in a
                         technical terminology: a finite state
                         machine, FSM)
                     • Example:
                         Available paths:            Inferred machine:
                          1. add, checkout                        add

                          2. add, remove, checkout                      remove
                                                          add
                          3. add, add, checkout
                                                                 checkout




Tuesday, January 8, 13
Inferring test machine (contd.)

                     • From the test machine, we can generate
                         more test paths
                     • Example:
                         Inferred machine:               Generated test paths
                                  add            1. add, checkout
                          add           remove
                                                 2. add, remove, checkout
                                                 3. add, add, checkout
                                 checkout
                                                 4. add, add, add, checkout
                                                 5. add, remove, remove, checkout
                                                 6. add, remove, add, remove, checkout
                                                 7. …...

                          ➜ many more test paths are generated!
Tuesday, January 8, 13
2. Inferring test input
                               partitioning



Tuesday, January 8, 13
Test input partitioning
                     •    Input space for even a single variable/parameter is
                          huge
                         •   Example: price of an object can be any non negative
                             number.
                     •    Input space of a set of variables/parameters is even
                          much more larger
                     •    In software testing, we often partition input space of
                          each input into equivalent classes
                         •   Example: input of x is
                             classified into 2 classes:




Tuesday, January 8, 13
Inferring test input partitions
                     •   Test input partitions can be specified by domain experts
                     •   Or inferred automatically (when recorded/logged traces
                         are available)
                         •   concrete data are recored with events
                         •   machine learning techniques can classify such data into
                             clusters, input partitions can then be inferred from
                             them
                         •   Example: from all traces, at the event add(#item), the
                             parameter #item receives the following values:
                             {1,2,3,4,1,2,4,3,1}, we can infer that 1 ≤ #item ≤ 4.
                             Therefore, we can partition the domain of item into 3
                             classes: #item < 1; 1 ≤ #item ≤ 4; #item > 4


Tuesday, January 8, 13
3. Putting them together
                      to generate more tests



Tuesday, January 8, 13
Test generation
                     • Test machine can generate test paths, each
                         path is a sequence of events
                     • The input of each event parameter is
                         partitioned into classes
                     • Now, we can combine the two to generate
                         more test cases
                         • Use pairwise criteria to reduce the
                           number of input combination



Tuesday, January 8, 13
Example
                     •    Test sequence: add(#item), remove(#item)
                     •    #item has 3 partitions: p1: #item < 1; p2:1
                          ≤ #item ≤ 4; and p3: #item > 4
                                      add                     remove

                              p1      p2      p3      p1         p2        p3

                     •    Generated new tests:       add(p1), remove(p1)
                                                     add(p1), remove(p2)
                                                     add(p1), remove(p3)
                                                     add(p2), remove(p1)
                                                     ……………...
                         Concrete values of #item can be randomly generated based
                           on the partition information, example #item = 5 in p3
Tuesday, January 8, 13
Automated tools




Tuesday, January 8, 13
Selen2FSM & M[agi]C
                     • Available at http://selab.fbk.eu/magic
                     • Selen2FSM can infer test machines (or
                         FSMs), and input partitions from existing
                         Selenium tests
                     • M[agi]C takes the FSMs and input partitions
                         and generate executable test cases
                         • In Selenium Webdriver
                         • And Robotium for Android applications
Tuesday, January 8, 13
More info & support
                     •   Selen2FSM & M[agi]C are developed under the
                         support of the FITTEST project
                         •   https://www.facebook.com/FITTESTproject
                         •   More info
                     •   Currently we support Selenium for web
                         testing, and Robotium for Android application
                         •   However, the general idea can be applied for
                             other type of functional testing as well.
                     •   For support, contact cunduy AT fbk DOT eu


Tuesday, January 8, 13

More Related Content

Viewers also liked

MEMS microphone Patent Infringement April 2015 report published by Yole Devel...
MEMS microphone Patent Infringement April 2015 report published by Yole Devel...MEMS microphone Patent Infringement April 2015 report published by Yole Devel...
MEMS microphone Patent Infringement April 2015 report published by Yole Devel...
Yole Developpement
 
Patent fights in pharmaceutical sector
Patent fights in pharmaceutical sectorPatent fights in pharmaceutical sector
Patent fights in pharmaceutical sector
Nitin Patel
 
Patent infringement case
Patent infringement casePatent infringement case
Patent infringement case
Priyanka Nayak
 
Bajaj vs tvs patent infringement - case study
Bajaj vs tvs   patent infringement - case studyBajaj vs tvs   patent infringement - case study
Bajaj vs tvs patent infringement - case study
Altacit Global
 

Viewers also liked (8)

Hemijski elementi u prirodi nemetali,pdf
Hemijski elementi u prirodi   nemetali,pdfHemijski elementi u prirodi   nemetali,pdf
Hemijski elementi u prirodi nemetali,pdf
 
THE PATENT INFRINGEMENT CASE - NEXIUM
THE PATENT INFRINGEMENT CASE - NEXIUMTHE PATENT INFRINGEMENT CASE - NEXIUM
THE PATENT INFRINGEMENT CASE - NEXIUM
 
MEMS microphone Patent Infringement April 2015 report published by Yole Devel...
MEMS microphone Patent Infringement April 2015 report published by Yole Devel...MEMS microphone Patent Infringement April 2015 report published by Yole Devel...
MEMS microphone Patent Infringement April 2015 report published by Yole Devel...
 
Patent fights in pharmaceutical sector
Patent fights in pharmaceutical sectorPatent fights in pharmaceutical sector
Patent fights in pharmaceutical sector
 
Patent infringement case
Patent infringement casePatent infringement case
Patent infringement case
 
Bajaj vs tvs patent infringement - case study
Bajaj vs tvs   patent infringement - case studyBajaj vs tvs   patent infringement - case study
Bajaj vs tvs patent infringement - case study
 
Case studies patent
Case studies patentCase studies patent
Case studies patent
 
Lidings' IP Practice
Lidings' IP PracticeLidings' IP Practice
Lidings' IP Practice
 

Similar to Leveraging selenium tests to generate more effective test cases.

Data Driven Testing
Data Driven TestingData Driven Testing
Data Driven Testing
Maveryx
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Quality
guest268ee8
 
Webservice performance testing with SoapUI
Webservice performance testing with SoapUIWebservice performance testing with SoapUI
Webservice performance testing with SoapUI
Phuoc Nguyen
 

Similar to Leveraging selenium tests to generate more effective test cases. (20)

Lecture (Software Testing).pptx
Lecture (Software Testing).pptxLecture (Software Testing).pptx
Lecture (Software Testing).pptx
 
DoWhy Python library for causal inference: An End-to-End tool
DoWhy Python library for causal inference: An End-to-End toolDoWhy Python library for causal inference: An End-to-End tool
DoWhy Python library for causal inference: An End-to-End tool
 
Introduzione allo Unit Testing
Introduzione allo Unit TestingIntroduzione allo Unit Testing
Introduzione allo Unit Testing
 
How to use Approval Tests for C++ Effectively
How to use Approval Tests for C++ EffectivelyHow to use Approval Tests for C++ Effectively
How to use Approval Tests for C++ Effectively
 
Unit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran JanardhanaUnit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran Janardhana
 
Introduction to JUnit
Introduction to JUnitIntroduction to JUnit
Introduction to JUnit
 
Data Driven Testing
Data Driven TestingData Driven Testing
Data Driven Testing
 
Creating testing tools to support development
Creating testing tools to support developmentCreating testing tools to support development
Creating testing tools to support development
 
Black box testing
Black box testingBlack box testing
Black box testing
 
Growing software from examples
Growing software from examplesGrowing software from examples
Growing software from examples
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Quality
 
Software engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit designSoftware engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit design
 
Webservice performance testing with SoapUI
Webservice performance testing with SoapUIWebservice performance testing with SoapUI
Webservice performance testing with SoapUI
 
Java Unit Test - JUnit
Java Unit Test - JUnitJava Unit Test - JUnit
Java Unit Test - JUnit
 
prova4
prova4prova4
prova4
 
provalast
provalastprovalast
provalast
 
test3
test3test3
test3
 
test2
test2test2
test2
 
domenica3
domenica3domenica3
domenica3
 
provoora
provooraprovoora
provoora
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Leveraging selenium tests to generate more effective test cases.

  • 1. Leveraging Selenium recorded tests to generate more effective tests Author: Cu D. Nguyen, PhD http://selab.fbk.eu/dnguyen/ Tuesday, January 8, 13
  • 2. Selenium tests • A Selenium test consists of a sequence of events and their input parameters. • Example: Event open /CuteNews/ clickAndWait link=Add News link=Add News type name=title afternoon news select id=selecsinglecat label=Hot clickAndWait css=input[type="submit"] clickAndWait link=Logout Tuesday, January 8, 13
  • 3. Selenium tests (contd.) • Often capture/replay specific test scenarios (or paths) • Stick with specific input values • The user might have to copy/paste/ modify recorded tests and specify new inputs ➜ often focus on some specific functionality ➜ doesn’t scale, costly ! Tuesday, January 8, 13
  • 4. We can do better with Selenium recored tests! • How: 1. combining test paths (scenarios) to create a test machine (a map, as an analogy) to generate more paths 2. fusing available test inputs to infer input partitions, and generate new inputs from that 3. combining new paths + new inputs to create new tests Tuesday, January 8, 13
  • 5. I. Inferring test machine Tuesday, January 8, 13
  • 6. Inferring test machine from available paths • Simple example illustrating the value of combining test paths Available paths: 1. add, add 2. add, remove, checkout 1. add, add Results by 2. add, remove, checkout combining paths: 3. add, checkout 4. add, add, checkout - + Buy + that's easy! Here we are testing a web page that has want to buy! only three buttons: add, remove, and checkout add remove checkout Tuesday, January 8, 13
  • 7. Inferring test machine (contd.) • We can do even better: from existing test paths, we infer a test machine (or in a technical terminology: a finite state machine, FSM) • Example: Available paths: Inferred machine: 1. add, checkout add 2. add, remove, checkout remove add 3. add, add, checkout checkout Tuesday, January 8, 13
  • 8. Inferring test machine (contd.) • From the test machine, we can generate more test paths • Example: Inferred machine: Generated test paths add 1. add, checkout add remove 2. add, remove, checkout 3. add, add, checkout checkout 4. add, add, add, checkout 5. add, remove, remove, checkout 6. add, remove, add, remove, checkout 7. …... ➜ many more test paths are generated! Tuesday, January 8, 13
  • 9. 2. Inferring test input partitioning Tuesday, January 8, 13
  • 10. Test input partitioning • Input space for even a single variable/parameter is huge • Example: price of an object can be any non negative number. • Input space of a set of variables/parameters is even much more larger • In software testing, we often partition input space of each input into equivalent classes • Example: input of x is classified into 2 classes: Tuesday, January 8, 13
  • 11. Inferring test input partitions • Test input partitions can be specified by domain experts • Or inferred automatically (when recorded/logged traces are available) • concrete data are recored with events • machine learning techniques can classify such data into clusters, input partitions can then be inferred from them • Example: from all traces, at the event add(#item), the parameter #item receives the following values: {1,2,3,4,1,2,4,3,1}, we can infer that 1 ≤ #item ≤ 4. Therefore, we can partition the domain of item into 3 classes: #item < 1; 1 ≤ #item ≤ 4; #item > 4 Tuesday, January 8, 13
  • 12. 3. Putting them together to generate more tests Tuesday, January 8, 13
  • 13. Test generation • Test machine can generate test paths, each path is a sequence of events • The input of each event parameter is partitioned into classes • Now, we can combine the two to generate more test cases • Use pairwise criteria to reduce the number of input combination Tuesday, January 8, 13
  • 14. Example • Test sequence: add(#item), remove(#item) • #item has 3 partitions: p1: #item < 1; p2:1 ≤ #item ≤ 4; and p3: #item > 4 add remove p1 p2 p3 p1 p2 p3 • Generated new tests: add(p1), remove(p1) add(p1), remove(p2) add(p1), remove(p3) add(p2), remove(p1) ……………... Concrete values of #item can be randomly generated based on the partition information, example #item = 5 in p3 Tuesday, January 8, 13
  • 16. Selen2FSM & M[agi]C • Available at http://selab.fbk.eu/magic • Selen2FSM can infer test machines (or FSMs), and input partitions from existing Selenium tests • M[agi]C takes the FSMs and input partitions and generate executable test cases • In Selenium Webdriver • And Robotium for Android applications Tuesday, January 8, 13
  • 17. More info & support • Selen2FSM & M[agi]C are developed under the support of the FITTEST project • https://www.facebook.com/FITTESTproject • More info • Currently we support Selenium for web testing, and Robotium for Android application • However, the general idea can be applied for other type of functional testing as well. • For support, contact cunduy AT fbk DOT eu Tuesday, January 8, 13