UI Automation/ Synthetic Monitoring Using AWS Canaries

Manoj Masakorala
4 min readMar 17, 2021

--

Do you want to set up a UI automation workflow without the hassle of setting up different frameworks and environments? I got a chance to try out CloudWatch canaries recently for a project I was working on. With AWS CloudWatch canaries you can easily write UI automation scripts which manage synthetic monitoring aspects of your application. Please note I only talk about UI automation but canaries support API automation, web crowling etc. Following article expalins how you do it.

  1. Go to Canaries in CloudWatch and create a new Canary. We will be using a blueprint and GUI workflow builder for this.
1. select GUI workflow builder

2. Set the canary name which will be unique identifier. Also the initial URL of the web-ui under application endpoint.

Workflow builder includes action you can perform. There you can select actions you want to do and script will be automatically generated if not you can write the script on your own as well when your familiar with the syntaxes. So here you can add many actions as you like and Canary will evaluate whether those actions can be fulfilled. If not the flow will break and we would be notifies about the failure. Actions are as follows,

You can perform click events

·Verify whether selectors are there, basically you can check whether and element is there in the Web UI.

· Verify text will check whether a text exist in a target element.

· Input text allows you to type something in the target element.

· Click with navigation will perform a click event and wait till a navigation happen.

Take screenshots option will be helpful when debugging issues and when identifying failures in the workflows. It would show us which elements in the DOM has loaded so far and status in the UI.

3. You can customize the script as you want. You can add custom methods and do tweaks with JavaScript to match into your need. Afterall its JavaScript. So, you can do advanced selects etc. Following includes a script with few steps which veryfy a hotel booking system.

Also, you can select runtime engine as well. It could be either node.js or python. We have selected the latest nodeJS engine in the time being. Further more environment variable are mere key values pares in which you can pass environment specific settings to your code.

4. Then you have to schedule the UI Automation. This is how often your scripts should run. You can config to run manually or you can run continuously. In continuous execution you can have intervals from 1 min to 60 minutes. So, if you set 60mins the script would execute in every one-hour time. Also, you can set the timeout period for the entire canary. And it can’t be longer that the frequency.

5. Data retention defines how long you want to retain your canary outputs. You have to specify how long you want to keep failure data as well as success data. Also, you have to specify a S3 bucket as the destination to store your outcome data. You need to specify access permission as well since you need to provide to canary to access into s3 bucket or publish matrics to cloudWatch. So here you have to define an IAM role with those permissions granted.

5. Finally, you have the option to trigger cloud watch alarms in a threshold break or in an event of a failure. So, with CloudWatch alarms you can configure a SNS topic to alert users with emails, SMS etc. So, user will be notified in a failure.

You can enable actie tracing with AWS X-ray for debuging purposes.
Summary dashbord
Sucess and Failur events
All actions which occured (Passed/failed test cases)
Screenshots will help to debug failur points
Log will also help in debuging

At last but not least when talking about the pricing, with AWS free tire you get 100 canary runs per month. Paid tire pricing is as follows for US-East region,

So let me know in the comment section what you think of AWS Canaries. Is it really worth the price. Would it solve hassels you face in UI-Automation with diffrent frameworks.

Thanks

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response