I want to execute logout function for one time and dropDown function for multiple iterations. Which changes shoul I need in below code.
executors: {
logout: {
type: 'per-vu-iterations',
exec: 'logout',
vus: 1,
iterations: 1,
startTime: '30s',
maxDuration: '1m',
tags: { my_tag: 'LOGOUT'},
},
}};
export function logout() {
group('Logout API', () => {
loginFunctions.logout_api();
})
}
export function dropDown() {
group('Drop Down API', () => {
loginFunctions.dropDown_api();
})
}
export default function () {
logout();
dropDown();
}
Also without default function it's not working. getting executor default: function 'default' not found in exports this error
Not sure where you saw
executors
, that was the old name of the option, before #1007 was merged and released. The new and correct name isscenarios
: https://k6.io/docs/using-k6/scenariosSo, to answer your question, the code should look somewhat like this:
Though, depending on your use case, the best place for the
logout()
code might actually be in theteardown()
lifecycle function? See https://k6.io/docs/using-k6/test-life-cycle for more details