Simple API Test Framework
Ucuptest.js an API testing tool built on top of Axios that makes testing API endpoints easy, fast and fun.
Install Ucuptest from NPM into your project:
npm i ucuptest
The minimum setup to run a single test expectation.
const { Ucuptest, Joi, assert } = require('./ucuptest');
const ucuptest = new Ucuptest();
ucuptest.setBaseUrl('https://balsam-loving-legal.glitch.me');
describe('Ucuptest', function () {
this.timeout(5000);
it('Retrieving user data', async function () {
try {
const response = await ucuptest.get('/users/2', {}, Joi.object({
username: Joi.string().required(),
email: Joi.string().email().required(),
password: Joi.string().required(),
id: Joi.number().required(),
}), 'Test case: Retrieving user data');
console.log('GET Response:', response);
} catch (error) {
console.error('GET Error:', error.message);
}
});
});
ucuptest.runTests();