Testing and Validation

Live Inspector

The Live Inspector is Testra's flagship testing tool, providing real-time server validation directly in your browser.


Features:

Function Explorer

  • Browse all available server functions

  • View parameter schemas and examples

  • See return value specifications

  • Access function documentation

Real-time Execution

  • Execute functions with custom parameters

  • See results instantly

  • Monitor execution time and performance

  • Debug errors with detailed stack traces

Code Generation

  • Auto-generate integration code

  • Support for multiple languages

  • Copy-paste ready snippets

  • SDK and direct API examples

Performance Analytics

  • Response time monitoring

  • Success/failure rates

  • Historical performance data

  • Load testing capabilities


Using the Live Inspector:

  1. Navigate to Server: Go to any server page on Testra

  2. Click "Test With Inspector": Opens the testing interface

  3. Select Function: Choose from available functions

  4. Set Parameters: Fill in required/optional parameters

  5. Execute: Run the function and see results

  6. Analyze: Review response data and performance

  7. Generate Code: Copy integration examples


Example Inspector Session:

// Function: getPrice
// Parameters: { "symbol": "ETH/USD", "source": "binance" }
// Execution Time: 145ms
// Result:
{
  "price": 2345.67,
  "timestamp": "2025-06-30T14:30:00Z",
  "source": "binance",
  "confidence": 0.99
}

// Generated JavaScript Code:
const client = new TestraClient();
const server = await client.getServer('price-oracle-v1');
const result = await server.call('getPrice', {
  symbol: 'ETH/USD',
  source: 'binance'
});

Automated Testing

Test Suite Categories

Functional Tests

  • Endpoint availability

  • Response format validation

  • Function execution

  • Error handling

  • Schema compliance

Performance Tests

  • Response time benchmarks

  • Throughput measurement

  • Concurrent request handling

  • Resource usage monitoring

  • Load testing scenarios

Security Tests

  • Authentication validation

  • Input sanitization checks

  • Rate limiting verification

  • SSL/TLS configuration

  • Vulnerability scanning

Integration Tests

  • End-to-end workflows

  • Multi-function sequences

  • Error recovery

  • State management

  • Transaction handling


Running Tests

Via Web Interface:

  1. Go to server page

  2. Click "Run Tests"

  3. Select test suite

  4. Monitor progress

  5. Review results


Via CLI:

# Run basic tests
testra test server-id

# Run comprehensive tests
testra test server-id --suite comprehensive

# Custom test configuration
testra test server-id --config test-config.json

# Example test-config.json:
{
  "timeout": 30000,
  "retries": 3,
  "concurrent": 5,
  "functions": [
    {
      "name": "getPrice",
      "testCases": [
        { "symbol": "ETH/USD" },
        { "symbol": "BTC/USD" }
      ]
    }
  ]
}

Via SDK:

import { TestraClient } from '@testra/sdk';

const client = new TestraClient();

// Run tests programmatically
const testResults = await client.testing.runTests('server-id', {
  suite: 'comprehensive',
  timeout: 30000,
  functions: ['getPrice', 'getHistoricalData']
});

console.log('Test Results:', testResults);

Test Results Format

{
  "testRunId": "test_123456",
  "serverId": "srv_abcdef",
  "status": "completed",
  "startedAt": "2025-06-30T14:00:00Z",
  "completedAt": "2025-06-30T14:05:30Z",
  "duration": 330000,
  "summary": {
    "total": 45,
    "passed": 42,
    "failed": 2,
    "skipped": 1,
    "successRate": 93.3
  },
  "categories": {
    "functional": { "passed": 15, "failed": 0 },
    "performance": { "passed": 12, "failed": 1 },
    "security": { "passed": 10, "failed": 1 },
    "integration": { "passed": 5, "failed": 0 }
  },
  "details": [
    {
      "testName": "health_check_response_time",
      "category": "performance",
      "status": "passed",
      "duration": 145,
      "expected": "<500ms",
      "actual": "145ms"
    },
    {
      "testName": "function_execution_getPrice",
      "category": "functional", 
      "status": "passed",
      "duration": 230,
      "result": {
        "price": 2345.67,
        "timestamp": "2025-06-30T14:00:00Z"
      }
    },
    {
      "testName": "rate_limiting",
      "category": "security",
      "status": "failed",
      "duration": 5000,
      "error": "Rate limiting not implemented",
      "recommendation": "Implement request throttling"
    }
  ]
}

Continuous Monitoring

Testra continuously monitors all listed servers:

Health Checks:

  • Every 60 seconds

  • Multi-region monitoring

  • Uptime calculation

  • Alert notifications

Performance Tracking:

  • Response time monitoring

  • Throughput measurement

  • Error rate tracking

  • Historical data storage

Compliance Monitoring:

  • Protocol adherence

  • Schema validation

  • Security posture

  • Best practices compliance

Last updated