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

PDF
Factories, mocks and spies: a tester's little helpers
PPTX
java- Abstract Window toolkit
PDF
JUnit Pioneer
PPTX
Indirect infringement of patents
PDF
Commercialization and Patent Infringement
PPT
016 patent infringement
PPTX
Louis vuitton Vs. Google
PPTX
Nokia vs iphone Case Study and iPhone PPT template
Factories, mocks and spies: a tester's little helpers
java- Abstract Window toolkit
JUnit Pioneer
Indirect infringement of patents
Commercialization and Patent Infringement
016 patent infringement
Louis vuitton Vs. Google
Nokia vs iphone Case Study and iPhone PPT template

Viewers also liked (8)

PDF
Hemijski elementi u prirodi nemetali,pdf
PPTX
THE PATENT INFRINGEMENT CASE - NEXIUM
PDF
MEMS microphone Patent Infringement April 2015 report published by Yole Devel...
PPTX
Patent fights in pharmaceutical sector
PPTX
Patent infringement case
PPT
Bajaj vs tvs patent infringement - case study
PDF
Case studies patent
PDF
Lidings' IP Practice
Hemijski elementi u prirodi nemetali,pdf
THE PATENT INFRINGEMENT CASE - NEXIUM
MEMS microphone Patent Infringement April 2015 report published by Yole Devel...
Patent fights in pharmaceutical sector
Patent infringement case
Bajaj vs tvs patent infringement - case study
Case studies patent
Lidings' IP Practice
Ad

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

PDF
Webapp acceptance testing a case study
PPTX
Basic Selenium Training
PPTX
Selenium digitalinfobytes-120829005812-phpapp02
PPTX
Top100summit christina
PDF
Future of test automation tools & infrastructure
PDF
Automated Test Case Generation and Execution from Models
PDF
最终版Top100summit 耿晓倩-automation test framework continue improvement
PDF
Seconf2011 database driven combinatorial testing
PDF
PyML - a Python Machine Learning package
PDF
The Testing Planet - July 2010
KEY
Building Enterprise Apps for Big Data with Cascading
KEY
Mining Cause Effect Chains from Version Archives - ISSRE 2011
PDF
www.webre24h.com - [O`reilly] javascript cookbook - [powers]
PDF
Changes and Bugs: Mining and Predicting Development Activities
PDF
Cascading meetup #4 @ BlueKai
KEY
A Data Scientist And A Log File Walk Into A Bar...
PDF
Automation strategies for agile testing Gaurav bansal
PDF
JavaScript for Flex Devs
PDF
ATDD for Web Apps
PDF
Bug Prediction Based on Fine-Grained Module Histories
Webapp acceptance testing a case study
Basic Selenium Training
Selenium digitalinfobytes-120829005812-phpapp02
Top100summit christina
Future of test automation tools & infrastructure
Automated Test Case Generation and Execution from Models
最终版Top100summit 耿晓倩-automation test framework continue improvement
Seconf2011 database driven combinatorial testing
PyML - a Python Machine Learning package
The Testing Planet - July 2010
Building Enterprise Apps for Big Data with Cascading
Mining Cause Effect Chains from Version Archives - ISSRE 2011
www.webre24h.com - [O`reilly] javascript cookbook - [powers]
Changes and Bugs: Mining and Predicting Development Activities
Cascading meetup #4 @ BlueKai
A Data Scientist And A Log File Walk Into A Bar...
Automation strategies for agile testing Gaurav bansal
JavaScript for Flex Devs
ATDD for Web Apps
Bug Prediction Based on Fine-Grained Module Histories
Ad

Recently uploaded (20)

PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PPTX
Microsoft Excel 365/2024 Beginner's training
PDF
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PPTX
Configure Apache Mutual Authentication
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
Modernising the Digital Integration Hub
PPT
Geologic Time for studying geology for geologist
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
The various Industrial Revolutions .pptx
DOCX
search engine optimization ppt fir known well about this
PDF
A review of recent deep learning applications in wood surface defect identifi...
PPTX
2018-HIPAA-Renewal-Training for executives
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Flame analysis and combustion estimation using large language and vision assi...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
The influence of sentiment analysis in enhancing early warning system model f...
Microsoft Excel 365/2024 Beginner's training
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
Configure Apache Mutual Authentication
Zenith AI: Advanced Artificial Intelligence
Modernising the Digital Integration Hub
Geologic Time for studying geology for geologist
NewMind AI Weekly Chronicles – August ’25 Week III
The various Industrial Revolutions .pptx
search engine optimization ppt fir known well about this
A review of recent deep learning applications in wood surface defect identifi...
2018-HIPAA-Renewal-Training for executives
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Convolutional neural network based encoder-decoder for efficient real-time ob...
sustainability-14-14877-v2.pddhzftheheeeee
Hindi spoken digit analysis for native and non-native speakers
1 - Historical Antecedents, Social Consideration.pdf
Flame analysis and combustion estimation using large language and vision assi...

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