Package: locust-nest
locust-nestLocust wrapper. Import Locust classes from a folder and run Locust using those classes with weights determined in a config file,
with an option to guide the generation of the config file.locust-nest docslocust-nest pip packagelocust-nest source codeLocust.ioLocust docsLocust source codeWhat is locust-nest for?locust-nest is a wrapper around Locust to simplify load testing.Use locust-nest forload generation.Unit tests or live user testing will tell you if your system works for 1 user, locust-nest will show you if it can scale to 100, 1000 or 100,000 simultaneous users.It allows you to configure the weighting of each of your Locust classes so that you can run different load scenarios without changing any Python code.Installationpipinstalllocust-nestThe following will create an example file and script in the [example/] dir:locust-nestinstall[example/]Note: At the moment locust-nest usespslocustto provide more current Locust features than the current Locust release.Quick startlocust-nest is designed to provide a framework for simulating a specified load on a system.Behaviour models are codified using Locust, an open-source load testing tool that allows abitrarily complex user behaviour modelling since all tasks are written in Python.This wrapper searches all.pyfiles in the--model_dir (-d)directory and subdirectories for subclasses ofLocustand runs Locust with all of those classes.To run locust-nest, simply use locust-nest command with default Locust arguments:locust-nest--model_dir=models/--host=https://www.example.com...To be guided through the generation of a config file, use the--configureflag:locust-nest--configure--host=https://www.example.com...An example structure for one of these TaskSets is:fromlocustimportTaskSet,taskclassModelBehaviour(TaskSet):weight=0defon_start(self):# Log in & save token# retrieve bulk information needed for other tasks# other to-dos on starting this group of taskspassdefon_stop(self):# unclaim resources e.g. usernamepass@task(5)# task decorator with relative weight of executing the taskdefmodel_action(self):# codified behaviour of a particular action this model may perform# e.g. registering a customerreturnIf the--include-tasksets (-T)flag is used, it will also find all subclasses ofTaskSetand add these to aNestTaskset,
which packages all the tasks with their desired weights into aHTTPLocustclass.
of those classes, with weights specified in a--config_file.
Note: Python 2 does not have support for recursive subdirectories, so at the moment only searches 1 directory deep{model_dir}/*/Workflowlocust-nest will import all TaskSets frommodels/into one NestLocust, weighting according to--config_file.locust-nest will find all Locust’s, weighting according to--config_file.Display weightings that will be used with confirmation prompt (skippable with some commandline argument).Run Locust with weightings set from config for the Locusts and NestLocust classeslocust-nest will have an option to automatically manage distributed resources for Locust master-slave mode. (NOT IMPLEMENTED)Example TaskSetfromlocustimportTaskSet,taskclassExampleModel(TaskSet):weight=0defon_start(self):"""Set up before running tasks.

        For example:
        * Log in & save token
        * Retrieve bulk information needed for other tasks

        """returndefon_stop(self):"""Teardown: unclaim resources e.g. claimed user.

        """return# task decorator with relative weight of executing the task@task(5)defmodel_action(self):"""Codified behaviour of a particular action this model may perform
        e.g. registering a customer

        """self.client.get("/")returnAims of locust-nestUsers will be able to place any number of directories containing TaskSets
and Locusts with each representing an encapsulated group of tasks.locust-nest will find all TaskSets contained in a specified directory
and group them into one Locust class with corresponding weights specified
in a config file, allowing easy modularity in adding or removing TaskSets
without needing to change any code in the locust-nest repository. Locusts
will also be found and configured with specific weights.There will be an interactive configure option which creates a config file
that specifies the relative weights of each TaskSet, allowing users to easily
adjust the different ratios of TaskSet types, but still allowing non-interactive
use of the system when the config file has been created.locust-nest will be automatable, ideally callable with a git hook for load-testing
continuous integration or in response to a Slack command. The results will be human readable,
ideally some kind of index of scalability of the system, so that the evolution of the system
under test’s scalability can be tracked.locust-nest will be able to automatically deploy to AWS Lambda or equivalent and
run load testing under the distributed master-slave variant in order to be able
to easily scale arbitrarily.