# Testing and Validation

### Live Inspector <a href="#live-inspector" id="live-inspector"></a>

The **Live Inspector** is Tairons flagship testing tool, providing real-time server validation directly in your browser.

***

#### **Features:** <a href="#features" id="features"></a>

**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:** <a href="#using-the-live-inspector" id="using-the-live-inspector"></a>

1. **Navigate to Server**: Go to any server page on Tairon
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:** <a href="#example-inspector-session" id="example-inspector-session"></a>

```javascript
// 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 TaironClient();
const server = await client.getServer('price-oracle-v1');
const result = await server.call('getPrice', {
  symbol: 'ETH/USD',
  source: 'binance'
});
```

***

### Automated Testing <a href="#automated-testing" id="automated-testing"></a>

#### **Test Suite Categories** <a href="#test-suite-categories" id="test-suite-categories"></a>

**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** <a href="#running-tests" id="running-tests"></a>

**Via Web Interface:**

1. Go to server page
2. Click "Run Tests"
3. Select test suite
4. Monitor progress
5. Review results

***

**Via CLI**

```javascript
# Run basic tests
tairon test server-id

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

# Custom test configuration
tairon 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:**

```bash
import { TaironClient } from '@tairon/sdk';

const client = new TaironClient();

// 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**

```javascript
{
  "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 <a href="#continuous-monitoring" id="continuous-monitoring"></a>

Tairon 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tairon.ai/tairon/testing-and-validation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
