MarathonITE includes a recorder that you use to record test scripts. Even when you manually create a script, it is best to start with a recorded script. This will ensure that all accessed components are available in the object map.
About Test Scripts
MarathonITE test scripts are regular Ruby scripts. MarathonITE adds some methods to the language run-time. MarathonITE scripts are procedural in nature – this ties in with how you think about tests.
Every test script starts executing at the test method. Before starting the script, MarathonITE uses the defined fixture to start the application. Fixtures themselves are Ruby scripts. When you create a new project, Marathon creates a default fixture in the Fixtures folder. You can use fixtures to create a well-known state for the test case.
1. Selecting an Active Fixture
Before you start recording a test script – you need to select an active fixture. When you create a project, MarathonITE selects default fixture as the active fixture.
You select an active fixture using
Marathon -> Select Fixture… menu option. You may also click on the active fixture shown in the status bar to open Select Fixture dialog. From this dialog you can pick a fixture from the available fixtures.
2. Create a New Test Script
Once an active fixture is selected, you should create a test script. Whenever a script is created, MarathonITE records the active fixture in the script.
File -> New select New Test Case option. You can also use the toolbar button or press Ctrl+N to create a new test case. MarathonITE opens an Untitled test case in a new editor. The cursor is positioned so that you can start recording.
3. Recording a Script
You can start recording your script. Use the Record toolbar button for starting the recording. Alternatively, you can use the
Marathon -> Record menu item or use Ctrl+R keystroke to start recording.
MarathonITE starts recording your actions on the AUT. You will see a Wait message and MarathonITE starts your application. The main window is closed and a Control Center window is displayed.
MarathonITE records any operations that you perform on the application. The Control Center window displays the last few recorded operations.
MarathonITE records operations at a higher level than keyboard or mouse events. In most cases, MarathonITE records the operation when a component looses focus.
Some of the operations that do not change the state of a component do not get recorded by MarathonITE. For e.g, moving into a text-field and moving out without changing the text will not record a operation.
4. Object Spy and Adding Checkpoints
While recording a script, you can use an object spy to inspect attributes of a component. While keeping mouse pointer on a component, use
Ctrl+rightclick to open the object spy window. You can change the currently inspected component, by clicking another component in the application. The Spy window will show the properties and values of the selected component.
The object spy window is also called Assertions Window. From the object spy window, you can insert assertions and wait calls into the test script.
For adding an assertion, select a property and click on the Insert Assertion button. You can adda wait operation by clicking the Insert Wait button.
5. Other OperationsThe following operations are available from the control center.
Pause recording the current script. Till you resume, MarathonITE doesn’t record the operations on the application.
- Insert Module
You can insert a MarathonITE module method. We will discuss more about re-usability in later chapters.
- Insert Checklist
You can insert a checklist into the script. When you execute the script, MarathonITE pauses the script and shows the checklist. You can fill-up the checklist and include screenshots. More about checklists in Semi Automated Tests chapter.
- Raw Recording
By default, MarathonITE records high level operations rather than clicks and key events. By selecting this option, you can let MarathonITE record raw events.
- Script Console
Opens up a console window. You can execute any ruby commands to interact with the application.
6. Complete Recording and Saving Test Scripts
When you complete your operations, you can stop the recording by clicking on the Stop button. MarathonITE displays the main window with the recorded script in the editor.
File -> Save option to save the test script into a file.