nus-cs2103-AY2223S2 / forum

12 stars 0 forks source link

Testing GUI #252

Closed tituswe closed 1 year ago

tituswe commented 1 year ago

I am unable to pass codecov because I made changes to the MainWindow.java file.

Previously, the controller classes in the ui component were not covered by tests.

But upon editing the files, codecov starts to give me warnings when I make pull requests.

Im having trouble with testing MainWindow.java because it requires me to initiate a full setup of the application and launch the GUI upon running the testfile.

Does anyone have an efficient way to test the ui component? Or is there a different way I can remove the ui component from codecov?

Screenshot 2023-03-12 at 3 09 48 PM
eugenetangkj commented 1 year ago

Hi, I saw some test classes from Address Book Level 4 such as GuiUnitTest and UiPartTest that utilise the TestFx library to do GUI testing. I think they might be useful for you, but may I also confirm whether we are allowed to use and adapt them as long as reuse credit is given?

damithc commented 1 year ago

@eugenetangkj @tituswe relevant comment https://github.com/nus-cs2103-AY2223S2/forum/issues/240#issuecomment-1455004722

I think they might be useful for you, but may I also confirm whether we are allowed to use and adapt them as long as reuse credit is given?

Yes, allowed. Caveat: GUI tests are hard to manage in CI environments as CI environments don't support GUIs (there is no monitor/screen in CI environments). You have to use something called the 'headless mode' to run GUI tests in such environments. It's possible (AB4 does that), but it is a quite a bit of of extra work.

tituswe commented 1 year ago

@eugenetangkj @damithc Okay great ill go check out how AB4 does the UI testing! Thanks for the advice :-)