What is the difference between Web Layer (Presentation Tier) vs Application Layer (Logic Tier) vs Database Layer (Data Tier)

What is the difference between Web Layer (Presentation Tier) vs Application Layer (Logic Tier) vs Database Layer (Data Tier)

1. Presentation Layer is the interface to outside world e.g. web site.

2. Application Layer is a framework to create the interface to the Web site or Presentation Tier

3. Database Layer is the database and associated logic needed to query details.

Web Layer (Presentation Tier)

Contains Virtual Machines and Physical Machines with OS can be Windows, UNIX or Linux

Contains Apache web Server, Apache tomcat, Sun Java Web Server or MS Internet Information Services (IIS)

Application Layer (Logic Tier)

Contains Virtual Machines and Physical Machines with OS can be Windows, UNIX or Linux

Contains Apache tomcat, Red Hat JBoss, BEA Web Logic or IBM WebSphere app server

Database Layer (Data Tier)

Contains Virtual Machines and Physical Machines with OS can be Windows, UNIX or Linux

Contains SQL or Oracle

Descriptive programming in UFT

Descriptive programming in UFT

What is Descriptive Programming?

Descriptive programming is a way writing and implementing QTP scripts by avoiding the object repository. Usually Non – Descriptive programming access this object repository, where the required object’s properties and values are stored, and execute the scripts.

While in Descriptive programming, the object properties and values are directly written in the code so no need to access the object repository while script execution time.

For example.

If QTP script needs to close a browser the following descriptive program can be used and it can close any single open browse no matter what is the content or name of the browser.

Browser(“micClass:=Browser”).close

What are the common ways that the Descriptive Programming scripts can be written?

1. Static Descriptive Programming

Here the object properties and values are directly written in the code assuming that we know the expected properties and values.

For example.

If scripts wanted to input user name and password and click ok button to login to an application.

Browser(“micClass:=Browser”).Page(“micClass:=Page”).WebEdit(“type:=text”,”name:=username”).set “– USERNAME”

Browser(“micClass:=Browser”).Page(“micClass:=Page”).WebEdit(“type:=text”,”name:=password”).set “PASSWORD”

Browser(“micClass:=Browser”).Page(“micClass:=Page”).WebButton(“type:=Button”,”name:=Login”).set “LOGIN”

2. Dynamic Descriptive Programming

Here the object properties and values collections are created and used while scrip execution time

‘ this is to declare the object variable

Dim oDesc

‘to create an blank description

Set oDesc = Description.Create

Now assign values to the blank description in “oDesc”

oDesc(“type”).value= “text”

oDesc(“name”).value= “username”

now implement it in code as below

Browser(“micClass:=Browser”).Page(“micClass:=Page”).WebEdit(oDesc).Set “– USERNAME”

Note: Dynamic Descriptive Programming is really helpful when you want to handly an array of objects and child objects.

Selenium grid hub and node configuration

Selenium grid hub and node configuration for parallel test execution

Configuring Hub machine

1) Start the command prompt/DOS prompt

2) Navigate to the folder location where the Selenium server jar file is kept.

3) Type java –jar selenium-server-standalone-[VERSION].jar –role hub

Note: [VERSION] is the one your downloaded version of selenium-server-standalone Jar file.

Your will see the below screen

Selenium Hub
Selenium Hub

4) Now type: http://localhost:4444 in browser

Your will see the below screen

5) Now type: http://localhost:4444/console in browser

You will see the below screen

Console

Configuring Node machines

To create Node machines, either couple of network machines can be used or VM machines can be used. These machines need to be registered to the hub machine (Steps are below)

Follow the same steps 1 to 2 in node machines

Then type,

Java –jar selenium-server-standalone-[VERSION].jar –role node –hub http://yourHUBmachineIP:4444/grid/register

Selenium Node

How to connect Oracle using QTP scripts

How to connect Oracle using QTP scripts.

Dim connectionMS, recordsetMS
Set connectionMS = createobject(“adodb.connection”)
Set recordsetMS =createobject(“adodb.recordset”)
connectionMS.open “Driver={Microsoft ODBC for Oracle};Server=QTPWorld; Uid=your_username;Pwd=your_password;”
recordsetMS.open “select * from yourtablename”,connectionMS
databaseValue = recordsetMS.fields.item(0)
msgbox databaseValue
Set connectionMS = nothing
Set recordsetMS = nothing

How to connect sqlserver using QTP scripts

How to connect sqlserver using QTP scripts?

Dim connectionMS, recordsetMS

Set connectionMS = createobject(“adodb.connection”)
Set recordsetMS =createobject(“adodb.recordset”)

connectionMS.open”Driver={SQL Server};server=YourSqlServer;uid=YourUserName;pwd=YourPassword;database=dbname”
recordsetMS.open “select * from tablename”,connectionMS
databaseValue = recordsetMS.fields.item(0)
msgbox databaseValue
Set connectionMS = nothing
Set recordsetMS = nothing

How to connect MS Access using QTP scripts

How to connect MS Access using QTP scripts and display results

Dim connectionMS, recordsetMS

Set connectionMS = createobject(“adodb.connection”)
Set recordsetMS =createobject(“adodb.recordset”)

connectionMS.provider= “microsoft.jet.oledb.4.0”

connectionMS.open “C:\yourdatabase.mdb”
recordsetMS.open “select * from YourtableName”,connectionMS

databaseValue = recordsetMS.fields.item(0)
msgbox databaseValue

Set connectionMS = nothing
Set recordsetMS = nothing

Headless web browsers

Headless web browsers

headless web browsers or programs are used to stimulate the browsers where there is no GUI is used for browser actions,

If you want to do browser operations or collect data from UI, there programming concepts will be used.

headless web browsers are listed as below,

HtmlUnit – No GUI browser for Java programmers and its pure java implementation, Open source programs. JavaScript support/DOM emulated. mainly used for used for testing purposes or to retrieve information from web sites.

Spynner – Programmatic web browsing module having AJAX support for Python

Ghost – it is a webkit web client written in python. it is WebKit-based. JavaScript supported and Open source.

Watir-webdriver- it an open source Ruby library for automating tests. Complete JAva script Support via Browsers

Twill – Allows users to browse the Web using command-line interface . Supports automated testing on web applications and Open source.

Awesomium –  is Chromium-based. and supports JavaScript and provides HTML-powered interfaces.

ZombieJS – Open source headless testing using Node.js. JavaScript support/emulated DOM.

SimpleBrowser – Open source web browser engine designed for automation tasks. It is built for .Net framework and No JavaScript support.