This article provides tips and tools to help you organize your scripts to make updates easy for the lifetime of your scripts.
If you want a quick proof of concept to confirm that ScenarioBuilder will work with your app, then install on a PC and create your script.
However, if you are looking to do a more advanced POC or have acquired an Automai license and have a live project and are starting to create automation scenarios, this article will help you organize your scripts and make it easier to build and maintain them.
Think before you leap (into scripting)!
Robot Location and Access
First determine how your automation scripts will be used and where your robots will be installed. You want to create the scripts mimicking the robot’s environment, access, and connection parameters.
If you create a script on a PC, but your robot will play it back on a server, then you might encounter some failures. It is recommended to use sessions controller to create the scripts on the machine where the robot is installed.
Make Sense of the Script Before You Dive In
Taking some time to think about your business processes that you need to automate and how they are composed will help you organize your scripts in a way that will circumvent issues when updating and managing them in the long run.
- What are you trying to achieve?
- What business processes are you automating?
- What sections do they have in common?
The following tools in Automai's ScenarioBuilder will make it easy to arrange your scripts:
- Scenario Sections
For actions that you will use often, take advantage of Subscripts. These are independent scripts that you can call into your longer scripts. Examples are Logging in and Logging out. A subscript is created just like any other script. To use a subscript, add the Play Script action and select the subscript in the Script Name property.
To simplify updates with scripts when the application has a redesigned look and feel (changes with color changes or menu style changes), take advantage of Scenario Sections.
A Section Scripts allows you to group common actions together in a script. You can call in portions or sections of this script into another script at any time. Here is an example of how to use Scenario Sections.
Most applications have some form of navigation (menu, tabs, buttons, etc.). Interacting with this navigation is done in every script created for this application. Rather than putting in the steps to navigate the application in each script create a navigation script. The steps to get to each menu item is a separate Scenario Section (created by adding a name in the Scenario Section of the step property). Then in your scripts when you need to navigate to a different menu item instead of adding the step or steps to do that, you instead add the Play Script Section action to your script and point it to the Scenario Section that has those steps.
This setup becomes VERY beneficial should a major change be made in the navigation of the application such as rebranding or changing the color scheme. Imagine if you only had to update the navigation script for the change to be made in all your scripts.
If you have a long script, we recommend dividing it into components. For example, if you had an end to end test for processing purchase orders you could create components for the various sections in the process:
- Search for a Vendor
- Add a Purchase Order
- Receive order
If your end to end purchase order script was 210 steps, it can become very hard to work with. If you add components and move the steps for a section into the component you end up with much fewer steps to manage in a section, but still get the end to end test in one scenario.
To create a component, double-click Define Component. A new tab appears in your script. Add the needed steps or cut them from the parent script and paste them into the component. Then in your main script add an Execute Component action.
You will find these tools make scripting much easier. Don’t worry if you don’t think of all possibilities up front. You can always go back and create subscripts or components if you are in the middle of scripting and notice that these steps will be used more often. Simply copy the actions and paste them into a newly created subscript or component.
If you need any assistance with your scripting strategy, contact Automai support.