Skip to content

louposk/locust-wiremock-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Locust and Wiremock playground

Locust

Locust is an easy to use, scriptable and scalable performance testing tool written in Python.

You define the behaviour of your users in regular Python code, instead of being stuck in a UI or restrictive domain specific language.

This makes Locust infinitely expandable and very developer friendly.

More info: https://locust.io/

Wiremock

WireMock is an HTTP mock server. At its core it is web server that can be primed to serve canned responses to particular requests (stubbing) and that captures incoming requests so that they can be checked later (verification).

It also has an assortment of other useful features including record/playback of interactions with other APIs, injection of faults and delays, simulation of stateful behaviour.

It can be used as a library by any JVM application, or run as a standalone process either on the same host as the system under test or a remote server.

All of WireMock’s features are accessible via its REST (JSON) interface and its Java API. Additionally, stubs can be configured via JSON files.

More info: https://wiremock.org/

Prerequisites

  1. Pythom
  2. Java 11

Preparatiom

Wiremock start

The package already includes the wiremock package. Navigate to wiremock folder and execute the following command:

java -jar wiremock-studio-2.32.0-18.jar

In case Java 11 is not your default version, you can use the following:

"/c/Program Files/Java/jdk-11.0.11/bin/java" -jar wiremock-studio-2.32.0-18.jar

This will fireup the wiremock localhost, and you are able now to see the available apis: image

Now that Wiremock is up and running you can open your browser and navigate to the Wiremock url admin panel http://localhost:9000 to see the "Services API" that works in http://localhost:8080

Locust

To install locust (https://docs.locust.io/en/stable/installation.html), execute the following command:

pip3 install locust

image

To verify the installation:

locust -V

image

Execution

Test with no parameters

The playground contains 3 diferent locust files.

To execute a test, just run the following:

locust -f=sample1.py

After each execution, a localhost is provided by Locust, where you can open it in your browser: image

When the "Start swarming" is pressed, the execution starts: image

Test with parameters

To add more command properties, the command can be updated:

locust -f sample1 -u 10 -r 3 -H http://localhost:8000

More commands can be found here: https://docs.locust.io/en/stable/configuration.html#all-available-configuration-options

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages