Skip to content

Adding GUI System Tests - #249

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

MikeSullivan7 wants to merge 24 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 by default but can be skipped via:
pytests tests --skip_system_tests

Tests which take too long are marked with a "skip" mark, to run these, use the flag:
pytests tests --run_slow_tests

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 Outdated
Comment thread .github/actions/linux/action.yaml Outdated
Comment thread tests/system/gui_system_main_window_test.py
@MikeSullivan7
MikeSullivan7 force-pushed the gui_system_tests branch 5 times, most recently from bd5e4d5 to 14f84e2 Compare September 10, 2026 16:13

@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.

Apologies for the long wait for review, still a few issues especially on Linux

Comment thread rascal2/core/runner.py
self.process.kill()
self.process = None
self.clear_queues_and_events()
self.matlab_helper.close_event.set()

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.

matlab helper is already stopped in the start_app function, if you are trying to stop matlab heleper for the tests it might be better to add it to the test cleanup function

sys.excepthook = sys.__excepthook__
logger = logging.getLogger("rascal2")
logger.handlers.clear()
QTimer.singleShot(SHORT_DELAY, lambda: self._click_messagebox(["Discard", "Don't Save"]))

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 doesn't work on Linux because the button name is different, maybe try using the button role https://doc.qt.io/qt-6/qmessagebox.html#ButtonRole-enum

Image

or you can clean the undo stack to prevent the msgbox from showing

("dream", 9.67234, 2000),
]
)
def test_run_slow(self, procedure_name, expected_chi, test_duration):

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.

I have a weird issue on my Linux machine where the slow test doesn't complete for some reason. It gets stuck on 99% for dream and finish is never printed for NS. Please can you investigate on a Vm or IDAaas


def setUp(self) -> None:
setup_logging()
self.start_processes_old = os.getenv("START_PROCESSES")

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.

Is the START_PROCESS env variable still needed?

This branch has not been deployed

No deployments
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