DRY – Don’t Repeat Yourself
Those who develop software have likely heard of the DRY principle which stands for “don’t repeat yourself”. As tempting as it is to copy and paste working solutions, those solutions may not work forever. If/when you ever need to change a solution, you’d have to find all the copies and repeat your updates. That, of course, assumes you can find all the copies!
We have known from the beginning that AutoBloks needed to support reusability, and today that finally becomes a reality with User Activities!
User Activities are defined by you and include calls to built-in activities or even other user activities.
The above example shows a User Activity to login to an application. An Activity Library is used to logically organize your activities in a single file, and the drop-down at the top of the editor allows you to switch between activities. When loaded, the user-defined activities appear side-by-side with the built-in activities. You have full control over the input/output arguments, description, and category.
It’s no coincidence that we use “Login” in the above example as this is one of the most commonly repeated set of activities you may encounter when automating an authenticated application. It just takes 4 activities to open and authenticate to the application but imagine repeating those over and over for every process you create. Even worse, imagine if the login routine changed and you had all those processes to update! If you create a User Activity for these kinds of common application scenarios, your processes will be easier to maintain and easier to read.
User Activities in a Process
The following is a sample Process designed to verify the login functionality of a website. This Process will be data-driven by a Scenario and expects key pieces of information to be passed as Input Parameters. Specifically, it accepts a “UserName”, “Password”, and “ExpectedErrorMessage” which, when populated, indicates that login should fail with the given error.
The sample Process above uses the “Login (No Defaults)” User Activity as well as other User Activities specifically created for this application. The “Is login page displayed” activity was created to easily test if the Login page is present. The “Verify login page displayed” takes advantage of the “Is login page displayed” activity and will use the result to write a Pass or Fail message to the results. Finally, the “Get login error message” user activity was created to read any displayed error message after an unsuccessful login.
One key aspect of this sample Process is that none of the activities shown have to interact with any UI elements of the application. This is important since UI elements change all the time. The “Get login error message” activity is the only place where the UI is defined for which element displays an error message. If the UI ever changes, I only have to update the one activity and all of my processes will continue to work!
Data-Driving a Process with Scenarios
The “VerifyLogin” process above was designed to have data passed to it. This is where Scenarios are used.
The “ValidateUserCredentials” scenario above utilizes the “VerifyLogin” process shown before. Each time it is called, different combinations of data are passed for the credentials and expected error message for invalid logins.
With Scenarios, Processes, and now User Activities, you have more opportunities than ever to stay DRY… don’t repeat yourself!
Also New in 19.4.1
User Activities are the highlight of this release, but it’s not the only new feature.
When a Scenario, Process, or Activity Library is selected, a new File Tools contextual tab will display on the Command Ribbon.
As shown in the above screen shot, the Process and Activity Library tabs will include commands to more easily insert calls to activities. The “Insert Comment” and “Insert Report Message” commands are always available for those frequently used activities. The “Insert” command is a drop-down that will let you pick from a categorized list of all available activities. Finally, all activities pinned as favorites will be displayed in the gallery for one-click access.
Searching for Element Status Improvements
When automating a user interface, a lot of time is can be spent searching for elements. When those elements are missing, the user is often left wondering what is happening in the application. AutoBloks has always had an animated icon in the status bar when it was busy searching, but it was easy to overlook. This release dials up the information in the status bar.
In addition to the icon, you’ll also see “Searching for Element”. If a nickname has been provided, the element will be referred to by nickname as shown in the screenshot above. All search operations have a timeout before giving up, and the remaining time will count down to let you know why it is waiting. If you know the element will never show up, you can click the “Cancel” link to immediately force the search to timeout and continue.
Full Change Log
The following is the complete change log for this release
- NEW: Activity libraries to define your own reusable activities
- NEW: The ability to "Enabled/Disable" a Process or Activity call is now available on the Options tab of the call instructions. Previously was only available in context menu.
- NEW: The "Run" command will now be enabled if you have a Process or Scenario open that is not the selected document if that is the only Process or Scenario open. This reduces the need to select the only available item before the command is enabled.
- NEW: Added new "UI Elements" category on the options dialog that includes an option to determine if the Element Picker defaults to case-sensitive or case-insensitive when generating property conditions to identify an element.
- NEW: “Get mouse location” activity added to determine the x/y coordinate of the mouse
- NEW: Contextual ribbon tabs added for Scenario, Process, and Activity Library. Process and Activity Library feature several convenient buttons for inserting new activity calls from favorites or picking from a list.
- NEW: Activity call list now has an "Insert activity" menu on the context menu so you can easily insert a new activity without having to find it in the Activities tool window.
- NEW: When deleting an activity call with children, a secondary warning prompt will be displayed to confirm that the children will be deleted as well.
- NEW: The "Highlight Element" command has a drop-down menu to allow you to configuration the duration of the highlight. The default has been set at 1 second. New Run option also allows you to control the duration of element highlights during playback.
- NEW: While searching for elements, the status bar will indicate the time remaining before timeout as well as an option to cancel the search.
- CHANGED: The report now uses read-only textbox controls to display message, input arguments, output arguments, and variable values. Long text will be limited to fixed number of lines before scrollbars are used. An added benefit is you can now select and copy text from each field as well as better inspect the contents for white space characters.
- CHANGED: Moved "Set variable" activity to the "Data" category.
- CHANGED: Named formats for working with date/time patterns updated.
- FIXED: Dragging and dropping a loop activity within itself or its children would cause the activities to disappear. That operation is now properly blocked.
- FIXED: The "Highlight Element" command might not identify an element if the multi-match policy was set to a discovery or screen position greater than 1.
- FIXED: The "Highlight Element" command will be disabled while actively executing (unless paused)
- FIXED: Results might display the "These are temporary results" banner in instances where the results are not temporary.
- FIXED: When dragging/dropping multiple activity calls to a child block of a loop that was empty, the first dragged call would appear at the bottom after the drop.
- FIXED: Capturing an element screenshot on certain web pages might produce an "OutOfMemoryException" or incorrect cropping of the element.
- FIXED: Highlighting an image-based element that used a relative file path might not find the image file.
- FIXED: Several improvements to memory usage and optimization