This repository contains Postman collections and scripts for testing various functionalities of the Adjutor API, including Signup, Login, and BVN verification. The purpose of these tests is to validate the API endpoints, ensure correct functionality, and identify potential performance and security issues.
- Postman
- A valid API key for the Adjutor API
- Node.js and npm (for automated testing)
-
Clone the Repository
git clone https://github.com/yourusername/adjutor-api-testing.git cd adjutor-api-testing -
Import Postman Collection
- Open Postman.
- Click on "Import" in the top-left corner.
- Select the
Adjutor_API_Testing.postman_collection.jsonfile from the repository.
-
Set Up Environment Variables
- In Postman, go to the "Environments" tab.
- Create a new environment named
Adjutor API. - Add the following variables:
base_url:https://adjutor.lendsqr.com/v2/api_key:your_api_key_herebvn:your_bvn_herecontact:your_contact_here
- Save the environment.
-
Manual Testing
- Open the
Adjutor API Testingcollection in Postman. - Select an endpoint and click "Send" to run the request.
- Check the response and the test results.
- Open the
-
Automated Testing
- Ensure you have Node.js and npm installed.
- Install Newman, the command-line collection runner for Postman:
npm install -g newman
- Run the Postman collection using Newman:
newman run Adjutor_API_Testing.postman_collection.json -e Adjutor_API_Environment.json
Endpoint: POST {{base_url}}/signup
Headers:
Content-Type: application/json
Body:
{
"username": "testuser",
"password": "password123",
"email": "testuser@example.com"
}Test Scripts:
- Pre-request Script: None
- Tests:
pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); pm.test("Response contains user details", function () { var jsonData = pm.response.json(); pm.expect(jsonData).to.have.property('username'); });
Endpoint: POST {{base_url}}/login
Headers:
Content-Type: application/json
Body:
{
"username": "testuser",
"password": "password123"
}Test Scripts:
- Pre-request Script: None
- Tests:
pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); pm.test("Response contains token", function () { var jsonData = pm.response.json(); pm.expect(jsonData).to.have.property('token'); });
Endpoint: GET {{base_url}}/keys
Headers:
Authorization: Bearer {{api_key}}
Test Scripts:
- Pre-request Script: None
- Tests:
pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); pm.test("Response contains API keys", function () { var jsonData = pm.response.json(); pm.expect(jsonData).to.have.property('keys'); });
Endpoint: POST {{base_url}}/verification/bvn/{{bvn}}
Headers:
Content-Type: application/jsonAuthorization: Bearer {{api_key}}
Body:
{
"contact": "{{contact}}"
}Test Scripts:
- Pre-request Script: None
- Tests:
pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); pm.test("Response contains OTP status", function () { var jsonData = pm.response.json(); pm.expect(jsonData.status).to.eql("otp"); });
Endpoint: PUT {{base_url}}/verification/bvn/{{bvn}}
Headers:
Content-Type: application/jsonAuthorization: Bearer {{api_key}}
Body:
{
"otp": "242366"
}Test Scripts:
- Pre-request Script: None
- Tests:
pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); pm.test("Response indicates success", function () { var jsonData = pm.response.json(); pm.expect(jsonData.status).to.eql("success"); });
- Signup: 362 ms
- Login: 1117 ms
- Retrieving API Keys: 340 ms
- BVN Name Inquiry: 1 m 0.55 s
- BVN Verification with OTP: 1 m 0.60 s
- Optimize Server Performance: Address server timeouts and optimize endpoints for quicker responses.
- Improve Error Handling: Provide more informative error messages for easier debugging.
- Scalability: Ensure the API can handle higher loads to prevent timeouts.
- Authentication and Authorization: Ensure all endpoints require proper authentication and authorization.
- Input Validation: Validate all inputs to prevent injection attacks.
- Rate Limiting: Implement rate limiting to prevent abuse.
- Sensitive Data Exposure: Avoid exposing sensitive data in error messages.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature-branch). - Open a pull request.
This project is licensed under the MIT License.