Presentation is loading. Please wait.

Presentation is loading. Please wait.

My First UFT Script.

Similar presentations


Presentation on theme: "My First UFT Script."— Presentation transcript:

1 My First UFT Script

2 Agenda Introduction – UFT & Perfecto Mobile
Get up and running - Download & setup Working with a mobile device Write our first script Get introduced to some basic commands Add a validation at the end of the script Run, view and share report References & Samples In this module we’ll get into UFT, make sure we are setup correctly and start working with mobile devices! We’ll see how the UFT record works and how to write code that works in a device. Finally we’ll review a sample script, get introduced to a few basic commands and then run the sample and view the report.

3 UFT & Perfecto Mobile Devices are visible from within UFT
A new Device Class is created and allows writing tests on devices UFT logic – data tables, parameters etc. remains the same Objects are created in Object repository Perfecto object spy is used instead of UFT spy

4 Download and Setup Download Setup Guide
Setup Guide Confirm that all users have UFT and the add-in installed. Remind users to configure login and reports according to instructions on setup guide

5 Working with a mobile device
The Device Class Device("DUT") DUT is Device Under Test The device is an object All device actions are performed on the Device object. The device object is created automatically when recording an operation on a device. The device appears in the object repository with all of its properties and can be queried like and object e.g. os = Device("DUT").GetROProperty("os") Every mobile recorded object will be located under the DUT hierarchy The device is a physical device with it’s own unique ID, working on another device creates a second device object (DUT_2) [Open a device, start recording, go to google.com using the browser go to command and click on “about” using the button click. Show the objects created in the object repository Note: remember to tick the “execute on add” so commands are performed on the device]

6 Replacing the device id
Changing the Device Replacing the device id in the object repository Setting the device id in the script Device("DUT").SetTOProperty "device_id","T01130HSIN" Recording actions automatically inserts the open device into the device object. This is a specific instance of a device. In many cases, we would like to change the device we are working on, this can be done in several ways. In this module we will show two methods, later on in the course we will show more advanced options to dynamically select the device,.

7 Recording Device Operations
Recording device operations gets translated into the script Just like recording on a browser Objects are created automatically: Open a new device, copy the device ID and paste it into the device id of the device object, run the script and show it working on the new device Open 2 devices, start recording, click on home and show the first device working, then copy the device ID of the second device and set it to the device_id property, run the script and show it working on the second device

8 Sample Script Download script from Open in UFT View report and video
open a device Set the device ID Run the script View report and video Let’s run the “first mobile script” sample -

9 Understanding the test
Open device Home Browser go to Text checkpoint Edit set text X2 Button click Close device Let’s review, in more detail, what the sample test does. In the following slides, we will learn the specific functions that were used. The script opens a device, navigates to a website and then enters a username and password and signs in. The script also include validations to ensure the webpage has loaded and the login actually worked. In the next few slides we’ll learn a bit more about the specific commands used in the sample.

10 Open device and Navigate Home
Navigates device to idle screen Unlocks device Recommended to always use before actual script begins we need to allocated the device to our test by using the Open device function; and navigate to its Home screen. The Home function ensures a successful run of the test by setting the device to its home screen. If it is not on its HOME screen, this will set it there Now the device is ready to take the next function, regardless of which device you use and which screen it was last left at, this will reset it to its ready starting point.

11 Browser GoTo Browser go to Opens a URL Browser parameter options
OS – Chrome/Safari/Explorer Default – According to what is set on the device Perfecto Mobile – Legacy browser [Instructor: the blue man next to the OS method is the Perfecto Mobile best practice] Browser go to is one of the easier commands to use, telling the device to open its device specific browser and navigate to a specified website. **First time only – Perfecto Mobile installs Chrome on the device – this is done for additional security (installed from scratch) First time use – pop up agreements have to be accepted: Do You Accept Google’s T&Cs: Pop-Ups: (Yes / Yes) Afterwards, it works Despite limitation, it’s still the recommended option

12 Text Checkpoint Validates text appears on screen Uses OCR to find text
Timeout defines how long to wait for text to appear Now that we have completed some actions on the device, we should validation that we have successfully reached the Welcome page of the web application. In other words, what if proof is required that the script successfully made it to a specified website page? How can you prove this? A Checkpoint – a Text Checkpoint in this example – can be used. When the test run is complete, a text checkpoint will deliver a screenshot image of the actual value ‘seen’ on the screen at that moment in the script run. It verifies that the device is on that website page, ensuring the success of the test case.

13 Edit Set Sets a value into an input field
Edit Set & Close Device Edit Set Sets a value into an input field Edit Set is a visual command User inputs label details & text to enter Close Device makes device available for next script We’ll meet this command in details when we look at visual analysis. It is useful for working with input fields and entering commands in one line.

14 A word about objects The device commands create UFT objects that can be accessed in the object repository In this sample the following objects were used: MBrowser - MEdit - Mbutton - Open and show the list of objects Go into each of the objects in the slide and show the methods and properties.

15 Every script generates a standard UFT report when run
Reports Every script generates a standard UFT report when run Every report contains screenshots & Video Some commands e.g. checkpoints & edit set generate a screenshot in the report automatically. If additional screenshots for the report are required the screenshot command inserts a screenshot as well. Tip: if there are no screenshots in the report, check UFT is configured correctly according to the setup guide

16 Thank You!


Download ppt "My First UFT Script."

Similar presentations


Ads by Google