Build Your Own Test Harness For #Delphi XE8 Firemonkey Apps On #Android And #IOS


If you are building complex enterprise applications with Delphi XE8 Firemonkey you may want to look into building a test harness for your applications on Android, IOS, OSX, and Windows. Basically a test harness is an automated way of testing your application to make sure that it behaves like you want it to and that any changes that you make do not break functionality. Using a test harness is similar to unit testing except in this case you would be using the test harness to visually test your app. So to create a test harness you would need to create some kind of click and data entry automation system. The sample source code that I am including with this post will allow you to get a head start in creating such a system. What the sample code does is it uses app tethering to send an image of the current application via app tethering to a second application. It does this by using Firemonkey’s MakeScreenshot function on a TLayout control. All children of the TLayout are drawn in the screenshot. You can then send a click back from the second application to the first application where it clicks a button in the TLayout. Any additional functionality like actually entering text into a text box you would have to implement yourself. This method of sending clicks between two Firemonkey apps will also not work with controls like TWebBrowser and probably TMapView because those are native controls. The code for this sample originated in the TImageCacheLayout component. You could also use this same code to remotely control a Firemonkey app. You can also take a look at the Accessibility Pack for Delphi XE8 Firemonkey which may allow you to build a test harness using the accessibility functionality. This sample code should also work in Appmethod.
Download the test harness sample source code for Delphi XE8 Firemonkey on Android and IOS.

Comments are closed.