Script Recorder Module
- 4 minutes to read
The eXpressApp Framework includes its own functional testing engine - EasyTest. EasyTest is specifically designed to simplify functional testing of XAF WinForms or ASP.NET applications. The Script Recorder Module supplies you with a script recorder, which can record the actions you perform on a UI, and save them to an EasyTest script file. When using the script recorder, recording is performed via a set of Actions available in the Tools menu. Compared to manually writing test scripts, the script recorder allows you to create test scripts in a much more intuitive way. This topic details the basics of using the script recorder.
The Script Recorder Module is represented by two module projects:
You can add this module to the Windows Forms application project. To do this, invoke the Application Designer and drag the ScriptRecorderWindowsFormsModule from the Toolbox to the Modules panel. Do not forget to rebuild your solution after making changes in a Designer.
You can add this module to your ASP.NET application project. To do this, invoke the Application Designer and drag the ScriptRecorderAspNetModule from the Toolbox to the Modules panel. Do not forget to rebuild your solution after making changes in a Designer.
You can add a module in the Solution Wizard when creating a new XAF solution by selecting a module in the Choose Extra Modules step.
- To add an extra module in code, add it to the XafApplication.Modules or ModuleBase.RequiredModuleTypes list (adding a reference to the module assembly is insufficient).
By default, the script recorder is enabled when a debugger is attached to the application's process. This behavior can be overridden by setting the DevExpress.ExpressApp.ScriptRecorder.ScriptRecorderControllerBase class' nullable Boolean static ScriptRecorderEnabled property. To enable the script recorder, set this property to true. To permanently disable the script recorder, set this property to false. You can do this, for instance, in the application's Global.asax.cs (Global.asax.vb) or Program.cs (Program.vb) file.
The script recorder is represented by three Actions assigned to the Tools Action Container.
- Pause/Resume Recording - Pauses or resumes script recording.
- Show Script - Invokes the script editing dialog. You can manually correct a script being recorded via this Action.
- Save Script - Saves the currently recorded script to a script file.
If the script recorder is enabled, it is activated from the application start in a recording mode. So the recorded script logs the actions you perform, including logging on to the application.
Please remember that the script recorder does not provide ready-to-use scripts. In most cases, you are required to manually tune the script; refer to the list below.
- You should manually add commands that test the displayed data (CheckTable, CheckFieldValues, CheckValidationResult, etc.)
- The Script Recorder produces a script specific to the platform it was launched on (Windows Forms or ASP.NET). There may be a difference in data formatting and in controls captions. Some steps of the script can be platform-specific (e.g., switching a Detail View to an edit mode). To create a platform-agnostic script, manual editing is required (e.g., the use of IfDef/EndIf directives and platform-agnostic commands). Refer to the EasyTest Script Reference topic for details.
- The Script Recorder is not aware of EasyTest configuration settings, so it cannot "guess" the valid application name that is to be passed to the Application command. You should change the name manually, and possibly add a second Application command to create a script for two platforms (Windows Forms and ASP.NET).
- Manually add DropDB and RestoreDB commands when required.
The Script Recorder module is demonstrated in the Feature Center Demo, installed with XAF. Refer to the Feature Center demo online to see this module in action.