- Assuming you have separated the GUI from the business logic, I strongly suggest to test the businesslogic independent from the GUI. E.g. in .NET by means of MVVM and run tests based on the provided commands.
- GUI Test is then only for checking if the GUI properly connects to the business logic (e.g. if the open menu really triggers the open function and not for example the save function, etc.)
- Finally, you don't get away without manual GUI tests: rendering, color, readability, clipping, etc. needs visual inspection. I.e. I doubt that you get robust automation for these topics.
E.g. in your example, you would have a ViewModel that provides the SQL queries (not the GUI, the GUI in this scenario does not know anything about SQL...). You would test the ViewModel without the GUI and check the proper response from the business logic again in the ViewModel. The GUI test then only checks if the correct function is triggered, i.e. if each text box is bound to the right ViewModel property.
Separate GUI from the rest - DFT (Design-For-Test)!