Code Monkey home page Code Monkey logo

selenium-reinforcement-learning's Introduction

Selenium Reinforcement Learning

We have to change the way we are doing testing and integrate smarter tools in our everyday workflows.

UI tests are hard to write, flaky, with minimum explainability and hard to maintain. But on the other hand are easy to formulate and reason in high level.

I strongly believe that all the above can be simplified by introducing user-guided AI/ML algorithms in between.

Goals

UI Tests are hard to write

This repository attempts to solve this using AI (reinforcement learning) to provide an automatic way of discovering the path of actions that are need to be taken to reach a goal (the element under test).

It does that with a training process on a goal and then running the test with the trained guidance.

Flaky tests

The best way to decrease flaky tests is to increase explainability and manage those edge cases. This will allow to map the ones that are problems because of f.ex. network and retry the test until the systems around the system under test are stable. This repo will try to provide a framework for reliable error identification to tackle this issue, probably involving some ML.

Hard to maintain

UI tests needs updates correlated to almost any UI change - CSS, JS, HTML even when using the best practices. This is almost eliminated due to te fact when you train a UI test, it manages to find each own way to the goal. The next challenge here is to be able to find out when to train again, and how to create an efficient process around that is continuous-deployment and DevOps friendly.

In detail

In detail, the goals of the project are:

  • Create a framework that abstracts trainable steps with composite step tests
  • Provide tooling that trains/replays workflows without breaking your UI tests
  • Provide ordering logic
  • Be extremely reliable either when training or stepping forward from a matrix
  • Provide an error module that can reliably provide error reporting during training
  • Performance: Training should be fast as possible
  • Be pipeline and DevOps process friendly

Reinforcement Learning

The algorithm used for training is Q-Learning. It creates a discreet Q Matrix using a set of predefined actions and rules to achieve a goal as fast as possible.

You can learn more about the actual algorithm at wikipedia.

Why Q-Learning?

Q-Learning has the advantage that works really well in discrete state and action space, exactly what a user is doing on a page.

For this to work correctly this repo is ignoring the timing dimension (because that is included in the state in browser systems) and replaces that with "user wait" mechanic.

Example

There is a full end to end example that you can see this in action. Just run the tests marked at 1,2,3 in consecutive order and watch how the trained output is been used to navigate the site.

You can debug the tests in order to see the algorithm in action in the local chromium browser.

Feedback

If you have any questions and/or feedback feel free to create an issue/discussion.

License

The code is licensed under Apache 2.0 license.

selenium-reinforcement-learning's People

Contributors

phaetto avatar

Stargazers

Tao Ling avatar Samuel Elder avatar Tunahan Aktaş avatar  avatar Shahul Hameed M Y avatar  avatar  avatar Efkan Akın avatar Sasha Bolotnov avatar  avatar Miguel Angel avatar Jose de Lima avatar John Kinnebrew avatar  avatar Egor Danko avatar Connor Grady avatar YIPMONG avatar  avatar Wasiq Bhamla avatar Nathan Fulton avatar Erebus Etherie avatar Nathan avatar  avatar  avatar Vignesh avatar Caner NAYKI avatar  avatar Lucas Alberto avatar  avatar

Watchers

James Cloos avatar Samuel Elder avatar  avatar

selenium-reinforcement-learning's Issues

Interesting project, how to run it ?

This is a very interesting project. Wanted to try it out, but clueless on how to run it ?

I see there is Index_EndToEndOrder.cs with 3 methods and need to run in the same order but how to launch the test ? I dont see anything in Visual Studio test explorer. Need to start test from command line ? Should it launch a chrome browser ?

Would appreciate input.

Project status

Dear @phaetto ,

I was searching some projects on Selenium +C# for AI/ML and came across your repository. I have gone though the codebase and it looks very interesting.

Just wondering about the status of the project and looking for few more details about how to use or a simple user guide.

Thanks,
Thanks for your awesome work!!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.