Interactive Builder
The NOIV interactive builder provides a step-by-step wizard for creating comprehensive test suites without writing YAML manually.
Getting Started
Launch the interactive builder:
noiv build
This opens a guided wizard that walks you through creating tests.
Builder Workflow
Step 1: Test Suite Setup
╭──────────────────────────╮
│ Interactive Test Builder │
╰──────────────────────────╯
Test name: E-commerce API Tests
Base URL (https://api.example.com): https://shop-api.example.com
The builder asks for:
- Test Suite Name: Descriptive name for your test collection
- Base URL: The root URL for your API (optional but recommended)
Step 2: Individual Test Creation
For each test, you'll configure:
HTTP Method Selection
Creating test #1
HTTP method [GET/POST/PUT/DELETE/PATCH] (GET): POST
Choose from:
- GET: Retrieve data
- POST: Create new resources
- PUT: Update entire resources
- PATCH: Partial updates
- DELETE: Remove resources
Endpoint Configuration
Endpoint path (/): /api/v1/products
Enter the specific endpoint path (will be combined with base URL).
Custom Headers
Add custom headers? [y/n] (n): y
Header name (or press Enter to finish): Authorization
Value for Authorization: Bearer ${API_TOKEN}
Header name (or press Enter to finish): Content-Type
Value for Content-Type: application/json
Header name (or press Enter to finish):
Add headers for:
- Authentication tokens
- Content type specifications
- API versioning
- Custom application headers
Request Body (POST/PUT/PATCH)
Add request body? [y/n] (n): y
Body type [json/form/text] (json): json
Enter JSON body (press Ctrl+D when done):
{
"name": "New Product",
"price": 29.99,
"category": "electronics"
}
Body types supported:
- JSON: Structured data (most common)
- Form: URL-encoded form data
- Text: Plain text or other formats
Response Validation
Expected status code (200): 201
Add response validations? [y/n] (n): y
Validation Types
Contains Validation
Validation type [contains/json_path/header/done] (done): contains
Text that response should contain: "created successfully"
JSON Path Validation
Validation type [contains/json_path/header/done] (done): json_path
JSON path (e.g., $.data.id): $.product.id
Expected value: exists
Header Validation
Validation type [contains/json_path/header/done] (done): header
Header name: Location
Expected header value: contains:/products/
Step 3: Additional Tests
Add another test? [y/n] (y): y
Repeat the process to create multiple test scenarios in one suite.
Real-World Example
Here's a complete interactive session for an e-commerce API:
$ noiv build
╭──────────────────────────╮
│ Interactive Test Builder │
╰──────────────────────────╯
Test name: E-commerce Product API
Base URL (https://api.example.com): https://shop.example.com
Creating test #1
HTTP method [GET/POST/PUT/DELETE/PATCH] (GET): POST
Endpoint path (/): /api/products
Add custom headers? [y/n] (n): y
Header name: Authorization
Value for Authorization: Bearer ${SHOP_TOKEN}
Header name: Content-Type
Value for Content-Type: application/json
Header name:
Add request body? [y/n] (n): y
Body type [json/form/text] (json): json
Enter JSON body (press Ctrl+D when done):
{
"name": "Wireless Headphones",
"price": 99.99,
"category": "electronics",
"stock": 50
}
Expected status code (200): 201
Add response validations? [y/n] (n): y
Validation type [contains/json_path/header/done] (done): json_path
JSON path: $.product.id
Expected value: exists
Validation type [contains/json_path/header/done] (done): header
Header name: Location
Expected header value: contains:/products/
Validation type [contains/json_path/header/done] (done): done
Add another test? [y/n] (y): y
Creating test #2
HTTP method [GET/POST/PUT/DELETE/PATCH] (GET): GET
Endpoint path (/): /api/products
Add custom headers? [y/n] (n): n
Expected status code (200): 200
Add response validations? [y/n] (n): y
Validation type [contains/json_path/header/done] (done): json_path
JSON path: $.products
Expected value: exists
Validation type [contains/json_path/header/done] (done): done
Add another test? [y/n] (y): n
Test suite saved as e-commerce_product_api.yaml
Created 2 tests
Run tests now? [y/n] (y): y
Generated Output
The builder creates a YAML file:
# e-commerce_product_api.yaml
name: E-commerce Product API
base_url: https://shop.example.com
tests:
- name: POST /api/products
url: https://shop.example.com/api/products
method: POST
expected_status: 201
headers:
Authorization: Bearer ${SHOP_TOKEN}
Content-Type: application/json
body: |
{
"name": "Wireless Headphones",
"price": 99.99,
"category": "electronics",
"stock": 50
}
validations:
- type: json_path
path: $.product.id
expected: exists
- type: header
name: Location
expected: contains:/products/
- name: GET /api/products
url: https://shop.example.com/api/products
method: GET
expected_status: 200
validations:
- type: json_path
path: $.products
expected: exists
Builder Best Practices
1. Plan Your Test Flow
Before starting, consider:
- What endpoints will you test?
- What's the logical order (create → read → update → delete)?
- What authentication is required?
- What data validation is important?
2. Use Environment Variables
For sensitive data, use environment variables:
Value for Authorization: Bearer ${API_TOKEN}
Base URL: ${API_BASE_URL}
3. Test Different Scenarios
Create tests for:
- Happy path: Normal, expected usage
- Error cases: Invalid data, missing auth
- Edge cases: Empty responses, large payloads
4. Meaningful Test Names
The builder auto-generates names like "POST /api/products", but you can edit the YAML file later for better descriptions:
- name: Create New Product Successfully
- name: List All Products
- name: Handle Invalid Product Data
Advanced Techniques
Testing Authentication Flow
# Test 1: Login
Method: POST
Endpoint: /auth/login
Body: {"email": "user@example.com", "password": "password"}
Validation: Extract token from response
# Test 2: Use token
Method: GET
Endpoint: /profile
Headers: Authorization: Bearer ${TOKEN}
Testing CRUD Operations
# Create
POST /api/items → Validate 201, extract ID
# Read
GET /api/items/{id} → Validate 200, check data
# Update
PUT /api/items/{id} → Validate 200, check changes
# Delete
DELETE /api/items/{id} → Validate 204
Testing Error Handling
# Invalid data
POST /api/items
Body: {"invalid": "data"}
Expected: 400
# Unauthorized
GET /api/protected
No auth header
Expected: 401
# Not found
GET /api/items/999999
Expected: 404
Editing Generated Tests
After the builder creates your YAML file, you can:
- Add more validations:
validations:
- type: json_path
path: $.data.created_at
expected: exists
- type: contains
value: success
- Include environment-specific URLs:
url: ${BASE_URL}/api/products
- Add request timeouts:
timeout: 30
Integration with Other Features
Run Tests Immediately
The builder offers to run tests right after creation for immediate feedback.
Generate HTML Reports
After running, create professional reports:
noiv report html
Performance Testing
Convert functional tests to performance tests:
noiv benchmark https://shop.example.com/api/products -n 100
Troubleshooting Builder Issues
Input Problems
- Use
Ctrl+C
to cancel and restart - For multi-line JSON, use
Ctrl+D
to finish input - Press
Enter
on empty header name to finish headers
YAML Issues
- Check generated file for syntax errors
- Verify indentation is correct
- Ensure string values are properly quoted
Validation Problems
- Test JSON paths with online tools first
- Use simple validations initially, then add complexity
- Check API documentation for expected response format
Next Steps
After using the interactive builder:
- Run your tests - Execute the generated test suite
- Performance testing - Add benchmarking
- Installation - Learn advanced YAML options
- Quick Start - Optimize your testing strategy
TIP
The interactive builder is perfect for getting started quickly, but don't hesitate to edit the generated YAML files to add more sophisticated test logic and validations.