Code Monkey home page Code Monkey logo

woocommerce-load-test's Introduction

WooCommerce ReST API Load Test Script

Sends traffic to a WooCommerce site, usually a development environment. Places unpaid orders using a ReST API authorized account.

Uses the Artillery.io project based on Node.JS

Also includes a synthetic test script powered by Puppeteer project

Prerequisites

First, install Node.JS onto your workstation, if not already installed.

Download it from this link

Or, to update an existing installation:

sudo npm install -g npm@latest --unsafe-perm=true --allow-root

Next, install or update the artillery.io project:

sudo npm install -g artillery@latest --unsafe-perm=true --allow-root

Running the load test

  • Download this project to your workstation and change directory to it.
  • Create a read/write access ReST API account from WP Admin > WooCommerce > Settings > Advanced > REST API.
  • Put your ReST account key and secret values into a base64 Hash generator formatted as key:secret to get your authentication hash.
  • Make a CSV file loadtest_payload.csv with several lines containing input data: Name,ProductID,Quantity,AuthHash
  • Edit the YML file and ensure the duration, arrivalRate, and rampTo values are low for your initial test.
  • Edit the YML file and change the target value to the development site you wish to load test.
  • Disable emails on your sandbox site under WooCommerce > Settings > Emails.
  • Run artillery run loadtest_rest_api.yml -o results.json to execute your test and see the results in standard output.
  • Enter artillery report results.json to view a graphical report of results.
  • If you run into any errors, try debugging with the loadtest_monitor.js file response body function.

Further Notes

  • I recommend having an application performance monitoring tool running on your development environment so you can examine the bottlenecks that load testing exposes. The most popular tool is New Relic.
  • The CSV file records are used randomly for load test source data. You can put as few or as many records in there you wish.
  • Refer to the Artillery.io documentation for details on configuration.

Synthetic Test

  • First, install or update Puppeteer by running sudo npm install -g puppeteer@latest --unsafe-perm=true --allow-root
  • Run Puppeteer (Chromium headless browser) with our test script node synthetic-standalone.js

Synthetic Load Test

  • Run artillery run loadtest_synthetic.yml -o results.json.
  • Enter artillery report results.json to view a graphical report of results.

Author

License

This project is licensed under the MIT License - see the LICENSE file for details

woocommerce-load-test's People

Contributors

seanconklin avatar

Stargazers

Semi avatar Jorden Liu Chin Hao avatar Héctor Sabillón avatar  avatar Abdullah Ramzan avatar William Majanja avatar  avatar Hans Hsu avatar

Watchers

James Cloos avatar  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.