Introducing 

Prezi AI.

Your new presentation assistant.

Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.

Loading…
Transcript

AUTOMATION TESTING

Khaled Monir

Automation Test Engineer

AGENDA

01.

Course Description

02.

AGENDA

Products and Technologies

03.

Target Audience

04.

Course Work Flow

05.

Automation Testing

Course Description

  • This Course is Designed for Automation tester who have basic coding skills, This course Focuses on Creating, Executing and maintaining automation test.

  • This Course includes hands-on lab and real testing project.

Product and Technologies

  • Java
  • Eclipse IDE
  • Selenium Web Driver
  • TestNG
  • Maven
  • HP UFT
  • VB Script

Target Audience

  • QA Engineers interested in Selenium web driver web portal/Desktop UFT
  • Tester who want to automate tools
  • Manual testers who looking for start career in Automation
  • Test Managers

Work Flow UFT

  • Introduction to Automation Testing
  • Introduction To HP UFT
  • Environment Setup
  • Knowledge in UFT Core
  • Implement The OPP Design Pattern
  • Data Driven Test
  • Behavior data Driven
  • Behavior Keyword Data Driven
  • Behavior Hybrid Framework

Work Flow Selenium

  • Introduction to Automation Testing
  • Introduction To selenium
  • Environment Setup
  • Knowledge in Selenium Core
  • Implement The OPP Design Pattern
  • Data Driven Test
  • Behavior data Driven
  • Introduction to selenium Grid

Introduction to test Automation

Introduction to test Automation

Test Automation Pyramid

Automation testing Pyramid

  • Manual testing is consuming time and cost
  • Automation testing is increasing speed of execution
  • Helps to increase test coverages
  • Automation testing not required Human interaction

Why Automation Testing

Why Automation testing?

Which Test Cases to be automated

Which test cases to be automated ?

  • Test cases is very Critical to the business.
  • Test cases is consuming time in the execution.
  • Test cases is difficult to be run manually
  • Test cases that got repeated at least once.

Test Automation Process

Automation testing Frameworks

Automation Tools Comparison

HP-UFT

HP UFT

Introduction

Introduction

  • Unified Functional Testing was initially given by Mercury Interactive and Mercury Interactive was consequently developed by Hewlett Packard (HP) in 2006. Its first name was Astra Quick Test, later on called as Quick Test Professional and the latest version is known as Unified Functional Tester(UFT).
  • QTP/UFT, given by Hewlett Packard (HP). QTP is a software application used for Automation Testing process to test the software applications, more useful for“Functional” and “Regression” testing.
  • runs only in a windows environment and uses “VB Script”scripting language is one that gets interpreted at run time.

Advantages of QTP/UFT

  • It supports record and playback.
  • It uses an active screen to record scripts and helps tester in referring the screen object properties.
  • It has excellent object identification process or mechanism.
  • It supports different add-ins like Oracle, Java, SAP, NET, Web Forms, People soft, etc..
  • It allows you to enhance the existing tests even without the AUT through an active screen.
  • It supports popular automation frameworks- keyword driven testing approach, modular testing approach, data-driven testing approach, etc..
  • It can be integrated with Test management tools like Quality Center, Test Director, and Winrunner.
  • Different types of suites like Smoke, Regression, Sanity can be easily maintained.
  • It supports XML.
  • Test reporting is possible through QTP for analysis purpose.
  • Easy to maintain.

User InterFace

Add-in Manager

  • The first time you start Micro Focus UFT, the Add-in Manager dialog box opens.

  • It Displays a list of all installed add-in. You can select the add-in you want to load for the test and click "OK". You can later add or remove an Add-in after QTP has launched. For now, stick to default and move ahead

Start Page

  • The Start Page describes the new features in the current release-including links to more information about these features. It also provides links to Process Guidance, a tool that offers best practices for working with QTP. You can open a document from the list of Recently Used Files, or you can click the buttons in the Welcome! an area to open new or existing documents.

  • How to use QTP IDE

  • Following are important components of the IDE

1. Menu bar

2. Properties window

3. Document tab

4. Solution Explorer

5. Toolbox tab

6. Output tab

7. Active Screen

8. Data tab

Start Page

  • The Solution Explorer is a hierarchical tree of all actions and tests in the current test, with their references, events, and flows.

Solution Explorer

  • The "Action" tab gives details of test code.

HP UFT Features

Example:

Here are the Test Steps for this Scenario

Test Step 1) Open Flight Reservation Application

Test Step 2) Enter Valid Agent Name

Test Step 3) Enter Valid Password

Test Step 4) Press Ok

Test Step 5) Close Application After Successful Login.

Record and Play

Parametrization

UFT provides us to pick different test inputs at a run time. This process of providing different input values through external parameters is called as parametrization.

Types of parameterization in QTP:

1. Data Table parameters

2. Test/Action parameters

3. Environment variable parameters

4. Random number parameters

Data Driver

Check points

Definition: is Checking if the Actual Results is equal to the Expected Result

Types:

1. Text Check point

2. Text Area check point

3. Standard Check point

4. Bitmap Check point

Output Check points

5. Standard Output check point

6. Text Output check point

Object Identification

QTP stores Object and its properties in the Object Repository to identify them during run-time.

An Object could have a large number of properties associated with it. For example, in Web Environment, a Button could have the following properties associated.

Object Repository

* Introduction to Object Repository:

- Object Repository is a collection of Test Objects and information that is recognized by UFT for working on it. When a user records a test, the objects and their properties are captured by default.

>Rename Objects

>Add Objects/Update(without Recording)

Types:

1. Local Repo

2. Shared Repo

- Object SPY

Environment Variables

Types:

1. Built In Variables

2. User Defined

Syntax:

.set environment("AgentName")

.set environment("variableName")

Functions

Benefits of Using Functions:

1. Reusable

2. Save time and effort

Selenium

Selenium/UFT

Web Driver

Introduction

Introduction

  • Selenium is an automation test tool or framework for web bases applications.
  • Selenium(Pure HTML, No back-end Required.
  • Selenium operations are highly flexible, allowing many options for locating UI elements and comparing expected results against actual behaviors.

Selenium Features

Selenium Features

  • Open Source Tool
  • Support Cross browser and multiple browsers
  • allow scripting in many programming land
  • provide easy assertion statements
  • Built in report feature

Selenium Family

Selenium Family

How Selenium Web Driver Works

WHAT'S

NEXT

Environment Setup

Verify System Type

  • Install JDK
  • Install Eclipse IDE
  • Maven Installation

Environment Setup

1st

2nd

6th

3rd

4th

5th

Kick-Off

  • Install Browsers
  • Install TestNG

Live Demo

Live Demo

Introduction to JAVA

JAVA-OOP

Packages

Packages

  • A Package is a collection of related Classes

Live Demo

Classes,Object and methods

CLASSES, OBJECT AND METHODS

Object:

  • An object is anything that can be seen or perceived.
  • Objects can be performed by action methods.
  • Both objects and methods is under the umbrella or the class.

Method:

  • A method executes a job for the object.
  • Good Tec. Verb&Noun(Get Order/addnumbers)

Objects and methods are located inside a class

Class:

  • A class is a blueprint for creating an object.
  • Is a template that define structure of object.

Example:

Dog has state(Name, Color)

Behavior(jump-Run)

English Course Demo

Access Modifiers

Access Modifiers

Four Types:

1. Public

2. Protected

3. No Modifiers

4. Private

Variables and data types

VARIABLES AND DATA TYPES

VARIABLE:

  • MEMORY LOCATION THAT HOLD VALUE
  • NAME,TYPE,VALUE
  • ITS UNIQUE

DATA TYPES:

  • BOOLEAN,BYTE,DOUBLE,INT,LONG,SHORT

VARIABLES AND DATA TYPES

Variables:

Declaration

Initialization

  • Java Allows to declare any variable any where in the program

VARIABLES AND DATA TYPES

  • Local Variable
  • Parameter Variable
  • Instance Variable
  • Class Variable

Local Variable

Parameter Variable

Class Variable

Strings

Working with Strings

Declare the string:

String Name="khaled";

Define the String Length:

String Name="khaled";

Int len=Name.length();

system.printline("The name length is: "+ len)

Con-Catenation: using +

Inheritance

Inheritance

  • Inheritance is a way to inherit the state and behavior from other classes

  • The term inheritance refer to the adoption of all non private properties and methods of one class(super-class) by another class(subclass)

Overriding

If A class inherits a methods from its super class, then there is a chance to override the method provided that it is not marked final.

Advantage of overriding is ability to define behavior that's specific to the subclass type.

Polymorphism

Polymorphism

  • Polymorphism means one method with multiple implementation.

  • Polymorphism is one of the OOPs feature that allow us to perform a single action in different way.

OVERLOADING DEMO

MAVEN AND TESTNG

MAVEN&TESTNG

WHAT IS MAVEN?

Maven is a very powerful and widely used java project management and build management tool.

Features:

1. Its provide support for test life cycle in automation projects.

2. Allow settings up the execution of the environment.

3. Manage all related dependencies using the POM.XML

4. The ability to download the project dependencies automatically from the central DB.

Why to use Maven in selenium

  • Since Maven is a build Automation tool so it can manage selenium web driver test project build compilation and documentation.
  • it eases up the task of creating the right project structure, adding and managing jar in the project build path
  • The most important feature of maven is managing the project dependencies using the POM XML

Example: you are using selenium version 2.53 which we later updated to a newer version.

Now imagine the you want to update more than one jar files, so there is a probability to delete file by mistake or forget to update any kind of them.

SO the Rescue Point in MAVEN in POM XML

Writing Selenium test using MAVEN

TESTNG

TESTNG

Agenda

  • TESTNG Introduction
  • TESTNG Features
  • why do we need testng in selenium
  • Annotations
  • Parameters
  • Cross browsimng usimg TESTNG XML FILEc

Introduction

  • TestNG is a testing framework developed in the lines of junit and NUNIT.
  • It can mainly used to execute the unit testing but lately it used to automate the test cases.
  • TestNG Provides Annotations to make my script more flexible in the test execution.

TESTNG Features

  • Support for parameters
  • Support dependent methods testing
  • Test Configuration become more flexible.
  • Generate Automatic Report.
  • Can generate the report in readable format

TESTNG Annotations

TestNG Provides Annotations:

TestNG Benefits

1. They Are easier to understand

2. You can group the test cases using appropriate annotations

3. you can do parallel testing .

4. you can pass extra parameters to annotations

Live Demo

TESTNG Parameters

  • TESTNG Parameters is the responsible for the executing order

PRIORITIZATION:

The parameter used here @Test(priotty=1)

DISABLING TEST CASES:

The parameter used here @test(priorty=1, enabled=true/false)

METHOD DEPENDENCY:

The parameter used here @test(dependsOnMethods={""})

TestNG Grouping

  • The Parameter used here @Test(groups={"Rgressiontests"}

  • IT can be executed from the XML file

<groups>

<run>

<include name=" ">

TestNG Assertions

  • Assertion is very Important in the test automation, Without the assertion you will not know what test case pass/fail.

  • Assertion is a comparison parameter between the Actual Result / Expected Result

Syntax:

Assert.assertEquals(actual,Expected)

Selenium Gears

Selenium GEARS

Find Elements

Find Element

Use Browser Tools for inspecting Element on Page, and begin to take Actions on these elements.

https://the-internet.herokuapp.com/login

Browser Navigation

Selenium WebDriver API provides access to the (back/forward/refresh/reload).

Taking Action on Elements

  • TextBox--->Sendkeys("");----Clear();

  • Button--->Click();

  • Submit();

Drop Down Menus and Lists

Selenium is using special class called SELECT CLASS

In the HTML Called <Select>

  • Check Multiple
  • Check number of options contains
  • select by Value/visible text

Implicit waits

If Selenium didn't find the web element that he is search for, selenium will wait for a specific time to find it...if not it will throw exception!!!

http://cookbook.seleniumacademy.com/AjaxDemo.html

driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

Explicit wait

If Selenium didn't find the web element that he is search for, selenium will wait for a specific time to find it...but this time if the condition=true/false

WebDriverWait wait= new WebDriverWait(driver, 20);

Design Patterns

Record and Play

Spaghetti Pattern

Data Driven

POM-Page Object Model

Dry Testing Pattern

Design

Pattern

Learn more about creating dynamic, engaging presentations with Prezi