The Test Recording is one of the leading Test Studio features, which automatically captures your actions against the application under test. While recording, you can also add various verification steps to ensure the page state. A key benefit to mention are the built-in translators for all Telerik components, which allow you to automate specific actions and verifications for the controls. And all these are part of the recording flow without the need of a single line of code.
The below article will guide you trough the recoding process for web and WPF tests and how to get the most out of it.
- How to Start a Recording Session
- How to Add Steps in the Test
- Example of a Web Test Recording
- Example of a WPF Test Recording
- Stop the Recording Session
- Attach the Recorder to a Running Application
- What is the Compact Recorder
When a web or WPF test is opened and active in the Test Studio project, the toolbar ribbon is switched to the Test tab. It provides useful options to control the recording and execution process of a test in Test Studio.
Among all available buttons you can see the Record one at the first position. You can start a recording session with a single click on this button.
The recording session can be started with a keyboard shortcut Ctrl+R, or by using the Project Explorer context menu option Record.
The Test Studio Compact Recording Toolbar detects any actions performed against the application under test - click on any element, enter text, trigger a dialog and handle it, navigate to a page, open a pop-up window and perform actions in it, etc.
Apart from all direct interaction, which can be sent towards the tested application, you can add different type of steps from the Quick Highlighting Menu, or build more complex steps in the Advanced Recording Tools.
And, finally, when it comes to steps, which are not related to a specific application or element from it, you can also add Common Steps from the Step Builder pane - like adding a coded step, or a test as step, comment, or refreshing the browser, if...else statement, etc.
When starting a recording session in the context of a web test you need to enter the URL of the page to automate and choose a browser to load the application in. The Recording dialog, which appears allows you to define these parameters.
If you plan to use a specific browser for the automation project, you can select that browser and enable the checkbox to 'Save my choice for the future' - this will set the browser as a preferred for this project and you will no longer be prompted to select a browser for recording.
To launch the selected browser and navigate to the listed URL, click the Record button in the Recoding dialog. This will start a new instance of the browser and will launch the Test Studio extension, if applicable, Then the target page will be loaded and the Compact Recording Toolbar will appear on top of the browser.
The Test Studio UI remains in the background of the browser, but once the page is loaded and the Compact Recorder is attached, you can switch back to the project and check that a Navigate step is recorded using the same URL as defined when starting the recording session.
Once a recording session is started, do not start another instance of the same browser until the session is finished!
The WPF application is a desktop app and thus the automation process slightly differs when it comes to recording a test in Test Studio - you need to define which is the application to test and where is its executable file - this is called configuration of the WPF test.
When you open a WPF test in the automation project, you can see that instead of the browser and web application control options in the toolbar ribbon, there is a Configure button, which gets you to the WPF Test Config dialog.
When the application details are configured, you can start recording the automation scenario against the WPF application. To start a recording session, use the Record button. This launches the executable file listed in the configuration process and attaches the Compact Recording Toolbar on top of the app.
The recording session for WPF test can also be started with a keyboard shortcut Ctrl+R, or by using the Project Explorer context menu option Record.
The Test Studio UI remains in the background of the application, but once you initiate any action against the application, this gets recorded in the test.
The mechanism to terminate an active recording session is to completely close the automated browser or WPF application - this is how all processes and communication channels between the app and Test Studio gets dismissed.
In some occasions it is very useful to attach a recorder to the application, when it is in certain state, and then continue the recording process. The specifics of the recording process allow to attach a recorder and trigger a recording session to an already running application.
To trigger a recording session against an already started application, you need to use the dropdown under the Record button - in the list you can see all compatible processes, to which Test Studio recorder can be attached. Select one and wait for the __Compact Recorder to attach to the application.
Web Test - Internet Explorer only
WPF Test - connect to running WPF application instance