scriptonce™ & best practices. agenda 2 automation that works scriptonce –minimal maintenance...
Post on 18-Jan-2018
220 Views
Preview:
DESCRIPTION
TRANSCRIPT
ScriptOnce™ & Best Practices
Agenda
2
• Automation that works• ScriptOnce–Minimal maintenance – Easy to add devices
• Robustness– Reliable Scripts - Minimize False Alerts
ScriptOnce
Before Starting Scripting
4
• Let’s Investigate before we start• Don’t write on one device
Objects vs Visual
5
• Object commands are better for ScriptOnce and should form the majority of the interactions– Analyzing text on screen (Edit Get) should be done
with objects as the text received will be 100% correct and not reliant on OCR
• Visual should be used for validation and not operations– Text is preferred to image, it will be identical across
devices and can be data-driven and support multiple languages• When using offsets, always use percentage and not pixels.
– Images are trickier, screen sizes & platforms may break the script so it is less advisable to use• Remember to always use bounded image!
Avoid “Device Specific” Commands
6
• A device specific command is dependent on a particular screen size and works by coordinates and not object/visual recognition– Touch– Drag– Swipe– Gesture
• Why do the commands exist?– Backward compatibility for old scripts – VERY rare cases they are useful
• Use Set commands to insert text instead of type– Type is fragile, does not know where to type
Robust Scripting
Working with Applications
8
• Applications are updated daily– It is easy to work on the wrong version
• How to avoid?– Install & Launch application at beginning
of script– Install from repository or upload via API– Close & Uninstall at end of script so
device is clean
Working with Website
9
• It is best to work with a “Clean Browser”– Browser clean (currently Android only)
should be used at beginning of script (see go to website sample user function)
• Work with OS browsers (Web Inspector iOS only)– Safari for iOS– Chrome for Android– Avoid PM browser (legacy)
• Use PM Browser commands
Object Click, Visual Sync, Object Click
10
• Clicking on the device triggers an event– New page– Popup– Field entered
• After the click, we want to validate that we are where we should be – the sync– Sync is a text checkpoint with default timeout of 60
• The click should be done via an object as it is more robust and ScriptOnce
• The sync should be done with visual– The true way to check as it tests the UX– Careful not to sync an element that existed on the
previous page
Devices Need to Breathe
11
• Different devices have different CPUs• Some actions take back end processing
time• To cover it we need to:– Use the Timeout parameter
• When a page is loading• When a backend transaction is occurring (e.g.
purchase, finding a flight etc.)– Use the wait command
• After Edit Set• When the device needs 2-3 seconds to “calm
down”
Structuring Scripts
12
• Create “Main” Script– Run each module separately– The main script is one for all devices– The modules can use user functions or
execute script• Create Maintenance script– Deal with known issues that may occur in App
• Location popups• Upgrade popups
– Power Cycle & Device Recover– Upon error run the script
So, I Think It Works?!
13
• Let’s do some basic sanity• Orientation– Use same script– Switch device orientation EARLY in flow
to see all ok• Loop 10 times on the most popular
devices to see all is well
14
Next Steps.....Get Certified!Become a Perfecto Mobile Specialist in Automation!
HOW?• Log in to
www.perfectomobileacademy.com and register.
• Click on Self-Paced eLearning and select the Selenium WebDriver course.
• Take the Final Exam for Specialist Certification (SA)Good Luck!
Thank You
top related