Hi i found the repository "https://github.com/shoreditch-ops/artillery-engine-kinesis" which seems to solve exactly what i need - writing my own engine.. I did it already by forking the whole artillery repository and got it running, but it feels as a total overkill to fork the whole thing just to introduce a new engine.
But when i see code like this:
let runnerEngines = _.map(
Object.assign({}, Engines, runnableScript.config.engines),
function loadEngine(engineConfig, engineName) {
let moduleName = 'artillery-engine-' + engineName;
try {
if (Engines[engineName]) {
moduleName = './engine_' + engineName;
}
let Engine = require(moduleName);
....
-> the runner code is hardcoded looking into his own folder relatively with all the entries of "Engines"... i don't see how this should be dynamically able to pick up some new written engines at all oO
So... how should this work?
hi @rvetere, the way to get it going locally is:
npm install in the directory, this will let you run a local copy of Artillery with ./bin/artilleryartillery-engine-rvetere) run npm linknpm link artillery-engine-rvetere (more info on npm link)This will allow that copy of Artillery to find and load your custom engine. It's important that you set the engine field of your scenario:
config:
target: "some.target"
scenarios:
- name: "Custom engine scenario"
engine: "rvetere"
flow:
- do: something
- do: something else
Another way to do this is to create a package that has a dependency on both artillery and your custom engine (could be installed from ./artillery-engine-custom), this way artillery core will be able to require in your custom engine correctly.
In your root project folder:
An artillery script using your custom engine.
{
"name": "my-load-tests",
"version": "0.1.0",
"scripts": {
"test": "artillery run ./my-script.yml"
},
"dependencies": {
"artillery": "^1.6.0-27",
"artillery-engine-realm": "file:artillery-engine-custom"
}
}
artillery-engine-customThis should be a module named "artillery-engine-custom" which main script should export an engine.
Most helpful comment
Another way to do this is to create a package that has a dependency on both artillery and your custom engine (could be installed from
./artillery-engine-custom), this way artillery core will be able to require in your custom engine correctly.In your root project folder:
my-script.yml
An artillery script using your custom engine.
package.json
A directory called
artillery-engine-customThis should be a module named "artillery-engine-custom" which main script should export an engine.