Adding in a spike test script and equivalent tests within the script
A spike test verifies whether the system survives and performs under sudden and massive rushes of utilization. Spike testing increases to extremely high loads in a very short or non-existent ramp-up time. Usually, it has no plateau period or is very brief, as real users generally do not stick around doing extra steps in these situations. In the same way, the ramp-down is very fast or non-existent, letting the process iterate only once.
Example script code for spike testing:
import http from 'k6/http';
import {sleep} from 'k6';
export const options = {
// Key configurations for spike in this section
stages: [
{ duration: '2m', target: 2000 }, // fast ramp-up to a high point
// No plateau
{ duration: '1m', target: 0 }, // quick ramp-down to 0 users
],
};
export default () => {
const urlRes = http.get('https://test-api.k6.io');
sleep(1);
// MORE STEPS
// Add only the processes that will be on high demand
// Step1
// Step2
// etc.
};
Adding in a spike test script and equivalent tests within the script
A spike test verifies whether the system survives and performs under sudden and massive rushes of utilization. Spike testing increases to extremely high loads in a very short or non-existent ramp-up time. Usually, it has no plateau period or is very brief, as real users generally do not stick around doing extra steps in these situations. In the same way, the ramp-down is very fast or non-existent, letting the process iterate only once.
Example script code for spike testing: