The use case that I have is that I have a config file of login/passwords and environment settings that I want to load into the context before the scenarios are run. My current work around is to have a dummy request to an innocuous endpoint that uses a beforeRequest hook to init the context.
What I'd like to have is a parameter in the config block that either loads a config file into the context or an init hook that will call the processor to initialize the context from my config files.
@JohnieLee there's a way to run an arbitrary function using a function step, e.g.:
scenarios:
- name: "A scenario"
flow:
- function: "setupContext"
- get:
url: "/some/endpoint/{{ someId }}"
where setupContext is something like:
function setupContext(context, ee, done) {
context.vars.someId = 12345;
return done();
}
Does this do what you need to do?
@hassy I think it's more about something that is run prior any scenario is picked, and only once per artillery run.
I'd even like a shutdown hook, as I'd then be able to do some automated cleanup of any temp file I'd generate during the run.
Going to close this as we have #131 already, which I'll add on to the 2.0 list.
Most helpful comment
@hassy I think it's more about something that is run prior any scenario is picked, and only once per artillery run.
I'd even like a
shutdownhook, as I'd then be able to do some automated cleanup of any temp file I'd generate during the run.