Presentation is loading. Please wait.

Presentation is loading. Please wait.

Automation Testing- QTP Rajesh Charles Batch No: Date: jan

Similar presentations


Presentation on theme: "Automation Testing- QTP Rajesh Charles Batch No: Date: jan"— Presentation transcript:

1 Automation Testing- QTP Rajesh Charles Batch No: Date: jan-12-2014
Quality Assurance Automation Testing- QTP Rajesh Charles Batch No: Date: jan

2 Agenda (Complete Course)
Introduction Testing Methodologies Manual Testing Practical Workshop Automation Testing Performance Testing SQL for Beginners Quality Center UNIX for Beginners Interview Practice and Mock Interview

3 Agenda (Today’s Class)
What is Automation Difference between Manual testing and Automation Testing What is Codding Language (VB Scripting) Introduction to QTP Practical Workshop

4 Software testing – Automation Testing
Automated software testing is a process in which software tools execute pre-scripted tests on a software application before it is released into production. Pre-scripted

5 Difference between Automation and Manual Testing
Automation Testing 1 Time consuming and tedious: Since test cases are executed by human resources so it is very slow and tedious. Fast Automation runs test cases significantly faster than human resources. 2 Huge investment in human resources: As test cases need to be executed manually so more testers are required in manual testing. Less investment in human resources: Test cases are executed by using automation tool so less tester are required in automation testing 3 Less reliable: Manual testing is less reliable as tests may not be performed with precision each time because of human errors. More reliable: Automation tests perform precisely same operation each time they are run. 4 Non-programmable: No programming can be done to write sophisticated tests which fetch hidden information. Programmable: Testers can program sophisticated tests to bring out hidden information

6 What is Codding Language – VB Script
VBScript, modeled on Visual Basic, is an active scripting language developed by Microsoft VBScript is a light programming language that uses the Component Object Model to access elements of the environment within which it is running. Component Object Model COM or 'Component Object Model' is a method by which an application exposes its functionalities to other applications & programming languages using a set of methods and functions. Lets Execute a VB script VB Scripting:

7 VB Script Integer: Whole numbers are all natural numbers including 0 e.g. 0, 1, 2, 3, 4… Integers include all whole numbers Rational Number: Rational number but not an integer. All rational numbers belong to the real numbers String: Strings, which are widely used in VB programming, are a sequence of characters Decimal: Decimal Format is a concrete subclass of Number Format that formats decimal numbers Variable: In programming, a variable is a value that can change, depending on conditions or on information passed to the program. Eg; a=100 a=300 Where “a” is the variable VB Scripting:

8 What is Codding Language – VB Script
What is VB? Why VB in QTP Variables and Constants Msgbox, Inputbox, vbCRLF Running Scripts Concatenation operator Managing long Strings Run from Step and Run to Step For and While Loops VB Scripting:

9 VB Script - PROCEDURES Procedure is a set of statements that perform a specific task VB script of 2 types of Procedures Function Procedures Sub Procedures Function Procedures A series of statement enclosed within Function and End Function Can perform an action and return a value Can take arguments that are passed to it by a function call Without arguments, Functions must include an empty set of parentheses () Returns a value by assigning a value to its name Function Procedures in VB script of 2 Types User Defined Functions In Built Functions

10

11 VB Script – User Defined Function
Syntax for Function : To write a Function Function functionname (parameters, if any) Your code here …… End Function Lets do an example Syntax for Function : To call a Function Call functionname 1. Use Call only when we don’t want the return value of the function 2. When Call is used the arguments should be put in parentheses OR functionname 1.if the return value is going to be stored in a variable then argument should be parentheses 2.If return value is not stored then argument should not be in parentheses

12 VB Script – User Defined Function
A Function without parameter (no input) A Function with one parameter (input to a fn) A Function to add 2 numbers with parameters and Print the result inside the Function Change the above Function to capture the return value outside the Function and Display Modify the grade program using Function

13 VB Script – Advantages of Function
Code Reusability Easier to debug Easy to Use Recursive call is possible Easy to manage and change Reduces the number of line of code in the program

14 VB Script –Function Exercises
Write a function without any parameter. Put a message box in it which should display your name. Call the function Write a function to multiply 3 numbers. Do not pass the numbers in the function call. Declare and initialize the variables with numbers within the function. Write the msgbox to display the result within the function. Write a function to divide 2 numbers. Pass the numbers in the function call. Write the msgbox to display the result within the function Write a function to subtract 2 numbers. Pass the numbers in the function call. Capture the results of the function returns outside the function. Display the results outside the function Put the above function in a function library. Pass the numbers from the test and get the results back into the test.

15 VB Script – Array Function
Array – To create an array IsArray – Tells whether a variable is an array Lbound – returns lower bound of an array Ubound – returns upper bound of an array Split – Splits or breaks a string into an array base on a delimiter Join – Joins an array into a string using a delimiter

16 VB Script – Exist Property
Exits Property : Check whether the object currently exits in the open application Syntax: object.Exist(Timeout) If a timeout value is specified, QTP waits until it finds the object or until the timeout is reached. If the value 0 is specified, the property returns the True or False value immediately If no value is specified, the value specified in the Test Settings dialog box for the object synchronization timeout is used for test. The default is 20 seconds File  Settings  Run  Object Synchronization Timeout

17 QTP - Synchronization There will be situations where the application does not respond with the same speed of the test. For example For a progress bar to reach 100% For a button to become enabled For a window or pop-window to open These anticipated timing problems may cause the scripts to return inaccurate results. These problems can be handled by synchronizing the test Synchronization makes QTP wait until the application is ready for the next step

18 QTP - Synchronization Wait Statement
Inserting a Synchronization point (WaitProperty): Insert  Synchronization point (enabled only while recording) Can even be written in the Expert View Using Exist property When working with tests, we can increase the default timeout setting (20secs) for a test to instruct QTP to allow more time for objects to appear File  Setting  Run  Object Synchronization Timeout

19 QTP – Data Driven testing
Data-driven testing is a framework where test data, expected result, actual result, status etc is put in and read from outside of the test script Source for Data can be Database, Excel Files, DataTable, Notepad files, XML files etc Reading of the data files and rest of the code and logic is written in the test script Test scripts are built in such a way that they should work for different sets of data without any changes.

20 QTP – Data Driven testing

21 QTP – Data Driven testing – Data Table
A QTP Test consists of Actions By default a test contains one Action (Action1) A new test in QTP by default has one Global sheet and one local sheet (of Action 1) in the DataTable Every new Action added to the test will come with a local sheet of it s own The name of the Action will be the name of its local sheet More sheets to a test can be added programmatically Global, Local and all other sheets can be accessed by any Action (Data in any action can be used in any other actions) By default, one row is enabled in the Global and Local sheets More rows get enabled as data is entered into the respective sheets View  DataTable

22 QTP – Data Driven testing – Data Table
Every test by default runs for all rows enabled in the Global sheet This mean that number of rows enabled in the Global sheet will be the number of times the test runs To run the test for less iterations, settings have to be changed in the Test Settings File  Setting  Run Every action by default runs for one iteration This means that even if we have 3 rows of data in the Action (3 rows enabled) the Action by default will still run only once If we want to run the Action more than once or for all rows enabled in the sheet then setting have to be changed in Action Call Properties.

23 QTP – Data Driven testing – Data Table
A simple login and logout of 3 users each with a different user id and password and check if the login is successful, How does it work if the data is in Action sheet and then in Global Sheet Login  Create 3 orders  logout Login  Create Oder  Logout. Create 3 orders In any application create 3 accounts. Put the data in an excel, import the data into QTP and export the result back to excel

24 QTP – CHECKPOINTS A checkpoint is a verification point that compares the expected value for specified properties with the current or actual value for those properties This enables us to identify whether the application is functiona

25 QTP – Descriptive Programming
A way of creating scripts in QTP without the need for an OR

26 QTP – Descriptive Programming

27 QTP – Descriptive Programming
The same process is followed in the DP approach too.. But the only difference is that there is no OR Because we don’t us OR in the Descriptive Programming approach, we have to provide all the information needed by the QTP to identify an object in the test statement. We will have to follow a particular syntax while creating scripts using DP approach Scripts cannot be recorded if DP has to be used Test in DP approach can be written in 2 ways Using Properties Collection object or Description object Using String Representation

28 QTP – Descriptive Programming
Identify the objects needed for a test step Create a description object (properties collection object ) for all the object needed Then get the properties (mandatory and assistive, if needed and ordinal identifiers if needed identification of these objects from Tools  object Identification Use Object spy to get the values for these properties Then provide all the properties and their values including Object identifier needed for QTP to identify the objects to the Properties Collection Object Use the properties collection object to create the test statement or test step Note: Each description object had 3 properties “Name”, “Value” and “Regular Expression”.

29


Download ppt "Automation Testing- QTP Rajesh Charles Batch No: Date: jan"

Similar presentations


Ads by Google