I am using nodejs with express.
I have created a signup form with some fields. I want to check when 1000 user signups on same time. What will happen? Is there is any module available or any simple example. How to enter fake data.
How can i write a test case for that. I googled it, but didn't get result.
Thanks
Use faker to generate the fake data and request to send the data to the server. You can use async.each
to asynchronously do 1000 signups at the same time.
var faker = require('faker');
var async = require('async');
var number_of_signups = 1000;
var identities = [];
for (var i=0; i < number_of_signups; i++) {
identities.push({
name: faker.name.findName(),
email: faker.internet.email(),
password: faker.internet.password()
});
}
function submit(identity, callback) {
var opts = {
url: 'http://youdomain.com/signup-endpoint',
method: 'POST',
json: identity
};
request(opts, function(err, connection, body) {
if(err) return callback(err);
callback();
});
}
async.each(identities, submit, function(err) {
if(err) throw err;
console.log('done...');
process.exit();
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments