testzeus-scheduling#
Schedule automated test and report execution in TestZeus.
Category: execution · Version: 1.0.0 · Requires: testzeus-auth
Triggers: schedule, cron, automate, recurring test, daily test, hourly test, report schedule, cron job, schedule test, automated execution
Overview#
Schedules in TestZeus allow you to automate test execution and report generation using cron expressions or time intervals.
Quick Reference#
# Test Report Schedule
testzeus schedule create \
--name "Nightly Reports" \
--cron-expression "0 2 * * *" \
--filter-name-pattern "regression_*" \
--notification-channels channel_id
# Suite Schedule
testzeus test-suite-schedules create \
--name "Daily Checkout" \
--test-suite suite_id \
--cron-expression "0 9 * * *" \
--input-values '{"base_url": "https://staging.example.com"}'
Cron Syntax#
Basic Patterns#
Expression |
Meaning |
Example |
|---|---|---|
|
Daily at 9 AM |
Every day at 9:00 AM |
|
Weekdays at 9 AM |
Mon-Fri at 9:00 AM |
|
Every 15 minutes |
Every 15 min |
|
Every 2 hours |
At 0, 2, 4, 6… |
|
Weekly on Monday |
Every Monday 9 AM |
|
Monthly on 1st |
First of month |
Cron Format#
┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-6, Sun=0)
│ │ │ │ │
* * * * *
Common Examples#
# Every day at midnight
--cron-expression "0 0 * * *"
# Every day at 9 AM
--cron-expression "0 9 * * *"
# Every day at 5 PM
--cron-expression "0 17 * * *"
# Weekdays at 9 AM
--cron-expression "0 9 * * 1-5"
# Weekdays at 9 AM and 5 PM
--cron-expression "0 9,17 * * 1-5"
# Every 15 minutes during business hours
--cron-expression "*/15 9-17 * * 1-5"
# Every Sunday at midnight
--cron-expression "0 0 * * 0"
# First of every month at midnight
--cron-expression "0 0 1 * *"
# Every 6 hours
--cron-expression "0 */6 * * *"
Test Report Schedules#
Create Schedule#
# Basic schedule
testzeus schedule create \
--name "Daily Test Report" \
--cron-expression "0 9 * * *"
# With filters
testzeus schedule create \
--name "Regression Report" \
--cron-expression "0 9 * * 1-5" \
--filter-name-pattern "regression_*" \
--filter-tags "smoke"
# With notifications
testzeus schedule create \
--name "QA Report" \
--cron-expression "0 18 * * *" \
--notification-channels channel_id_1,channel_id_2
Filter Options#
# Filter by test name pattern
--filter-name-pattern "regression_*"
--filter-name-pattern "*checkout*"
# Filter by tags
--filter-tags "smoke,regression"
--filter-tag-pattern "*-test"
# Filter by environment
--filter-env "staging_env_id"
--filter-env-pattern "*staging*"
# Filter by test data
--filter-test-data "data_id_1"
--filter-test-data-pattern "*test*"
Validation Rules#
⚠️ Important: Some filters are mutually exclusive:
--filter-tagsOR--filter-tag-pattern(not both)--filter-envOR--filter-env-pattern(not both)--filter-test-dataOR--filter-test-data-pattern(not both)--cron-expressionOR--filter-time-intervals(not both)
Update Schedule#
# Change cron
testzeus schedule update schedule_id \
--cron-expression "0 10 * * *"
# Change filters
testzeus schedule update schedule_id \
--filter-tags "new-tag"
# Disable schedule
testzeus schedule update schedule_id \
--is-active false
Delete Schedule#
testzeus schedule delete schedule_id
Test Suite Schedules#
Create Suite Schedule#
# Basic suite schedule
testzeus test-suite-schedules create \
--name "Daily Checkout Suite" \
--test-suite suite_id \
--cron-expression "0 9 * * *"
# With inputs
testzeus test-suite-schedules create \
--name "Staging Checkout" \
--test-suite suite_id \
--cron-expression "0 9 * * *" \
--input-values '{"base_url": "https://staging.example.com", "env": "staging"}'
# With notifications
testzeus test-suite-schedules create \
--name "Nightly Full Suite" \
--test-suite suite_id \
--cron-expression "0 2 * * *" \
--notification-channels channel_id
Manage Suite Schedules#
# List schedules
testzeus test-suite-schedules list
testzeus test-suite-schedules list --filters is_active=true
# Get schedule
testzeus test-suite-schedules get schedule_id
# Update
testzeus test-suite-schedules update schedule_id \
--cron-expression "0 10 * * *"
# Delete
testzeus test-suite-schedules delete schedule_id
Time Intervals#
Alternative to cron for specific time ranges:
# Business hours only
testzeus schedule create \
--name "Business Hours Report" \
--filter-time-intervals "2025-01-01 09:00:00,2025-01-01 17:00:00"
# Morning window
--filter-time-intervals "2025-01-01 08:00:00,2025-01-01 12:00:00"
Notification Integration#
Attach Notification Channels#
# Single channel
testzeus schedule create \
--name "Report" \
--cron-expression "0 9 * * *" \
--notification-channels channel_id
# Multiple channels
testzeus schedule create \
--name "Report" \
--cron-expression "0 9 * * *" \
--notification-channels channel_id_1,channel_id_2
Notification Content#
When a scheduled report runs:
Email recipients get the report
Webhooks receive a POST with results
Default channel gets notified if configured
SDK Usage#
from testzeus_sdk import TestZeusClient
async def main():
async with TestZeusClient() as client:
# Create report schedule
schedule = await client.test_report_schedules.create_test_report_schedule(
name="Daily Regression Report",
is_active=True,
cron_expression="0 9 * * 1-5", # Weekdays at 9 AM
filter_name_pattern="regression_*",
notification_channels=["channel_id"]
)
# Create suite schedule
suite_schedule = await client.test_suite_schedules.create({
"name": "Daily Checkout",
"test_suite": "suite_id",
"cron_expression": "0 9 * * *",
"is_active": True,
"input_values": {"base_url": "https://staging.example.com"}
})
# List schedules
schedules = await client.test_suite_schedules.get_list()
# Update
await client.test_suite_schedules.update(
schedule_id,
{"is_active": False}
)
# Delete
await client.test_suite_schedules.delete(schedule_id)
Common Workflows#
Nightly Regression Suite#
# 1. Create the schedule
testzeus test-suite-schedules create \
--name "Nightly Regression" \
--test-suite regression_suite_id \
--cron-expression "0 2 * * *" \
--notification-channels qa_channel_id
# 2. This runs every night at 2 AM
# 3. QA team gets notified with results
Hourly Smoke Check#
# Run smoke tests every hour
testzeus test-suite-schedules create \
--name "Hourly Smoke" \
--test-suite smoke_suite_id \
--cron-expression "0 * * * *"
Weekly Full Report#
# Generate comprehensive report every Monday
testzeus schedule create \
--name "Weekly Summary" \
--cron-expression "0 9 * * 1" \
--filter-name-pattern "*" \
--filter-tags "regression,smoke,e2e" \
--notification-channels leadership_channel
Timezone Notes#
Schedules run in UTC by default
Consider timezone when setting cron expressions
Team notification times should account for timezone
Error Handling#
Common Errors#
Error |
Cause |
Solution |
|---|---|---|
|
Malformed expression |
Use valid cron syntax |
|
Mutually exclusive options |
Use one or the other |
|
Invalid channel ID |
List channels first |
Debugging#
# List all schedules
testzeus schedule list
testzeus test-suite-schedules list
# Check status
testzeus schedule get schedule_id
Component Schema#
Use ScheduleConfig component:
{
"component": "ScheduleConfig",
"props": {
"name": "Daily Checkout Suite",
"cron": "0 9 * * *",
"nextRun": "2024-03-25 09:00:00 UTC",
"timezone": "UTC",
"isActive": true,
"lastRun": "2024-03-24 09:00:00 UTC"
}
}