UI unit test structure
A unit test has the following tabs:
- Overview
- Loops
- Initializer
- Test Cases
- Finalizer
- Source
Overview tab
The Overview tab describes the unit test you are writing or updating. It includes the following fields:
- Description - this field can be left blank, or you can use it to describe the scope of your testing.
- Variables - the global variables that the unit test will use. UI tests should have a minimum of three variables:
- app (or sim)
- login
- pwd
- Dump - leave this field blank.
- Mode - can be Sequential or Dirty.
Sequential will run each unit test, and then delete whatever data was created prior to running the next test.
Dirty will run each unit test, but does not delete any data created by previous unit tests.
Loops tab
If variables are set in the Loop tab, every unit test you create will run once for each value that the variable can take on.
For the purpose of UI Automation, you will want to run each unit test in three browsers: IE11, Chrome, and Firefox. To do this, create a loop variable called browser
. The browser
variable can take on either a list type or expression type:
- If you choose list type, enter all of our currently supported browsers, which at this time is only
CH
. When IE11 and Firefox are supported, you will have to addIE11
andFF
to the list. If you choose expression, you will need a Scheme expression that returns a list of the supported browsers, such as
(ui-test-browsers)
.Unless you are writing a browser-specific test, always use the expression type with the Scheme expression mentioned above. This way, when IE11 and FF are supported, your test case will automatically use these browsers.
Initializer tab
The Initializer tab contains Scheme code that runs prior to the execution of each test case in the unit test. Use this tab to set your values of app (or sim), login, and pwd (our global variables), and to run a Scheme expression that will create your login user (explained further on).
Test Cases tab
The Test Cases tab contains groups of tests within the .utest file. Each test has a unique name, a description to describe what the test is doing on a very basic level, and an enabled/disabled flag.
Finalizer tab
The Finalizer tab contains code that is executed at the end of each test in the .utest
file.
For UI tests, depending on your variable name, add the following:
(app'quit)
or
(sim'quit)
This code causes the browser to close after the test has finished running.
Source tab
The source code of the other five tabs combined is contained under the Source tab. Any changes you make in the other five tabs are reflected in this tab. It is not necessary to directly modify code from this tab’s view.