Testing XUL applications

There are various ways to test applications. For GUI applications, you have the following options:

1.) manual testing
2.) unit tests
3.) UI-based tests

The latter two can run automated which is important for continous integration to succeed. When run frequently, automated tests can catch bugs before they affect a wider audience. Preferrably developers should be able to run the tests themselves, so that they don't reintroduce bugs you already have tests for.

An additional goal is having product management define the test runs. The advantages are: time and test diversity. First, if a product manager does not have to continously test an application manually, but can instead integrate new features into a test suite, a lot of time will be saved. Second, his or her distinct perspective of a product will enable the PM to produce more diverse tests. This is especially true if not everybody on the programming team knows all details about the program's intended usage.

So how does UI testing work in our case? The application is loaded into Mozilla. It includes a test matrix which defines each step of the test. The matrix is simple P-code. E.g.

ActionTargetValue
switch_tabcustomer 
typeid.realnameSmith
commandid.b_save 


In the example, we switch the current view to a tab named "customer", write "Smith" into the field with the id realname and then hit the save button.

With the above steps you lead the application to the state you want to test:

ActionTargetValue
assert_valueid.realnameSmith
assert_disabledid.b_advanced 


If the assert fails, the whole test fails. With the checks you can verify that data is correctly loaded and displayed after a save procedure. Calculated results can be validated. Field states (e.g. being disabled or readonly or visible) can be tested for.

Generated data can be stored in variables and later be referenced using ${varname}.

ActionTargetValue
store_valueid.debitorname
typeid.kreditor${name}


In the example, we copy the contents of the field debitor to the field kreditor. First the value of the field debitor is stored in the variable name. It is then stored in the field kreditor. All values (the right side of the expression) are expanded, so that variables can be used for all actions.

Check out Selenium for a complete suite of tests for HTML-based web applications. There is also a Session Recorder for Selenium which makes creating tests extremely easy. Just click through your application as usual and the recorder will produce a testcase for you.

Trackbacks

    No Trackbacks

Comments

Display comments as (Linear | Threaded)

  1. Chander Kochar says:

    Hi Sascha,

    We have an .xul application, used to create a database. It can be opened in firefox if I give the path chrome://..../workers.xul
    The problem is IDE doesn't record the enteries i make? Is there something I am missing or is there any way to use IDE to test the application?

    If not, could someone please suggest how i can test a .xul application?

    Thanks


Add Comment


Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA 1CAPTCHA 2CAPTCHA 3CAPTCHA 4CAPTCHA 5