How to install selenium webdriver?


Steps to Create a Selenium Project in Eclipse

Step 1: Download Eclipse
http://www.eclipse.org/downloads/

Step 2: Launch Eclipse

[Note:] If you get a prompt to select a workspace,provide a path to store your projects in a folder

Step 3:Go to File>New>Project>Java Project>(click on next)

Step 4: Provide Project Name eg. Automationlab>(click on finish)

Step 5: Now you’ll see the folder “AutomationLab” listed on the editor.Double click the folder>Select ‘src’ subfolder

Step 6: Right click on ‘src’ folder>New>Class

Step 7:Type in a Name for your Java Class file,cick on the check box for “public static void main (String args[])>Finish

you are ready to go,if you see the below lines of code

public class lab {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

    }

}

Hold on…we are almost there!

Step 8: Go back to parent folder ‘AutomationLab’>Right click>go to Properties

Step 9: Go to Java Build Path>Click on Add External JARs,browse all the files from the JAR that you’ve downloaded (i.e selenium),Link is provided for selenium download in article “What is selenium“.

Good Luck!

Advertisements

What is Selenium?


Introduction:-

Selenium is a software testing framework or software testing tool for web based applications.
It provides the flexibility to write the test in different programming languages such as Java,C#,Perl,Python,ruby etc.
It can run the same test script in different web browsers such as IE,FF,Chrome etc on windows,Linux and Macintosh platforms.

Developed by Jason Huggins at Thoughtworks.It is an open source software (License:-Apache License 2.0 ).
Selenium is  written Java.It also provides an IDE (firefox plugin) that can record & play the test and the same test can be exported in above mentioned programming languages.

Selenium 2 aka Web driver is widely used these days.To sum up “Selenium automates browsers”.

Download selenium
Download Selenium:
Cheers!

Add attachment in QC


Script to upload attachment in QC test lab:
Dim oCurrentTest,oAttachment
Set oCurrentTest = QCUtil.CurrentTest.Attachments
Set oAttachment = oCurrentTest.AddItem(Null)
oAttachment.FileName = “C:\Results.xls”
oAttachment.Type = 1
oAttachment.Post
oAttachment.Refresh
Set oAttachment =Nothing
Set oCurrentTest =Nothing

What is Business Process Testing?


BPT, well, I’ve heard this term 2yrs back. Since then I kept wandering about it’s implementation and wondering about it’s development, until one fine day my offshore manager asked me to learn & implement BPT for a pilot run .

I straight jumped into the QTP help file repository and browse some links related to BPT.The first sentence i had stumbled upon was “Subject matter experts creates an automation test”, re-read the sentence twice, thrice and more and closed the help file as the very first sentence  seemed to be  weird . Having been working with Keyword and Data driven framework , I felt  it’s not worth to concentrate more on this topic.

I kept on wondering about the issues I faced in script development and thought about the SME (one from my department )  creating an automated test and thought about my collegues just adding objects to OR and watching SME creating the test.

I went outside bhabhi ki tapri (Our Hangout Place) , had tea and puffed,suddenly one thought striked my mind:-

We believe that if men have the talent to invent new machines that put men out of work, they have the talent to put those men back to work-Kennedy”

and my exploration and journey begun…..All I can say now is BPT is a wonderful concept and an amazing cost saving component oriented approach of automation.

 What is Business Process Testing?

BPT stands for Business Process Testing.It’s a component oriented approach to automation. It provides a script-free mechanism for business analysts to design and align tests with business processes for accurate functionality coverage, while allowing automation test engineers to focus on the automation stuffs.

HP Business Processing Testing Framework Key benefits:-

* Implement a framework for building reusable, data-driven test components

* Convert manual tests into manual components for instantly reusable test assets

* Support manual and scriptless automated components

* Use auto-documentation to make it easy for new testers to pick up test execution

* Create and update tests for SAP and Oracle using extended capabilities

In short, it closes a gap between the business people who design the business processes and the technical people who designs and develop the automation stuffs.It would be easier to maintain the components rather than the test.Eg, If a piece of functionality changed in an application, each of the test doesn’t have to be debugged/corrected, only the component associated with that test needs to be checked.( Maintainablity)

i.e Fix one,reflects everywhere!

Who does what?

AE (Automation engineer):

  • Design Test Automation Architecture
  • Create Application Area (Area in QTP/QC where .Qfl, .Qrs and .Tsr files are created and saved)
  • Create a function library (Common functions)
  • Create OR, add objects , rename it accordingly.
  • Create Recovery Scenario and finally
  • Create business component as assigned.( egLogin, Logoff etc)

SME/BA:

  • Define business component
  • Drag components to create business process (Business process is a sequential flow of the components/scenarios to be testes)
  • Asks AE to create custom components if needed for complex or logical scenario.
  • Run the test.

More to come..keep watching this space….. 🙂

How to run QTP when system is locked?


How to run QTP when system is locked?

Go to start>Run>Regedit>

Change the following registry settings:-

Step 1:Goto HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest
Step 2:Locate the key “SkipEnvironmentChecks”
step 3:Change the value to “1” (Default value is 0)
Step 4:Restart the QTP.

Now QTP should run with system locked.(make sure unnecessary pop ups are disabled)

Run QTP when system is locked

Run QTP when system is locked

Dynamically wait an object in an application


“Dynamically wait an object in an application”

It known to all that scripts written for web application suffers a lot
when it comes to Wait() or Syc().Wait() statement waits for 10 sec which is
not recommended and wait(1),wait(2)..wait(n) cannot add any value if script has
to cope with multiple rows of data.Lets take an example.

No or rows(in data sheet) to process =300
Function retrievetransno()
Wait(2)
End function
If above function is called in each iteration, image how much execution
time is wasted.

2*300=600 sec
600/60=10 min

10 mins execution time is wasted if we are going to use wait statement.
If wait() is used then it’s more pathetic:
10*300=3000 sec
3000/60=50 min

Following function could be used to overcome the above issue.It dynamically
waits and check the status of the object within the given time limit and
exits out if the object is not present within that time limit.
1*300=300 sec
300/60=5 mins

Lets start with:

'===================================================================================================
'Function:ObjectChecker
'Purpose: Lets you dynamically wait the presence of an object in an application
'Arguments: vObj,iCounter
'@vObj:Test object
'@iCounter:Maximum no of seconds (to wait)
'Author: Bibek Khatiwara
'Created on: 15th june 2011
'===================================================================================================
Function ObjectChecker (vObj,iCounter)

vObjStatus = False
Flag = 0
Do
Flag = Flag+1
If vObj.Exist(1) Then
Reporter.ReportEvent micDone ,"Wait time calc","Seacrh text box displayed in "&Flag&" second(s)"
vObjStatus = True
Else
If Flag = iCounter Then
Exit Do
End If
End If
Loop Until vObjStatus = True
ObjectChecker = vObjStatus

End Function

'Usage(sample):
Set oTxtbox=Browser("name:=google.*").Page("title:=google.*").WebEdit("name:=q")
ObjectChecker oTxtbox ,10
Set oTxtbox=Nothing

Keyword driven framework architecture in QTP


Framework:A hypothetical description of a complex entity or process-Word Web.

Here, word hypothetical makes it clear that it’s based primarily on surmise rather than adequate evidence.There are no rules and standards on test framework development.It varies from organization to organization and from team to team.Project internal architecture provides a great source of information for organizing the components of our framework.Testing components needs to be well organized to accomplish the task effectively,efficiently and in a systematic order.

We need to develop framework in a way that leads to accomplish the task without much human intervention.The heart of “Keyword driven test automation framework” is common functions that resides within the function library and the keyword acts as  it’s brain.Framework must be enough flexible to run with the desired keyword from the pool of available keywords.

well,It’s been my passion to play with electronic chips since my childhood.I can even survive in desert if i get electronic scarps and a screwdriver 😉 Hence,I decided to develop a flexible framework looking at the architecture of RADIO that have been rusted on my bedroom for years.

The component used & it’s analogy with RADIO:

QTP has it’s own limitation for loading resources;as it does not allow to load .QRS file in run time,here,it goes off the track from radio tuning mechanism.Once radio is turned on we tune to different stations and adjust it’s volume and rotate/pull up-down it’s antenna to have a clarity.

Here we do just opposite, we first do the appropriate setting and proceed with further run.

How keyword driven framework works:

1.Plug in to environment.

2.Do a little bit settings on test_environment setting file;eg,paths of resources,email configuration,project url,expected time etc.

3.Search & Select appropriate generic keywords from keyword pool.

4.Go

Radio analogy:

1.Plug in to switch board.

2.Search for station

3.Set the volume and adjust the antenna

4.Turn on.

(normally 4 comes before step 2)

1.. 2 …3… Go……..! that’s it.

Details of the Component Architecture are as follows: [Note:the architecture is based on my own assumption(analogy with RADIO),if you find it uncomfortable,kindly scold me 🙂 with your invaluable suggestions]

Keyword driven framework architecture in qtp

1.Start.Exe: Starts the tool using AOM and pass the control to Driver.

2.Application Scenarios: Test plan,test case and test steps.

3.Test Object Description: Pool of test object properties and description.

4.Resources: Repository files for application dependent functions.

5:Mytest: Driver script resides.

6: Session manager: manages the session of the test run & helps in recovery if run is unsuccessful due to some unforeseen events.

7.Test Environment_Config settings: Test run settings. (application specific)

8.Func Library: Common functions and application dependent functions separately.

9:Recovery Files: .QRS or custom recovery functions.

10:Run Results: Application run results.

11:Help files: help files and framework documentations.

Following are my tweets so far (on framework development):

Automation framework rule #1:If it’s not simple, it won’t work! if it’s simple it’s fun to use.

Automation Framework rule #2:Achieving 100% automatic tests is an unreachable goal,never dream it.

Automation framework rule# 3:Make it easier to discover the errors that occur.

Automation Framework Rule #4:Focus on stability;the more stable the design, the lower the maintenance cost.

You must have realized as of now  that framework is just a wrapper around complex internal architecture to have

a great drive with less interruption.Let turn on your radio coz you need not to know how it’s playing.Stakeholders

should play with our flexible framework  just as we tune/play our radio.

Friend,Join us on twitter for more discussions.