testzeus-test-data
Manage test data sets for TestZeus tests.
Category: data · Version: 1.0.0 · Requires: testzeus-auth
Triggers: test data, create data, upload data, data set, test input, manage data, data file, test data file, JSON data, CSV data, upload file
Overview
Test data in TestZeus allows you to store and manage data that tests use during execution. Data can be inline JSON, file uploads, or references to external resources.
Quick Reference
# List test data
testzeus test-data list
# Create with inline data
testzeus test-data create --name "User Credentials" \
--data '{"username": "test", "password": "pass"}'
# Create from file
testzeus test-data create --name "Bulk Data" --data-file ./data.json
# Upload file
testzeus test-data upload-file data_id ./file.csv
# Link to test
testzeus tests create --name "Test" --data data_id
# Delete
testzeus test-data delete data_idTest Data Types
Inline Data
testzeus test-data create \
--name "API Endpoints" \
--data '[
{"method": "GET", "path": "/users"},
{"method": "POST", "path": "/users"}
]'File Data
testzeus test-data create \
--name "Test Users CSV" \
--data-file ./test-users.csvMixed
testzeus test-data create \
--name "Config with Files" \
--data '{"config": "value", "file_ref": "uploaded_file.csv"}'Create Test Data
Basic Creation
# Inline JSON
testzeus test-data create \
--name "Environment Config" \
--data '{
"base_url": "https://staging.example.com",
"api_key": "test-key-123",
"timeout": 30000
}'
# With type
testzeus test-data create \
--name "Test Users" \
--type test \
--data '[{"username": "user1", "email": "user1@test.com"}]'From File
# JSON file
testzeus test-data create \
--name "Product Catalog" \
--data-file ./products.json
# CSV file
testzeus test-data create \
--name "User Accounts" \
--data-file ./users.csv
# YAML file
testzeus test-data create \
--name "Config" \
--data-file ./config.yamlCreate and Upload in One
testzeus test-data create \
--name "Test Images" \
--data '{"images": ["uploaded_1.png", "uploaded_2.png"]}' \
--data-file ./upload.pngFile Management
Upload Files
# Upload to existing test data
testzeus test-data upload-file data_id ./file.csv
# Upload multiple files
testzeus test-data upload-file data_id ./file1.csv
testzeus test-data upload-file data_id ./file2.csv
# Upload with custom name
# (files are stored with original name)List Files
Files attached to test data can be accessed via the API or downloaded.
Delete Files
# Remove a specific file from test data (by ID and file path)
testzeus test-data remove-file data_id ./filename.csv
# Delete all files from test data
testzeus test-data delete-all-files data_idManage Test Data
List Data
# List all
testzeus test-data list
# Filter by type
testzeus test-data list --filters type=test
# Filter by status
testzeus test-data list --filters status=ready
# Get with details
testzeus test-data get data_id
testzeus test-data get data_id --expand related_entitiesUpdate Data
# Update name
testzeus test-data update data_id --name "New Name"
# Update
testzeus test-data update data_id --name "Updated name"
# Update data content
testzeus test-data update data_id \
--data '{"updated": true}'
# Update from file
testzeus test-data update data_id \
--data-file ./new-data.jsonDelete Data
# Delete test data
testzeus test-data delete data_id
# Delete all files first (safety)
testzeus test-data delete-all-files data_id
testzeus test-data delete data_idLink to Tests
Create Test with Data
testzeus tests create \
--name "Login Test" \
--feature-file ./login.feature \
--data data_id_1 \
--data data_id_2Update Test to Add Data
testzeus tests update test_id \
--data data_id_3List Data Used by Test
# Get test details with data
testzeus tests get test_id --expand test_data
# Or via input-params
testzeus tests input-params test_idData Organization
Tags with Data
# Create data with tags
testzeus test-data create \
--name "Smoke Test Data" \
--data '{}' \
--tags smoke
# List data by tag
testzeus test-data list --filters tags?="smoke"Naming Conventions
Recommended naming:
test_data_<feature>_<type>- e.g.,test_data_checkout_usersfixture_<purpose>- e.g.,fixture_api_credentialsmock_<entity>- e.g.,mock_product_catalog
Common Use Cases
API Test Data
# Create API endpoints data
testzeus test-data create \
--name "API Endpoints" \
--type api \
--data '{
"base_url": "https://api.example.com",
"endpoints": {
"users": "/v1/users",
"orders": "/v1/orders",
"products": "/v1/products"
},
"auth": {
"type": "bearer",
"token_env": "API_TOKEN"
}
}'
# Create request payloads
testzeus test-data create \
--name "Create User Payload" \
--type payload \
--data '{
"username": "testuser",
"email": "test@example.com",
"password": "Test123!",
"profile": {
"firstName": "Test",
"lastName": "User"
}
}'UI Test Data
# Create user credentials
testzeus test-data create \
--name "UI Test Users" \
--type user \
--data '[
{"username": "admin@test.com", "password": "Admin123!", "role": "admin"},
{"username": "user@test.com", "password": "User123!", "role": "user"}
]'
# Create form data
testzeus test-data create \
--name "Checkout Form Data" \
--type form \
--data '{
"shipping": {"name": "John Doe", "address": "123 Main St", "zip": "12345"},
"payment": {"card": "4111111111111111", "cvv": "123", "expiry": "12/25"}
}'File Fixtures
# Create data record
testzeus test-data create \
--name "Product Images" \
--type file \
--data '{"count": 3}'
# Upload files
testzeus test-data upload-file data_id ./product1.jpg
testzeus test-data upload-file data_id ./product2.jpg
testzeus test-data upload-file data_id ./product3.jpgSDK Usage
from testzeus_sdk import TestZeusClient
async def main():
async with TestZeusClient() as client:
# Create test data
test_data = await client.test_data.create({
"name": "API Credentials",
"type": "credential",
"data": {
"api_key": "test-key",
"base_url": "https://api.example.com"
}
})
# Upload file
await client.test_data.upload_file(
test_data.id,
"./credentials.json"
)
# List and filter
all_data = await client.test_data.get_list(
filters={"type": "credential"}
)
# Link to test
test = await client.tests.create(
name="API Test",
test_feature="Feature: API Test...",
test_data=[test_data.id]
)Error Handling
Common Errors
| Error | Cause | Solution |
|---|---|---|
Data too large |
Inline data > size limit | Use file upload instead |
Invalid JSON |
Malformed JSON | Validate JSON syntax |
File not found |
Wrong path | Check file path |
Type mismatch |
Wrong data type | Check type parameter |
Large Data Files
For large files (>1MB), use file upload:
testzeus test-data create --name "Large Dataset" --data '{}'
testzeus test-data upload-file data_id ./large-file.csvComponent Schema
Use DataPreview component:
{
"component": "DataPreview",
"props": {
"name": "User Credentials",
"type": "credential",
"preview": {"username": "***", "password": "***"},
"fileCount": 0
}
}Related Skills
- testzeus-test-operations - Running tests with data
- testzeus-environments - Environment configuration
- testzeus-test-authoring - Creating tests with data