How do I fake input for form testing?

I am creating a test tape for my Delphi 2009 application. Testing the logic is pretty simple. To make sure that the forms work correctly is a bit more complicated. I would like to simulate real user input, open the form, make it think that the user enters certain things and clicks in certain places and makes sure that they react correctly. I am sure there is a way to do this, I just do not know what it is. Does anyone know how to do this?

+6
input events delphi testing
source share
8 answers

DUnit has GUITesting.pas that extends testing, so you can send clicks, keys, and text to controls in a form, but that does.

Last year, where Zombie was mentioned The graphical testing environment that was used by internal CodeGear developers, but nothing since Steve went to Falafel.

+6
source share

TestComplete is a good choice. Another commercial option for testing GUIs is SmarteScript :

+5
source share

good for .net there NUnitForms for testing the win application GUI. don't know open source for delphi though.

Test Complete can test delphi forms, but it's not free.

+1
source share

There are 2 parts, firstly, how you automate the graphical interface, and secondly, how can I โ€œcheckโ€ whether it works / does not work.

Firtsly: To automate the GUI on Windows, try using AutoIT. This is a free tool for managing Windows interfaces, sending keyboard input events, etc. http://www.autoitscript.com/autoit3/

Secondly: Testing is a big field, and I will not try to give you a whirlwind tour. But the mechanics of managing the graphical interface and testing the results can be processed using AutoIT, which is built into Basic as a language, or using it in combination with the Ruby language and TestUnit (Rubys built-in unit testing system).

+1
source share

If there is nothing delphi-specic and you need a quick solution, try some easy-to-learn scripting solutions such as AutoIt . For more complex scenarios, you can take a look at Scripted GUI Testing with Ruby .

But keep in mind that you should not experience too many functions through the graphical interface, because such tests are likely to break. If you finish too much GUI testing, you may need to rethink the design: separate the logic from the GUI and test the logic directly using some xUnit framework.

Also consider a similar question about automating Windows Forms .

+1
source share

DUnit seems to have some gui testing features: delphiextreme.com

+1
source share

Not quite the answer to your question, but there is a very good page (IMHO, of course) about Martin Fowler's GUI Architectures , demonstrating the "Humble View" architecture as the last post that is specifically focused on developing test-based software. Worth a look.

This, of course, will not help you verify that all controls are connected correctly and handle all the necessary events, but this should help minimize the amount of GUI code that requires .

0
source share

OpenCTF is right for you.

Quote:

OpenCTF is a test environment add-on for Embarcadero Delphiยฎ that automatically validates all components in Forms (or DataModules).

It provides an easy way to create automatic quality checks for large projects in which many components must pass repeated tests.

Adding OpenCTF tests to the DUnit test suite requires only a few lines of code. Writing your own custom component tests takes only a few seconds.

OpenCTF is based on the open source DUnit benchmark and extends this to specialized test classes and helper functions.

Send here to download.

0
source share

All Articles