Reinforced Selenium test selection using Recommender Systems

Problem Statement

One of our enterprise oracle customers has more than 30,000+ UI & API regression tests for end to end Apps Integration testing. The average time it takes to run these tests (depends on parallelization) is anywhere between 11-12 hours.

With considerable time to complete all regression tests, the objective was to find a working AI model to identify the probable failing test scripts and prioritize them early along with the most critical business automated tests.


Selecting the most promising selenium test scripts to detect application defects may be harder considering the uncertainties on the impact of committed code changes and breakage of many traceability links between code and automated tests. The design was to automatically choose the test scripts and prioritize in CI tool with the goal to minimize round-trip-times between code commits and developer feedback on failed test scripts.

In our devops environment, where new test scripts are created and obsolete tests are deleted constantly, the reinforced method learns to prioritize error-prone test scripts higher under the guidance of a reward function and by observing previous test cycles from historical data. By applying reinforced learning techniques on data extracted, it is evident that reinforcement learning enables better automatic adaptive test script selection and prioritization in CI and automated regression testing.

As the first step, we created a predictive model that estimates the probability of each test failing for a newly proposed build. Instead of defining the model manually, we built it by using a large data set containing results of tests on historical builds/releases and then applying the standard machine learning technique - gradient-boosted decision tree.


  • Code changes based on build metadata
  • Code Owner Information
  • Historical test runs

With this model, we can analyze a particular code change to find all potentially impacted tests that transitively depend on modified files, and then estimate the probability of that test detecting a regression introduced by the change. Based on those estimates, the system selects the tests that are most likely to fail for a particular change. The diagram below shows which tests (shown in blue) would be chosen for a change affecting the two files from the previous example, where the likelihood of each considered is represented by a number between zero and one.

In sum, Our recommender system with reinforcement learning algorithms helps to identify the priority test scripts in runtime, the model helps to move up or down the test scripts from the sequences set at the beginning.

Our github repo:

Process Diagram:


Outline/Structure of the Case Study

1) Common pitfalls in test execution strategy
2) Selenium test traceability with App Source Code (Inspection Bot)
3) History based test case priorization schedules (Rule Engines)
4) Introduction to Reinforcement Learning Algorithm
a) Reward Functions
b) Prioritization using policy
c) State to Action (Memory representation)
5) Scheduling using Reinforcement agents
6) Integration with CI
7) Metrics, Results -> Recommender Systems
8) Our present state and future roadmap

Learning Outcome

The learning outcome would be the following:

  • Implementation of reinforcement algorithms in their existing test suites (of any language)
  • Automated collection of test results and learning to apply them to Machine learning.
  • Automated prioritization / exclusion of tests based on their historical information

In this can help them to go to the next state of test automation in their existing projects.

Target Audience

Any test automation engineer

Prerequisites for Attendees


schedule Submitted 3 years ago

  • Gopinath Jayakumar

    Gopinath Jayakumar / Babu Narayanan Manickam - Expanding boundaries of WebDriver with DevTools Integration

    45 Mins

    Problem Statement

    Though Selenium taking most of the stake in the UI test automation tool market comfortably, there were always challenges that were for selenium test automation engineers are handicapped with especially when dealing with modern JS technologies. For example,

    • dealing with DOM elements to solve the stale / loading / non-interactable elements,
    • handling full screenshots to know how the elements at the left, bottom, etc,
    • measuring the performance of request and response resources at different speeds,
    • monitoring the memory of the pages, controls, etc,
    • attaching to an existing browser for debugging the failed scripts and many more.

    These problems were largely resolved with the integration of selenium with devtool protocols. And that makes the selenium engineer's life merrier than before.

    Why this proposal can be different from others?

    1. Our solution can be executed as independent with chrome dev tools or with selenium. That gives the power back to the automation engineer to choose what and how to debug/run their tests.
    2. We used this solution for one of our largest enterprise customers and moved this solution to public repository this week (for this conference and beyond). With that said, we tested reasonably with more than 10,000+ test scripts and more than 1M tests.
    3. The present solution is completely (100%) packed with all Chrome Dev Tools API in Java and with that said, any Java Selenium automation engineer can bind in minutes for their existing code base with no additional dependencies.
    4. Finally, we love to present at the local home to start our selenium conference campaign. Where else?


    The present proposal largely connected with Chrome and Selenium in Java language. However, there is no limitation to expand the boundaries for other language bindings and browsers.

    Google Chrome, the most picked browser for browsing, which makes it the primary concentration for developers and testers. DevTools is one such boon for developers, testers especially the new aged test automation engineers. With that said, we built the following design pattern to allow chrome dev tools API to marry Selenium using debugger address / remote targets.

    Selenium Devtools

  • Babu Narayanan Manickam

    Babu Narayanan Manickam - Deep Learning Based Selenium Test Failure-triage Classification Systems

    45 Mins

    Problem Statement:

    While running thousands of automated test scripts on every nightly test schedule, we see a mixed test result of pass and failures. The problem begins when there is a heap of failed tests, we caught in the test-automation trap: unable to complete the test-failure triage from a preceding automated test run before the next testable build was released.

    Deep Learning Model:

    The classification was achieved by introducing Machine Learning in the initial months and followed by Deep Learning algorithms into our Selenium, Appium automation tests. Our major classification was based on the failed test cases: Script, Data, Environment, and Application Under Test and that internally had hundreds of sub-classifications.

    To overcome this problem, we started to build and train an AI using Deep Learning, which simulates a human to categorize the test case result suite. Based on the test result failure for each test, the AI model would predict an outcome through API, categorizes and prioritize on the scale of 0 to 1. Based on the prediction model, the algorithm takes appropriate response actions on those test cases that are failed like re-run test again or run for different capabilities. We kick-started this by gathering the historical data set of 1.6 million records, which was collected over a 12 months period, data including the behavior of the test case execution and the resulting suite.

    This Deep Learning-based algorithm has been provided the quality to break down the new defects based on its category, and a classification score is given on a scale of 0-1. We’ve also established a cutoff threshold based on its accuracy of improving, and to group the failed test cases based on its similarity. Classification of the test cases is done in high granularity for sophisticated analysis, and our statistical report states that the classification of the defects has been increased with 87% accuracy over a year. The system has been built based on the feedback adapting models, where for each right classification it will be rewarded and for the wrong, a penalty is given. So whenever receiving a penalty the system will automatically enhance itself for the next execution.

    The algorithm has a powerful model for detecting false-positive test results calculated using the snapshot comparisons, test steps count, script execution time and the log messages. Also, the model has been built with other features like – duplicate failure detection, re-try algorithms and defect logging API, etc.

    The entire classification system has been packaged and deployed in the cloud where it can be used as a REST service. The application has been built with its own reinforcement learning where it uses the classification score to enhance itself and this is programmed to perform in an inconclusive range.

    In sum, this deep learning solution can assist all Selenium testers to classify their test results in no-time and can assist to take next steps automatically and allow team could focus its efforts on new test failures.


  • Gopinath Jayakumar

    Gopinath Jayakumar / Babu Narayanan Manickam - Selenium Internals in Python Programming - Workshop

    90 Mins

    Are you keen to know Selenium 4.x(experimental) deeper with internal architecture and workings with its dearest drivers and its API in Python programming? Are you in Selenium with other language bindings and willing to cross-skill in Python to make up for the deep learning/machine learning/data science projects?

    If one of the above is yes, this workshop will get your hands dirty with practical exposure with several webdriver commands in modern applications and of course, the course is designed to assist all levels of test automation engineers experience.

    In sum, all attendees of this workshop will sign off with a working selenium codebase in python with git repo and best practices to deploy using pytest framework on their projects.