Skip to content

Automated test runner for embedded devices with templates, logs, and reports. Desktop GUI powered by PyQt5 and Python.

License

Notifications You must be signed in to change notification settings

BaseMax/qt-embedded-test-suite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Qt Embedded Test Suite

Automated test runner for embedded devices with templates, logs, and reports. Desktop GUI powered by PyQt5 and Python.

Version Python License

Overview

Qt Embedded Test Suite is a comprehensive desktop application designed for automating functional and electrical tests for embedded devices. Built with PyQt5, it provides a user-friendly interface for creating test templates, executing tests via serial communication, monitoring progress in real-time, and generating detailed reports.

Features

Core Functionality

  • βœ… Test Template System - Create and manage JSON-based test templates with multiple steps
  • βœ… Step-Based Execution - Execute tests step-by-step with configurable timeouts and retries
  • βœ… Serial Command Scripting - Send commands and validate responses via serial ports
  • βœ… Live Logging - Real-time log viewer with color-coded message levels
  • βœ… Pass/Fail Evaluation - Automatic evaluation of test results based on expected outputs
  • βœ… Timing Control - Configurable timeouts and retry mechanisms for each step
  • βœ… SQLite Persistence - Store all test runs, results, and logs in a local database

User Interface

  • πŸ“Š Dashboard - Overview of test statistics and performance metrics
  • πŸ“ Template Manager - Visual editor for creating and modifying test templates
  • ▢️ Test Runner - Execute tests with real-time progress indicators and live logs
  • πŸ“‹ Results Viewer - Browse and analyze historical test results with filtering
  • βš™οΈ Settings Dialog - Configure default parameters for tests and serial communication

Reporting

  • πŸ“„ CSV Export - Export individual test results or summaries to CSV format
  • 🌐 HTML Reports - Generate comprehensive HTML reports with styling and graphs
  • πŸ“Š Progress Tracking - Visual progress bars and step-by-step status updates

Error Handling

  • πŸ›‘οΈ Comprehensive Error Handling - Robust error detection and reporting
  • πŸ”„ Retry Mechanisms - Automatic retry of failed steps with configurable attempts
  • ⚠️ Error Notifications - User-friendly error messages and warnings
  • πŸ“ Detailed Logging - Complete audit trail of all test activities

Installation

Prerequisites

  • Python 3.6 or higher
  • pip (Python package manager)

Install from Source

# Clone the repository
git clone https://github.com/BaseMax/qt-embedded-test-suite.git
cd qt-embedded-test-suite

# Install dependencies
pip install -r requirements.txt

# Install the package
pip install -e .

Install Dependencies Only

pip install PyQt5>=5.15.0 pyserial>=3.5 python-dateutil>=2.8.0

Quick Start

Running the Application

# From the project root directory
python src/main.py

# Or if installed via pip
embedded-test-suite

Creating Your First Test Template

  1. Open the Templates Tab
  2. Click "New" to create a new template
  3. Enter Template Details:
    • Name: My First Test
    • Description: Basic device communication test
  4. Define Test Steps in JSON format:
{
  "steps": [
    {
      "name": "Initialize Device",
      "command": "init",
      "expected_output": "OK",
      "timeout": 10,
      "retry_count": 2,
      "optional": false
    },
    {
      "name": "Get Version",
      "command": "version",
      "expected_output": "v1.0",
      "timeout": 5,
      "retry_count": 1,
      "optional": false
    }
  ]
}
  1. Click "Save Template"

Running a Test

  1. Go to the "Run Test" Tab
  2. Select a Template from the dropdown
  3. Select a Serial Port (or click "Refresh" to update the list)
  4. Set Baud Rate (default: 115200)
  5. Click "Start Test"
  6. Monitor Progress in real-time through the live log and progress bar
  7. Review Results after completion

Viewing Results

  1. Go to the "Results" Tab
  2. Filter by Status (All, Passed, Failed, Error)
  3. Select a Test Run to view detailed information
  4. Export Reports using CSV or HTML buttons

Project Structure

qt-embedded-test-suite/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ main.py                    # Application entry point
β”‚   β”œβ”€β”€ database/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── db_manager.py          # SQLite database manager
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   └── __init__.py            # Data models
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ serial_handler.py      # Serial communication
β”‚   β”‚   └── test_executor.py       # Test execution engine
β”‚   β”œβ”€β”€ ui/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ main_window.py         # Main application window
β”‚   β”‚   β”œβ”€β”€ dashboard_widget.py    # Dashboard view
β”‚   β”‚   β”œβ”€β”€ template_manager_widget.py
β”‚   β”‚   β”œβ”€β”€ test_runner_widget.py
β”‚   β”‚   β”œβ”€β”€ results_viewer_widget.py
β”‚   β”‚   └── settings_dialog.py
β”‚   β”œβ”€β”€ reports/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── report_generator.py    # CSV/HTML report generation
β”‚   └── utils/
β”‚       └── __init__.py
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ basic_device_test.json
β”‚   β”œβ”€β”€ advanced_diagnostic_test.json
β”‚   └── simple_communication_test.json
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ setup.py
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE
└── README.md

Test Template Format

Test templates are defined in JSON format with the following structure:

{
  "steps": [
    {
      "name": "Step name",
      "command": "command to send",
      "expected_output": "expected response",
      "timeout": 30,
      "retry_count": 2,
      "optional": false
    }
  ]
}

Field Descriptions

  • name (string, required): Human-readable name for the step
  • command (string, required): Command to send via serial port
  • expected_output (string, optional): Expected response substring
  • timeout (integer, optional): Maximum wait time in seconds (default: 30)
  • retry_count (integer, optional): Number of retry attempts on failure (default: 0)
  • optional (boolean, optional): If true, test continues even if step fails (default: false)

Database Schema

The application uses SQLite to persist all data:

  • test_templates: Template definitions
  • test_steps: Individual steps within templates (deprecated, moved to JSON)
  • test_runs: Test execution instances
  • test_step_results: Results of individual step executions
  • test_logs: Detailed execution logs

Serial Communication

Supported Features

  • Multiple baud rates (9600 to 921600)
  • Auto-detection of available serial ports
  • Configurable timeouts
  • Pattern matching for expected outputs
  • Real-time data streaming

Typical Workflow

  1. Connect to serial port at specified baud rate
  2. Send command with optional newline
  3. Wait for expected output or timeout
  4. Retry on failure if configured
  5. Log all communication for debugging

Reporting

CSV Reports

  • Individual test run details
  • Summary of multiple test runs
  • Includes all metadata and step results

HTML Reports

  • Styled, professional reports
  • Color-coded status indicators
  • Embedded step results and logs
  • Progress visualization

Development

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Write or update tests if applicable
  5. Submit a pull request

Code Style

  • Follow PEP 8 guidelines
  • Use type hints where appropriate
  • Document functions and classes with docstrings
  • Keep functions focused and modular

Troubleshooting

Serial Port Issues

  • No ports found: Ensure device is connected and drivers are installed
  • Connection failed: Check port permissions (Linux/Mac) or COM port number (Windows)
  • Timeout errors: Increase timeout value or check device responsiveness

Application Issues

  • Database errors: Delete test_results.db to reset the database
  • Import errors: Reinstall dependencies with pip install -r requirements.txt
  • UI rendering issues: Update PyQt5 to the latest version

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Author

BaseMax

Acknowledgments

  • Built with PyQt5 for the Qt framework
  • Uses pyserial for serial communication
  • SQLite for data persistence

Version History

v1.0.0 (2024)

  • Initial release
  • Complete PyQt5 GUI implementation
  • Test template system
  • Serial communication support
  • SQLite persistence
  • CSV/HTML reporting
  • Dashboard and analytics

About

Automated test runner for embedded devices with templates, logs, and reports. Desktop GUI powered by PyQt5 and Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages