Giter Site home page Giter Site logo

monkey-cypress's Introduction

Cypress Random Tester (Monkey)

This repository contains the code for a random tester developed using Cypress. Two versions are developed, including a full random tester and a smarter random tester, and the differences between these two remain in the type of commands that each can execute. The detail is explained in sections below

How to run

In order to use the tester, you will have to follow these steps:

  • Get the source code from this repository: Click on Download as Zip and unzip the folder in your machine or clone the repo
  • Install the required modules: Using Node Package Manager, run npm install on the root folder; this will install the cypress CLI module and other dependencies, which are the faker module and a cypress plugin for pressing the tab key, along with another plugin for capturing the browser console output. In case you already have cypress installed, it is better to avoid installing it again in this folder; for this, run the commands npm install faker, npm install -D cypress-log-to-output and npm install -D cypress-plugin-tab individually.
  • Configure the desired parameters: The repository's root folder contains two JSON files which have the configuration parameters for each test. Open them and edit the parameters as needed. You can change the baseURL, the seed for the test, the percentage of events, the delay between events, and the number of events.
  • Run the desired tester: The commands for running the tests must be executed from the root folder, so do not forget to change de directory again with the cd command. For the random tester, run cypress run --config-file ./monkey-config.json. For the slightly smarter random tester, run cypress run --config-file ./smart-monkey-config.json.

* Note: The default browser is Electron 78 in headless mode. In order to test another browser, add the --browser <browser-name-or-path> option to the run command, indicating which of the supported browsers you want to use

The testers

Cypress is an E2E test runner built over JavaScript. We used this technology due to the facility for managing web pages in a variety of browsers including Chrome, Canary, Edge, Electron, etc. and the record-and-replay functionality. The idea of the first tester is to perform a completely random test on a web application, inspired on a similar tester, the Android Monkey. The second tester exists due to the high rate of errors and low probability of getting events that change the application's state of the Monkey tester.

Events

After evaluating a series of possible events, we defined the following 8 categories in which the events could be grouped by:

  • Random Click Events: Left, Right or Double clicks performed to an element from a random position
  • Scroll Events: Scrolling the page up, down, to the left or to the right.
  • Selector Focus Events: Focusing on elements from a random position, considering their HTML tags. The equivalent for pressing tab into a focusable element
  • Keypress Events: Introducing a character inside of a focused element. The equivalent for pressing a key from the keyboard when focusing an element.
  • Special Keypress Events: Typing special characters inside of a focused element. The special keys include Enter, Supr, Esc, Backspace, Arrows, and possible modifiers such as Shift, Alt or Ctrl.
  • Page Navigation Events: Typical navigation that an user could perform, go to the last page or to the next page in the navigation Stack.
  • Browser Chaotic Events: Events that change the browser configuration such as changing the viewport, clearing local storage or clearing the cookies.
  • Selector Click Events: Clicks performed to a specific type of element considering the HTML tags that typically induce an interaction such as <a>, <button>, <input type="submit">; also, events of filling and clearing an input element.

Results

When the test finishes running, an HTML report and a video of the execution in a browser will be generated in the results folder.

monkey-cypress's People

Contributors

jespitiaa avatar caev03 avatar

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.