Perfect for devs, testers, and business analysts who care about real-world scenarios, not just unit tests.
Testlab is a modern API testing tool that combines the best features of tools like Postman, Bruno, and Insomnia with a unique tabular interface. It's designed to streamline the process of creating and running multiple test cases for API endpoints.
- Tabular Test Interface: Add multiple permutations of inputs and expected outputs in a structured format
- Efficient Test Creation: Create multiple test cases in a single view
- Automated Testing: Run multiple test cases in sequence with detailed reporting and debugging
- It's darn pretty: Who says open source has to be ugly?
- Developers
- QAs
- BAs
- Anyone else who wants to easily build tests for APIs and business rules
- General API testing
- SIT (System Integration Testing)
- Regression testing
- Boundary and edge case testing
- Data-Driven Testing (DDT)
- Contract testing (at least lightweight testing)
- Testing business rules decisions
- Behavior-Driven Development (BDD)
- Node.js (v18 or later)
- Clone the repository:
git clone https://github.com/8labs/testlab.git
cd testlab- Install dependencies:
npm installTo run the application in development mode:
npm run devTo build the application:
npm run buildThe built application will be available in the dist directory.
-
Create a New Test Suite:
- Click "new test scenario" or the blue + dot to start
- Enter the base URL for your API endpoint
-
Add Test Cases:
- Use the tabular interface to add multiple test cases
- Each row represents a unique test case with:
- Input parameters
- Headers
- Expected response values (assertions)
-
Run Tests:
- Execute individual test cases or run the entire suite
- View detailed results and response data
Testlab supports powerful variable mapping and expressions for both input and output validation:
Use handlebars {{variable}} syntax to reference variables in:
- Endpoint URLs
- Headers
- Authentication values (username, password, token)
Example:
Endpoint: https://api.example.com/users/{{userId}}
Header: Authorization: Bearer {{authToken}}
These map directly to the column expression, so for the userId example above, a column defining it would have a column expression of userId.
Use $. prefix to map values to JSON request body in the input column expressions:
$.user.namemaps to{ "user": { "name": "value" } }$.items[0].idmaps to{ "items": [{ "id": "value" }] }
For validating responses, you can use:
-
JSON Path Expressions:
- Use
$.to reference the root of the response - Example:
$.data.user.namevalidates thenamefield insideuserinsidedata
- Use
-
Special Variables:
{{ http_status }}- Validates the HTTP status code{{ count() }}- Counts array elements in the response- Example:
{{ count($.items) }}validates the number of items in a property calleditemsin the root of the json response
- Example:
-
Comparison Operators:
=(equals)!=(not equals)>(greater than)<(less than)>=(greater than or equal)<=(less than or equal)contain(string contains) (not yet implemented in the ui)notcontain(string does not contain) (not yet implemented in the ui)
Testlab supports follow-up queries that can use data from the first query's response. This is perfect for scenarios like:
- Creating a resource and then verifying it exists
- Updating data and then checking the changes
- Chaining multiple API calls together
-
Configure Follow-up Endpoint:
- Set the follow-up endpoint URL
- Choose the HTTP method (defaults to POST)
- Set optional wait time between queries
-
Input Mapping:
- Use
%prefix in input column expressions to indicate follow-up body content - Map values from first response using
$.syntax - Example:
%.userIdwith value$.idwill use theidfrom the first response
- Use
-
Response Validation:
- Use
%.prefix in result column expressions to validate follow-up response - Example:
%.namevalidates thenamefield in the follow-up response
- Use
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MPLv2.
I'm open to dual licensing if someone would like to dicuss a specific situation.
