EasyTest Improvements (Coming in v2011 vol 1.7)

XAF Team Blog
18 August 2011

In this post, I would like to announce improvements to the EasyTest framework, which will be available in the next minor update.


CheckTable Command


Those XAFers who use EasyTest for testing their XAF applications, know the CheckTable command well. This command checks data in a List View. If an expected row(s) is not found, test execution fails. In certain scenarios, checking the exact content of a List View is not a requirement; it is simply enough to check the row count. For instance, you may want to test a Detail View Controller with an Action that influences the count of records in a nested List View. To cover this usage, we have introduced a new RowCount parameter. Note that this change does not break your existing tests, it just extends the CheckTable command syntax. Here is an example.

*CheckTable Contacts
 RowCount = 5

The test above fails if the contacts count is not 5. Of course, the new RowCount parameter can be mixed with other parameters.

*CheckTable Contacts
 Columns = Name
 Row = Sam
 Row = John
 RowCount = 2


If you need to check to see if a table is empty, there is no need in the RowCount parameter, just use the CheckTable command without secondary parameters.

*CheckTable Contacts

As the CheckTable command does not allow the "!" prefix, the new RowCount parameter with the "!=" operator is required to ensure that a table is not empty.

*CheckTable Contacts
 RowCount != 0

I believe you will find this minor improvement helpful when EasyTesting your applications.


ReopenApplication Command

The ReopenApplication command restarts an application during the test flow. But, in certain scenarios, testing multiple applications with a common data set in a single EasyTest script is required. For instance, you may want to start a Windows Forms application, make some changes, and then see how these changes affect the ASP.NET application. Now, the ReopenApplication command takes the optional parameter that specifies the name of the application to be started after closing the current one.

#DropDB MySolution
#Application MySolutionWin

; ...

*ReopenApplication MySolutionWeb

; ...

 

CompareScreenshot and SetActiveWindowSize Commands


The CompareScreenshot command takes the screenshot of the active window (or browser's content) and compares it with the template PNG image specified by the primary parameter. When the script is executed for the first time and there are no templates, this command simply creates templates (the Images subfolder of the configuration file location is used for this purpose). The actual testing is performed on subsequent test runs, and the command fails if the current and template screenshots are not identical. You can use this command to ensure that your carefully crafted layout is not changed accidentally, or to check that the markup of your custom web template is not corrupted. The SetActiveWindowSize command, as its name suggests, resizes an active window. You can use it to guarantee that window sizes on the current and etalon screenshots are the same. Below is an example of using these commands together.

*SetActiveWindowSize 640x480
*CompareScreenshot ContactsDetailViewWin.png

Another possible usage of these commands is the automatic generation of illustrations for end-user documentation. Keeping screenshots up-to-date for each new version takes a lot of effort. You can simplify this task by implementing an EasyTest script, and running it each time when there are noticeable changes in a UI. The only thing left to do is to delete obsolete images from the folder with templates before running a script.


Certainly, I will include information from this post in the next update of XAF documentation.

Free DevExpress Products – Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We’ll be happy to follow-up.
No Comments

Please login or register to post comments.