This guide explains how to use the Postman collection to test the Adblock Compiler OpenAPI endpoints.
- Open Postman
- Click Import in the top left
- Select File and choose
docs/postman/postman-collection.json - The collection will appear in your workspace
- Click Import again
- Select File and choose
docs/postman/postman-environment.json - Select the "Adblock Compiler - Local" environment from the dropdown in the top right
# Start local development server
deno task dev
# Or using Docker
docker compose up -dThe server will be available at http://localhost:8787
You can run tests individually or as a collection:
- Individual Request: Click any request and press Send
- Folder: Right-click a folder and select Run folder
- Entire Collection: Click the Run button next to the collection name
The collection is organized into the following folders:
- Get API Info - Retrieves API version and available endpoints
- Get Performance Metrics - Fetches aggregated performance data
- Compile Simple Filter List - Basic compilation with pre-fetched content
- Compile with Transformations - Tests multiple transformations (RemoveComments, Validate, Deduplicate)
- Compile with Cache Check - Verifies caching behavior (X-Cache header)
- Compile Invalid Configuration - Error handling test
- Compile with SSE Stream - Server-Sent Events streaming test
- Batch Compile Multiple Lists - Compile 2 lists in parallel
- Batch Compile - Max Limit Test - Test the 10-item batch limit
- Queue Async Compilation - Queue a job for async processing
- Queue Batch Async Compilation - Queue multiple jobs
- Get Queue Stats - Retrieve queue metrics
- Get Queue Results - Fetch results using requestId
- Empty Configuration - Test with empty request body
- Missing Required Fields - Test validation
- Large Batch Request (>10) - Test batch size limit enforcement
Each request includes automated tests that verify:
pm.test('Status code is 200', function () {
pm.response.to.have.status(200);
});pm.test('Response is successful', function () {
const jsonData = pm.response.json();
pm.expect(jsonData.success).to.be.true;
pm.expect(jsonData).to.have.property('rules');
});pm.test('Rules are deduplicated', function () {
const jsonData = pm.response.json();
const uniqueRules = new Set(jsonData.rules.filter(r => !r.startsWith('!')));
pm.expect(uniqueRules.size).to.equal(jsonData.rules.filter(r => !r.startsWith('!')).length);
});pm.test('Check cache headers', function () {
pm.expect(pm.response.headers.get('X-Cache')).to.be.oneOf(['HIT', 'MISS']);
});The collection uses the following variables:
baseUrl- Local development server URL (default:http://localhost:8787)prodUrl- Production server URLrequestId- Auto-populated from async compilation responses
To test against production:
- Change the
baseUrlvariable to{{prodUrl}} - Or create a new environment for production
You can run the collection from the command line using Newman:
# Install Newman
npm install -g newman
# Run the collection against local server
newman run docs/postman/postman-collection.json -e docs/postman/postman-environment.json
# Run with detailed output
newman run docs/postman/postman-collection.json -e docs/postman/postman-environment.json --reporters cli,json
# Run specific folder
newman run docs/postman/postman-collection.json -e docs/postman/postman-environment.json --folder "Compilation"name: API Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Start server
run: docker compose up -d
- name: Wait for server
run: sleep 5
- name: Install Newman
run: npm install -g newman
- name: Run Postman tests
run: newman run docs/postman/postman-collection.json -e docs/postman/postman-environment.json
- name: Stop server
run: docker compose downYou can add pre-request scripts to generate dynamic data:
// Generate random filter rules
const rules = Array.from({length: 10}, (_, i) => `||example${i}.com^`);
pm.collectionVariables.set('dynamicRules', rules.join('\\n'));Run requests in sequence to test workflows:
- Queue Async Compilation → captures
requestId - Get Queue Stats → verify job is pending
- Get Queue Results → retrieve compiled results
Use the Collection Runner with multiple iterations:
- Click Run on the collection
- Set Iterations to desired number (e.g., 100)
- Set Delay between requests (e.g., 100ms)
- View performance metrics in the run summary
# Check if server is running
curl http://localhost:8787/api
# Check Docker logs
docker compose logs -f
# Restart server
docker compose restartQueue tests may return 500 if Cloudflare Queues aren't configured:
{
"success": false,
"error": "Queue bindings are not available..."
}This is expected for local development without queue configuration.
If you hit rate limits (429 responses), wait for the rate limit window to reset or adjust RATE_LIMIT_MAX_REQUESTS in the server configuration.
- Run tests before commits - Ensure API compatibility
- Test against local first - Avoid production impact
- Use environments - Separate dev/staging/prod configurations
- Review test results - Don't ignore failed assertions
- Update tests - Keep tests in sync with OpenAPI spec changes
For issues or questions:
- Check the main README
- Review the OpenAPI spec
- Open an issue on GitHub