Create automated tests for a simple task management API. This challenge should take 2-3 hours to complete.
Test these 3 endpoints of a task management API:
POST /api/auth/login- User loginPOST /api/tasks- Create taskGET /api/tasks- Get all tasks
Base URL: http://localhost:3000/api (local mock server)
Create tests for the 3 endpoints above:
Test Scenarios:
- Login with valid credentials
- Login with invalid credentials
- Create a task successfully
- Create a task with missing title (should fail)
- Get all tasks successfully
Requirements:
- Use any testing framework (Jest, Mocha, PyTest, etc.)
- Include response time check (< 3 seconds)
- Use environment variables for base URL
Generate a basic test report showing:
- Pass/fail counts
- Response times
- Error messages for failed tests
QAChallenge/
├── tests/
│ ├── auth.test.js
│ ├── tasks.test.js
│ └── config.js
├── reports/
├── package.json
└── README.md
npm install- Start the mock server:
npm run server(in one terminal) - Run tests:
npm test(in another terminal) - Check
reports/folder for results
Note: The mock server runs on http://localhost:3000 by default. You can override the API URL by setting the environment variable: export API_BASE_URL=https://your-api-url.com/api
npm install
npm testPOST /api/auth/login
Content-Type: application/json
{
"email": "test@example.com",
"password": "password123"
}POST /api/tasks
Authorization: Bearer <token>
Content-Type: application/json
{
"title": "Test Task",
"description": "Test Description"
}GET /api/tasks
Authorization: Bearer <token>- Fork this repo
- Implement the 5 test scenarios
- Create a pull request
- Include a brief summary
Time Limit: 3 hours maximum