Running Tests
This guide explains how to execute tests in TrueAssert and understand the test execution process.
Overview
When you run a test:
A TestExecution is created with status IN_QUEUE
The controller's background processor picks up the test
Commands are queued for each test step
An available agent executes the commands
Results are reported back and displayed in real-time
Running a Test
From Test Detail Page
Navigate to the test detail page (Test Detail)
Ensure the test status is READY (not DRAFTING or REVIEW)
Click the "Run Test" button
The test execution begins immediately
What Happens
Immediate Actions:
TestExecution object created with IN_QUEUE status
TestStepExecution objects created for each step (status: PENDING)
Test's
last_executionfield is updatedStatus changes to RUNNING when controller picks it up
Execution Process:
CLEAR_BROWSER command is queued first (clears browser state)
If
login_required=True, login flow executesIf
use_predefined_session=True, session is loadedTest steps are executed in order
Each step execution updates status: PENDING → RUNNING → SUCCESS/FAIL
Test execution completes: RUNNING → SUCCESS/FAIL
Execution Status
Test Execution Status Flow
IN_QUEUE → RUNNING → SUCCESS/FAILStatus Meanings:
IN_QUEUE: Test is waiting to be picked up by controller
RUNNING: Test is currently executing
SUCCESS: All steps completed successfully
FAIL: One or more steps failed
Step Execution Status Flow
PENDING → RUNNING → SUCCESS/FAIL/SKIPPEDStatus Meanings:
PENDING: Step is waiting to be executed
RUNNING: Step is currently executing
SUCCESS: Step completed successfully
FAIL: Step failed (error message available)
SKIPPED: Step was skipped (rare)
Monitoring Execution
Real-time Updates
The test detail page polls for status updates:
Polling Interval: Every 2 seconds
Status Badge: Updates automatically (RUNNING, SUCCESS, FAIL)
Progress Bar: Shows completed steps / total steps
Step Status: Each step shows its execution status
Execution Details
View detailed execution information:
Click on the execution status badge
Or navigate to Execution Detail
See:
All step results with status
Screenshots (if captured)
Error messages for failed steps
Execution logs
Command Queue System
How Commands Are Queued
TestExecutor creates Command objects for each step
Commands are added to CommandQueue
Commands include:
execution_id: Links to TestExecutionstep_id: Links to TestStepExecution UUIDaction_type: CLICK, FILL, GOTO, WAIT, etc.selector: XPath or CSS selectorvalue: Input value (for FILL)description: Human-readable description
Agent Assignment
Controller's background processor runs every 2 seconds
Finds tests with IN_QUEUE status
Assigns test to available agent
Agent polls for commands via gRPC
Agent executes commands and reports results
Execution Flow Details
Step 1: Test Execution Creation
When you click "Run Test":
execution = TestExecution.objects.create(
test=test,
triggered_by=request.user,
status=TestExecution.Status.IN_QUEUE,
test_version=test.version
)Step 2: Step Executions Created
For each test step:
TestStepExecution.objects.create(
test_execution=execution,
test_step=step,
status=TestStepExecution.Status.PENDING
)Step 3: Commands Queued
TestExecutor queues commands:
CLEAR_BROWSER command (always first)
Login flow commands (if
login_required=True)Session load commands (if
use_predefined_session=True)Test step commands (in order)
Step 4: Agent Execution
Agent receives commands via gRPC:
Polls for next command
Executes command in browser (Selenium)
Reports result back via
ReportResultRPCController updates TestStepExecution status
Step 5: Completion
When all steps complete:
TestExecution status → SUCCESS or FAIL
Final screenshot captured (if enabled)
Execution results saved
Login Flow During Execution
If login_required=True:
Session Validation (first attempt):
LOAD_SESSION command
Validation steps (GOTO + WAIT from login test)
If successful: Skip full login
Full Login (if validation fails):
CLEAR_BROWSER command
Execute all login test steps
SAVE_SESSION command
Session data saved to database
See Session Management for details.
Session Flow During Execution
If use_predefined_session=True:
Load session data for project's domain
LOAD_SESSION command with session data
Navigate to target URL
Execute test steps
Error Handling
Failed Steps
When a step fails:
Step status → FAIL
Error message stored in TestStepExecution
Screenshot captured (if enabled)
Test continues with next step (unless critical failure)
Test Failure
Test fails if:
Login flow fails (when
login_required=True)Session load fails (when
use_predefined_session=True)Critical step fails (depends on test configuration)
Common Errors
"No available agent":
No agents are connected
All agents are busy
Check Agents page for agent status
"Test is already running":
Previous execution still in progress
Wait for current execution to complete
Or cancel previous execution
"Selector not found":
Element doesn't exist on page
Selector is incorrect
Page structure changed
Execution Logs
Viewing Logs
Go to test detail page
Click on execution status
View step-by-step execution results
Check error messages for failed steps
Screenshots
Screenshots are captured:
After each step (if enabled)
On step failure (automatic)
At test completion
View screenshots:
In execution detail page
Click on step result
Screenshot URL: Screenshot
Best Practices
Before Running
Verify Test Status: Ensure test is READY
Check Agents: Verify agents are available
Review Steps: Check that all steps are correct
Verify Selectors: Ensure selectors are valid
During Execution
Monitor Progress: Watch status updates
Check Logs: Review execution logs if issues occur
Wait for Completion: Don't run test again while executing
After Execution
Review Results: Check all step results
Analyze Failures: Read error messages
Check Screenshots: Visual verification of steps
Fix Issues: Update selectors or steps as needed
Troubleshooting
Test Stuck in IN_QUEUE
Possible Causes:
No agents available
Controller background processor not running
Agent connection issues
Solutions:
Check Agents page for agent status
Verify controller is running
Restart agent if needed
Test Stuck in RUNNING
Possible Causes:
Agent crashed or disconnected
Command execution timeout
Browser hang
Solutions:
Check agent logs
Restart agent
Check for browser issues
Steps Not Executing
Possible Causes:
Commands not queued properly
Agent not receiving commands
Selector issues
Solutions:
Check command queue status
Verify agent is polling
Review selector validity
Related Topics
Viewing Results - Understand execution results
Debugging Failed Tests - Fix test failures
Session Management - Handle authentication
Your First Test - Create and run your first test
Last updated