Design, plan and give recommendations on best ways to do automation tests of software in python robot framework. System under test is accessible through network api and system state is constantly streamed through udp from two channels, each Channel state slightly difffers from other and they can be more slightly out of sync for Small amount of time. It is required to test system state for intented and unintended changes, be able to wait for desired states and to be able to test that some values in system state are in given range, not just equal. It is a safety critical system where human life is at stake. Also consider top 3 key questions should be answered before designing those automation tests.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Designing and implementing automation tests for a safety-critical system, especially one where human life is at stake, requires extreme care, precision, and thoroughness. You're working with:
A network API to control or query the system.
Two UDP channels streaming system state, which may be slightly out of sync.
The need to validate expected behavior, detect unintended changes, wait for expected states, and verify value ranges, not just exact values.
🔍 Top 3 Key Questions Before Designing Automation Tests
1. What are the safety requirements and critical failure modes?
Which system behaviors or transitions could lead to unsafe conditions?
What thresholds (numerical or temporal) define an acceptable vs. unacceptable deviation?
Are there known edge cases or race conditions in the UDP stream synchronization?
2. How accurate and reliable are the UDP streams as sources of truth?
What is the expected latency and jitter between the two UDP channels?
How often do they update, and how are timestamps handled?
Are certain fields more critical than others, requiring stricter validation?
3. What level of observability and traceability is required during test execution?
Should all state changes be logged with timestamps?
Is it important to replay or visualize state changes post-execution?
How will failures be reported and analyzed to support root cause analysis?
🧱 Architecture Overview for Test Automation
Here's a high-level architecture for your automation framework:
code
[Robot Framework Tests]
↓
[API Layer] – REST/gRPC/CLI to interact with system under test
↓
[UDP Listener Module] – Listens on both UDP channels, parses messages
↓
[State Validator] – Compares actual state against expected, within tolerances
↓
[Log & Report] – Detailed logs, screenshots, traces, failure reports
✅ Recommendations for Robot Framework Implementation in Python
1. Use Robot Framework with Python Libraries
Robot Framework works well with custom Python libraries. You can create:
ApiLibrary.py – For interacting with the system via API
UdpListener.py – To capture UDP packets from both channels
StateValidator.py – For comparing current state to expected state
SafetyChecker.py – For checking if any observed state violates safety constraints
3. Implement Custom Keywords for Waiting and Validation
Example: Wait Until Temperature In Range
python
def wait_until_temperature_in_range(self, low, high, timeout=30, poll_interval=0.5):
max_time = time.time() + timeout
while time.time() < max_time:
latest_state = self.get_latest_state()
if latest_state.is_temperature_in_range(low, high):
return True
time.sleep(poll_interval)
raise AssertionError(f"Temperature not in range [{low}, {high}] after {timeout}s")
Used in Robot:
robotframework
Wait Until Temperature In Range 20 25 timeout=60
4. Timestamp Alignment Between UDP Channels
Because UDP streams may be out of sync:
Use timestamps embedded in each packet to align state data
Implement interpolation/extrapolation logic if needed
Log discrepancies and optionally fail if skew exceeds safety threshold
5. Test Structure Examples
Validate System State After API Command
robotframework
Test System Recovers After Fault
[Tags] safety
Inject Fault Into System
Wait Until System State Changes timeout=10
Verify System Status Is Safe
Verify Critical Parameters In Range