Recording in Twist
The following documentation is applicable for Twist 2.2
Twist's Recorder allows testing of applications to be automated using record and playback options. Twist 2.2 allows you to record an entire Scenario with multiple workflows and steps. During the recording process, the recorder creates Twist Project driver (based on the driver that was configured for the project) specific scripts for the actions performed in the Browser or User Interface for each step of workflow.There are multiple ways to record.
- You can record all unimplemented steps in a single recording session using the record button on the editor toolbar.
- You can record a specific unimplemented step by invoking Quick Fix
- You can re-record an already implemented step by invoking Quick Fix
Recording multiple steps in a session
Prerequisites for recording:
- The Twist project should have been created with Sahi driver in the Advanced options. Selenium is also an option because the Selenium driver supports recording too, however for this example, we assume we have chosen Sahi. Selenium requires that Firefox 2.x or above be installed as it is required for recording. Whatever driver you choose, it should support recording.
- Sahi allows recording with either Internet Explorer (IE) or Firefox. We recommend using IE7+ or FireFox 3+
- All the preceding scenario elements (including any contexts, business workflow fixtures, business workflow steps and business rules tables) from where you want to start recording should be implemented and error-free
- As an example, we consider a shopping cart scenario, in which the user searches for a particular book and adds that book to the shopping cart
- Create a Business Workflow - Add Items .
- Create the underlying fixture by invoking Quick Fix or Ctrl+1 on the Workflow.
You don't necessarily have to create the fixture in advance as you can create it during the recording session. However, to keep it simple we will create the fixture in advance.
- Describe the business workflow as a sequence of steps. At this point, all the steps are unimplemented.
- Click the Record button on the scenario editor. This will launch Twist Recorder and open up the browser for recording.
Twist recorder will playback the contexts and halt at the first unimplemented step, in ready state, for you to take action.
- Click on the record button. This will initialize recording for the current step, and any action that you perform on the browser will be getting recorded.
Search for the book on your favorite website and click the Save Recorded Step button. The Twist recorder will save the recorded events for that step in the chosen fixture.
You can also choose to Discard the recording if you want to start recording this step again.
- By default the first fixture of the Business workflow is selected in the combo box. The combo box also lists all the fixtures across the current Twist project. For the subsequent steps in the same workflow, the last used fixture is selected by default. As a user you have an option of choosing another fixture as appropriate.
- If you have an unimplemented step, like search books with text "Arthur Conan Doyle", repeated in the scenario, then on recording of the first step search books with text "Agatha Christie", the repeated step (intent) will also get implemented. However, within the same recording session, Twist will not detect the repeated step as implementation and will halt at the step, ready to record. The Twist Scenario Editor will reflect the step as implemented. You can overwrite the previous recording or just execute the step manually to retain the previous recording.
Twist recorder then proceeds to next step and halts for you to take action again.
If you want to keep this step as manual, click on the Execute Manually button. You can perform required actions on the browser,
Twist recorder will not save the actions performed and leave the step as unimplemented/manual.
- You can thus record multiple steps as explained above. You may also click on the End Session button to exit from the recorder at anytime. All the previous recorded steps will be saved except for the current one.
- While recording, the scenario editor will reflect the steps recorded or left unimplemented.
Record a specific step
Twist recorder will playback the step search books with text "Agatha Christie"
Twist will consider any unimplemented step prior to the requested step as manual and will prompt for the step
find book "Five Little Pigs" to be manually executed.
When Twist Recorder reaches the specific step, add book "Five Little Pigs" to shopping cart , it will initiate recording for the step.
- Click on the Save Recorded Step button when you are done executing all required actions on the browser. Twist recorder will save the scripts for that step and will exit immediately after. The subsequent steps are ignored.