Run Tests
Running API Tests
After creating tests and configuring environments, you can execute your test suites to validate your API's functionality. Vaktum provides multiple ways to run tests based on your workflow and requirements.
Prerequisites for Running Tests
Before running tests, ensure you have:
- Created or generated tests for your API
- Configured the appropriate environment
- Set up any required authentication credentials
Running Tests via Vaktum.com
The easiest way to run tests is through the Vaktum web interface:
- Navigate to the Tests page
- Select the environment and test suite
- Click "Start Tests"
- View real-time results as tests execute
Running Tests via Vaktum CLI
For local development or CI/CD integration, use the Vaktum CLI:
vaktum test --tests <Path to the tests.json file> --env <Path to the environment.json file>
The test files can be downloaded from Vaktum.com or created locally. This approach is ideal for:
- Local development testing
- CI/CD pipeline integration
- Automated testing workflows
Any test failures will be listed in the output. If tests fail, the CLI will return a non-zero exit code, which will fail most CI/CD pipelines.
Running Tests via Vaktum API
For programmatic test execution, use the Vaktum API:
curl -X POST "https://api.vaktum.com/v1/test-runs" \
-H "X-API-KEY: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"testSuiteId": "your-test-suite-id",
"environmentId": "your-environment-id"
}'
Test Runners
Tests can be executed using different runners:
Vaktum Cloud Runner
- Default option on Vaktum.com
- No setup required
- Managed infrastructure
Local Test Runner
- Run tests from your own infrastructure
- Useful for accessing internal APIs
- Greater control over execution environment
To set up a local runner:
- Install the Vaktum CLI
- Configure the runner with your Vaktum account:
vaktum runner config --token <your-token>
- Start the runner:
vaktum runner start
Test Results
Tests can have the following outcomes:
- PASSED: The test met all assertions and validation criteria
- FAILED: The test did not meet one or more assertions
- SUGGESTION: Non-critical issues were detected
- SKIPPED: The test was not run (often due to a dependency failure)
- RUNNING: The test is currently executing
Test Analytics
Vaktum captures important metrics during test execution:
- Response Time: How long each request took to complete
- Execution Duration: Total time for the test suite to run
- Success Rate: Percentage of passing tests
- Failure Patterns: Common reasons for test failures
These metrics help identify performance issues, regressions, and areas for improvement in your API.
Debugging Failed Tests
When tests fail, Vaktum provides detailed information to help diagnose the issue:
- The exact request that was sent
- The response that was received
- The expected vs. actual values
- The specific assertion that failed
This information is available in the test results page on Vaktum.com or in the CLI output.