How bittersoftware/stb-tester-automation works
Project Type and Purpose
• It uses the Page Object Model (POM) to encapsulate UI/menu screens, drives the device via a mock “device_access” layer, and reports/manages tests via a mock “test_management” layer.
• Test cases (TC-1…TC-12) exercise decoder features (zapping, living apps, KPI, network capture).
High-Level Components
a. Test Runner / Test Cases
• test_cases/*.py
• Orchestrates scenarios using page objects, utils, device and test-management services.
b. Page Object Model (POM)
• common/la/* and common/pages/*
• Defines static elements (images), visibility checks, and actions for each screen.
c. Utilities
• common/utils/*.py and utils/imports_utils.py
• Shared helpers: timestamp, navigation logic, OCR corrections, plotting.
d. Device Access Layer
• device_access/device_access.py
• Abstracts SSH/Telnet/REST commands to the physical decoder (mocked in this repo).
e. Test Management Layer
• test_management/test_management.py
• Abstracts test-plan retrieval (JIRA, CSV) and result reporting (mocked).
f. Configuration
• config.conf
• Contains environment settings (e.g. device credentials, timeouts).
g. External Dependencies
• stbt library for frame capture & object matching
• Network-capture analyzer (used by TC-8 & TC-10)
Relationships & Data Flow
• The Test Runner loads config.conf and test_management to pick up test plans.
• For each test case:
• It uses imports_utils to dynamically load the TC module.
• The TC calls page_object.perform_some_action() to navigate on screen.
• PageObject classes use stbt to capture frames and match reference images.
• When actions invoke remote operations (e.g. changing channel), PageObject uses device_access APIs.
• device_access sends commands to the decoder and returns status.
• Test logic may call common/utils.plot or the external network analyzer for charts.
• Test results and metrics are handed back to test_management for final reporting.
Architectural Patterns & Design Principles
• Page Object Model: keeps UI-screen locators and actions in one place.
• Layered Architecture: separation of concerns between Test Orchestration, POM, Device I/O, Test Management, and Utilities.
• Dependency Injection via imports_utils for modularity of test cases.
• Mocking of external services (device, test plan) for demo purposes.