Skip to content

Instantly share code, notes, and snippets.

@pafnuty
Forked from elexfreeman/Crash.test.ts
Created March 14, 2022 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pafnuty/04f001bb476f1705fc376f736ea366bf to your computer and use it in GitHub Desktop.
Save pafnuty/04f001bb476f1705fc376f736ea366bf to your computer and use it in GitHub Desktop.
process.env.TS_NODE_PROJECT = './tsconfig.json';
import * as moment from 'moment'
import * as mocha from 'mocha';
import { assert } from 'chai';
import axios from "axios";
const run = async () => {
await describe('site load testing', async () => {
it('Lets go!', async () => {
/* ALERT!!!! */
const processCount = 2000;
const testUrl = 'http://localhost:80/user/getUserInfo';
async function testFnc(counter: number) {
let startTime = moment().format('mm:ss');
let resp = await axios.get(testUrl, {});
console.log('Time:: ' + startTime + '-' + moment().format('mm:ss'), ' , Cunter:: ' + counter + ' , Status:: ' + resp.status);
}
for (let i = 0; i < processCount; i++) {
testFnc(i);
}
assert.ok(true);
}).timeout(5000);
});
};
run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment