ucuptest

1.0.1 • Public • Published

UcupTest

Simple API Test Framework

Introduction

Ucuptest.js an API testing tool built on top of Axios that makes testing API endpoints easy, fast and fun.

Installation

Install Ucuptest from NPM into your project:

npm i ucuptest

Creating Tests

Simple Example

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();

Readme

Keywords

none

Package Sidebar

Install

npm i ucuptest

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

2.98 kB

Total Files

3

Last publish

Collaborators

  • depfaris