```json
{
"tests": [
{
"name": "list_supported_languages",
"endpoint": "/translate/languages",
"method": "GET",
"headers": {},
"payload": {},
"expected_status": 200,
"expected_behavior": "Returns list of supported language codes",
"metrics": ["latency", "status_code"],
"validation": {"field": "languages", "type": "array", "min_length": 1}
},
{
"name": "translate_english_to_spanish",
"endpoint": "/translate/text",
"method": "POST",
"headers": {"X-API-Key": "{api_key}"},
"payload": {
"text": "Hello, how are you today?",
"source": "en",
"target": "es"
},
"expected_status": 200,
"expected_behavior": "Returns Spanish translation of English text",
"metrics": ["latency", "accuracy", "status_code"],
"validation": {"field": "translated_text", "type": "string", "min_length": 5}
},
{
"name": "translate_english_to_french",
"endpoint": "/translate/text",
"method": "POST",
"headers": {"X-API-Key": "{api_key}"},
"payload": {
"text": "The weather is beautiful today.",
"source": "en",
"target": "fr"
},
"expected_status": 200,
"expected_behavior": "Returns French translation of English text",
"metrics": ["latency", "accuracy", "status_code"],
"validation": {"field": "translated_text", "type": "string", "min_length": 10}
},
{
"name": "detect_language_english",
"endpoint": "/translate/detect",
"method": "POST",
"headers": {"X-API-Key": "{api_key}"},
"payload": {
"text": "This is a sentence in English."
},
"expected_status": 200,
"expected_behavior": "Detects language as English (en)",
"metrics": ["latency", "accuracy", "status_code"],
"validation": {"field": "detected_language", "type": "string", "expected_value": "en"}
},
{
"name": "detect_language_spanish",
"endpoint": "/translate/detect",
"method": "POST",
"headers": {"X-API-Key": "{api_key}"},
"payload": {
"text": "Hola, ¿cómo estás hoy?"
},
"expected_status": 200,
"expected_behavior": "Detects language as Spanish (es)",
"metrics": ["latency", "accuracy", "status_code"],
"validation": {"field": "detected_language", "type": "string", "expected_value": "es"}
},
{
"name": "translate_missing_text_error",
"endpoint": "/translate/text",
"method": "POST",
"headers": {"X-API-Key": "{api_key}"},
"payload": {
"source": "en",
"target": "es"
},
"expected_status": 400,
"expected_behavior": "Returns error for missing text parameter",
"metrics": ["status_code", "error_handling"],
"validation": {"field": "error", "type": "string"}
},
{
"name": "translate_invalid_language_error",
"endpoint": "/translate/text",
"method": "POST",
"headers": {"X-API-Key": "{api_key}"},
"payload": {
"text": "Test text",
"source": "invalid_lang",
"target": "es"
},
"expected_status": 400,
"expected_behavior": "Returns error for invalid language code",
"metrics": ["status_code", "error_handling"],
"validation": {"field": "error", "type": "string"}
},
{
"name": "translate_no_auth_error",
"endpoint": "/translate/text",
"method": "POST",
"headers": {},
"payload": {
"text": "Test text",
"source": "en",
"target": "es"
},
"expected_status": 401,
"expected_behavior": "Returns unauthorized error without API key",
"metrics": ["status_code", "security"],
"validation": {"field": "error", "type": "string"}
}
],
"pricing_probes": [
{
"name": "check_character_usage_tracking",
"description": "Send text of known length, check for character count in response or headers",
"endpoint": "/translate/text",
"method": "POST",
"payload": {
"text": "This is exactly fifty characters long for testing.",
"source": "en",
"target": "es"
},
"check": "response headers or body should contain character count (50) or usage metrics"
},
{
"name": "verify_usage_headers",
"description": "Check response headers for billing/usage information",
"endpoint": "/translate/detect",
"method": "POST",
"payload": {
"text": "Short text"
},
"check": "response headers may include X-Usage-*, X-Billing-*, or similar usage tracking"
},
{
"name": "test_longer_text_usage",
"description": "Send longer text to see if pricing scales with length",
"endpoint": "/translate/text",
"method": "POST",
"payload": {
"text": "This is a much longer text that contains multiple sentences and should help us understand if the pricing model is based on charact