Ive been working with K6 recently and need to test my API, the login function needs a json in order to get the data but it does not get called on the run, heres my code for the script
import http from 'k6/http';
import { sleep } from 'k6';
export default function () {
let strGlobalUrl = '192.168.0.1';
let url = 'http://'+strGlobalUrl+'/api/CompanyLogin';
let data = JSON.stringify({
strEmail : 'email',
strPassword : 'password',
boolLoginPage : true
});
let params = {
headers: {
'Content-Type': 'application/json',
'dataType': 'json'
}
};
let res = http.post(url, data, params);
console.log(res.intResponse);
}
It should call the function and get print 200 on the console log, theres something I do wrong or is missing?
I got the answer from my boss, I forgot to include ':5050' in the value of strGlobalUrl due Im testing in my local copy of the server
I hope this would help someone else