mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-07-19 16:40:01 +00:00
GUI Tests
This directory contains tests for the GUI components of the StreamingCommunity application.
Test Files
test_main_window.py
: Tests for the main window class (StreamingGUI
)test_run_tab.py
: Tests for the run tab component (RunTab
)test_results_table.py
: Tests for the results table widget (ResultsTable
)test_stream_redirect.py
: Tests for the stdout redirection utility (Stream
)test_site_manager.py
: Tests for the site manager utilitytest_integration.py
: Integration tests for all GUI components working together
Running the Tests
Using the Test Runner
The easiest way to run the tests is to use the included test runner script:
# Run all tests
cd Test/GUI
python run_tests.py
# Run specific test files
python run_tests.py test_main_window.py test_run_tab.py
# Run with different verbosity level (1-3)
python run_tests.py -v 3
Using unittest Directly
You can also run the tests using the standard unittest module:
# Run all GUI tests
python -m unittest discover -s Test/GUI
# Run individual test files
python -m unittest Test/GUI/test_main_window.py
python -m unittest Test/GUI/test_run_tab.py
python -m unittest Test/GUI/test_results_table.py
python -m unittest Test/GUI/test_stream_redirect.py
python -m unittest Test/GUI/test_site_manager.py
python -m unittest Test/GUI/test_integration.py
Test Coverage
The tests cover the following aspects of the GUI:
-
Basic Initialization
- Proper initialization of all GUI components
- Correct parent-child relationships
- Default states of widgets
-
UI Creation
- Correct creation of all UI elements
- Proper layout of widgets
- Initial visibility states
-
Widget Interactions
- Button clicks
- Checkbox toggles
- Table updates
-
Process Execution
- Script execution
- Process termination
- Status updates
-
Integration
- Components working together correctly
- Signal-slot connections
- Data flow between components
Adding New Tests
When adding new GUI components, please add corresponding tests following the same pattern as the existing tests. Each test file should:
- Import the necessary modules
- Create a test class that inherits from
unittest.TestCase
- Include setup and teardown methods
- Test all aspects of the component's functionality
- Include a main block to run the tests when the file is executed directly
Notes
- The tests use
unittest.mock
to mock external dependencies likeQProcess
- A
QApplication
instance is created in thesetUpClass
method to ensure that PyQt widgets can be created - The tests clean up resources in the
tearDown
method to prevent memory leaks