Version 8.3.4
 —  Special Development Topics  —

Automated Testing

An Application Designer application usually consists of layout pages, corresponding Java or Natural adapters and additional server-side Java or Natural implementation. For testing the server-side implementations that are not related to a user interface, good test coverage can be achieved, for example, with JUnit tests. To achieve reasonable test coverage for the whole application, however, automated tests for the parts which relate to the user interface are also required.

For testing web applications, tools such as Selenium (see http://docs.seleniumhq.org/) are available. In automated tests, the test cases have to locate different elements in an HTML page. The tests usually use identifiers in order to locate the elements for testing. When an Application Designer layout page is published, the identifiers are automatically generated in the corresponding HTML page using continuous numbering. However, identifiers which are based on continuous numbers are not suitable for automated tests. Even a small change such as rearranging fields or adding an additional field will change the corresponding number and break the test. Therefore, it is more suitable to use stable identifiers in the test cases. With stable identifiers, the tests will still run correctly when small changes have been applied to the layout.

With Application Designer, you can add stable identifiers (test tool IDs) to the controls. In the Layout Painter, the Miscellaneous tab of the properties area contains the testtoolid property. The value for this property can be chosen freely. It is not used within the Application Designer framework.

The value of the testtoolid is generated into the corresponding generated HTML page and the element can thus be located by the test program in a stable way.

The following shows an extract from the generated HTML. You can see the difference between the unstable id value and the stable testtoolid value. When the field is rearranged on the page, the id value will change. The testtoolid value, however, will stay the same.

<input id="F_28" name="CC" class='FIELDInputEdit'
testtoolid='mytestid' type="text" size='15'  style=" ">

With the tool Selenium, for instance, you can locate the FIELD control using a corresponding XPATH expression which contains the testtoolid value. This XPATH will still be valid even if you add fields to the layout.

Top of page