SprocketMonkey - (in)finite monkey theorem about Sprocket

Testing a web browser can be approached from several different angles. One can test performance, responsiveness, correctness of page layout or even the behavior of a web site in different user interactions.

If you have read our previous blog post you may know that we have a web browser project - named Sprocket. Even though the underlying components - for example Content API - are tested thoroughly, we would like to improve the testing process with an additional test-framework using monkey testing. Monkey testing is one of the most popular blackbox testing methods. Its point is to give random inputs to a program in order to discover unexpected behavior.

Monkey testing can be easily automated with the help of an already implemented test framework, Selenium, which is an especially good option for blackbox testing of browsers or web applications. It consists of two parts: a client and a server. The client part is called the Selenium client driver and the server part is the webdriver.

A test driven by Selenium uses the client driver's API, available from several languages: Java, Python, Ruby, Javascript (Node), C#. The webdriver plays a critical role in this whole process. You can think of it as a middle-man, because it redirects the client's calls to the browser, and returns the results from the browser to the client. The webdriver is also an API with different implementations for the most popular browsers, for example: FirefoxDriver, ChromeDriver, SafariDriver etc. Sprocket is built on the Content API, so it uses the ChromeDriver which is part of the Chromium project. Sprocket's Linux version works with the official ChromeDriver out of the box, and we could get monkey testing work with Sprocket's Android version as well, by adding a simple patch to the original ChromeDriver. The patch and the building instructions can be found on Sprocket's testing branch. With these changes and the help of Python API we can introduce SprocketMonkey.

If you would like to get into the details you can also check out how we have added the support of Chromium’s Developer Tools to our browser. In addition, if you would like to try out the tool, the following example shows how to connect to Sprocket on Linux through Selenium’s Python API.

First, ChromeDriver should be in your path. Launch a Python shell:


>>> from selenium import webdriver  
>>> options = webdriver.ChromeOptions()  
>>> options.binary_location = '/path/to/sprocket'  
>>> driver = webdriver.Chrome(chrome_options=options)  

Now an empty Sprocket window should be shown. To load a webpage, execute:


>>> driver.get('url') #the URL should be given with the http:// prefix

After that there are lots of options to start with. Here is a little overview about navigating, form filling, etc. Under this link you can read further details about the WebDriver API.

You can check out how SprocketMonkey deals with the connection to the WebDriver both on Linux and on Android platforms. Currently SprocketMonkey supports the following actions:

  • send random mouse events to any element
    • click, drag and drop, long click, double click, right click
  • send random key events to any element
  • scroll to any random position on the page
  • smart click (click on clickable elements: links, buttons, etc.)
  • form filling with random strings
  • send random touch events to elements

If you are interested, try out SprocketMonkey on your website / web application!

Happy Monkey Dance!

On behalf of the Sprocket team

Edit Balint

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • No HTML tags allowed
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Fill in the blank