Artillery Plugins
What you'll learn
- How to install Artillery plugins
- How to use plugins in your test definitions
Overview
Artillery has support for plugins, which can add functionality and extend its built-in features. Plugins can hook into Artillery's internal APIs and extend its behavior with new capabilities.
Plugins are distributed as normal npm packages which are named with an artillery-plugin-
prefix, e.g. artillery-plugin-expect
.
Installing plugins
Plugins can be installed with npm
or yarn
in the same way as any other module. If Artillery is installed globally (i.e. with npm install -g artillery
), plugins should be installed globally too:
npm install artillery-plugin-expect
If Artillery is installed locally to a project (i.e. a directory with package.json
in it), plugins should be installed as a normal dependency:
npm install -D artillery-plugin-expect
Using plugins
To use a plugin's functionality when running a test script that makes use of it, the plugin needs to be loaded via config.plugins
in the test script.
For example, to load the functionality provided by artillery-plugin-expect
, add expect
under config.plugins
:
config:
target: "https://service-foo.preprod.acmecorp.digital"
plugins:
expect: {}
By convention, Artillery will try to load npm package with the name of artillery-plugin-expect
for that configuration.
In this example, we are not providing any configuration for the expect
plugin, but most plugins will allow for some configuration.