Run Tests

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:

  1. Created or generated tests for your API
  2. Configured the appropriate environment
  3. Set up any required authentication credentials

Running Tests via Vaktum.com

The easiest way to run tests is through the Vaktum web interface:

  1. Navigate to the Tests page
  2. Select the environment and test suite
  3. Click "Start Tests"
  4. View real-time results as tests execute

Run Tests

Running Tests via Vaktum CLI

For local development or CI/CD integration, use the Vaktum CLI:

🖥️ Shell
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:

🖥️ Shell
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:

  1. Install the Vaktum CLI
  2. Configure the runner with your Vaktum account:
    vaktum runner config --token <your-token>
    
  3. 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:

  1. The exact request that was sent
  2. The response that was received
  3. The expected vs. actual values
  4. The specific assertion that failed

This information is available in the test results page on Vaktum.com or in the CLI output.