123456789101112131415161718192021222324252627282930 |
- import http from 'k6/http';
- import { sleep } from 'k6';
- import * as apifunc from '../shared/apifunc.js'
- export const options = {
- vus: 20,
- //duration: '30s',
- iterations: 20
- };
- const apiBaseUrl = open('url.txt');
- export default function () {
- const evseNum = apifunc.GetEvseNum();
- const asApiPath = '/api/v1/cpo/activesession';
- const asApiParam = `ChargeBoxId=PHSimulator006${evseNum}`;
-
- var ap = apifunc.GetP(apiBaseUrl, asApiPath,asApiParam,'');
- const asRes = http.get(ap.url , ap.params);
- var asId = apifunc.GetSessionId(asRes);
- //console.log(asId);
-
- const apiPath = '/api/v1/cpo/commands/stop_session';
- const apiParam = `ChargeBoxId=PHSimulator006${evseNum}&SessionId=${asId}`;
- //console.log(apiParam);
- var p = apifunc.GetP(apiBaseUrl, apiPath,apiParam,'');
- const res = http.post(p.url, p.bodyData, p.params);
- console.log(`PHSimulator006${evseNum} ${asId} ` + res.body);
- //sleep(1);
- }
|