Yet another api testing toolkit
Easy tests and documentation for your http api
Install
Add it globally or locally
sudo yarn global add yaatt
OR if you are barbaric,
sudo npm i -g yaatt
Usage
Creating a test suite
-
Create a file
your-test.js
. It is reccommended that you follow a specific directory structure for these tests. -
The general format of a test suite is as follows
moduleexports = label: 'Httpbin Get call' // A label for your test suite url: 'http://httpbin.org/get' // API endpoint method: 'get' // HTTP method tests: 'should do stuff': /* Test case */ ;
Write your first test
- A simple test case for getting user information would look like this
moduleexports = label: 'Get user data' url: 'https://some-domain.com/api/user' method: 'get' tests: 'should fetch Waluigi\'s information from api': params: // Query parameters userid: 'ZnVjayB5b3U=' response // Check if user id is correct // Check if the name is correct ;
Running your tests
yaatt ./path/to/yourtest1.test.js ./path/to/yourtest2.test.js
You can even use glob paths
yaatt ./path/**/*.test.js