Skip to content

Adding GUI System Tests - #249

Open
MikeSullivan7 wants to merge 12 commits into
RascalSoftware:mainfrom
MikeSullivan7:gui_system_tests
Open

Adding GUI System Tests#249
MikeSullivan7 wants to merge 12 commits into
RascalSoftware:mainfrom
MikeSullivan7:gui_system_tests

Conversation

@MikeSullivan7

@MikeSullivan7 MikeSullivan7 commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

This PR introduces a new form of GUI System Test which creates an instance of RasCal2, performs a sequence of events (clicks, typing, etc) and tests the validity of the output. This is more useful than isolated unit tests as it tests theinteraction between different parts of the program and more closely resembles a realistic user workflow.

System tests inherit the GuiSystemBase class, which handles the setUp and tearDownof theself.main_window` instance, simplifying how the tests are written.

Unit tests and System tests are differentiated in pytest. We can run only unit tests via:
pytest tests or pytest tests --run-unit-tests

System tests are run with the window hidden by default and can be ran via:
pytests tests --run-system-tests
to show the window while tests are running:
pytests tests --run-system-tests-show

If we want to include screenshot/eyes tests in the future, a flag can be created for them to differentiate screenshot tests from unit and system tests.

@MikeSullivan7
MikeSullivan7 marked this pull request as ready for review August 21, 2026 17:02
@MikeSullivan7
MikeSullivan7 marked this pull request as draft September 3, 2026 14:52
@MikeSullivan7
MikeSullivan7 marked this pull request as ready for review September 3, 2026 15:43

@StephenNneji StephenNneji left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, please see comments

Also please update the unit testing section in contributing.md appropriately

Comment thread tests/conftest.py


def pytest_addoption(parser):
parser.addoption("--run-system-tests", action="store_true", default=False, help="Run GUI system tests offscreen")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing "--run-system-tests" and "--run-system-tests-show"", both show the ui, are both needed?

run: xvfb-run pytest -s tests/ ${{ inputs.pytest-options }} --cov=rascal2 --cov-report=term
- name: Pytest System Tests
shell: bash -l {0}
run: xvfb-run pytest -s tests/system/ ${{ inputs.pytest-options }} --cov=rascal2 --cov-report=term

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is missing the system-test flag.

I think since the system tests are not expensive, maybe we should run them by default i.e pytest tests should run unit and system

then the provided flags can be to skip instead of run i.e --skip_system_tests. This will also be neater on the ci so we have a single test run and coverage for all the test..

def tearDown(self) -> None:
super().tearDown()

def test_main_window(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please delete test_ui.py as it duplicates this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants