Forum for Learning and Sharing Software Testing Knowledge

In my previous post, I had informed about Job Search Engine useful for searching latest Job openings for QA and QTP.

In this post, I will tell about our Forum which can be used for learning Software Testing and QTP quickly and easily.

You can join any Discussion related Software Testing and Test Automation here.

If you have any questions, you can ask them in our Forum. I will answer for your questions.

And, if you are having good experience in Software Testing and QTP automation, you can answer for the relevant questions there. Apart from answering questions, you can share links useful for learning Software Testing and QTP Automation.

Knowledge Sharing is the Learning, Learning is the Knowledge Sharing

How to write Test Cases?

In Manual Testing, Testers will test the Application  by executing the Test cases manually  without requiring  any automation tools.  Manual testing will take significant time to cover all the requirements. So, it is very important to write test cases effectively to cover all the requirements while keeping number of test cases at  minimum level.  Let us  see how to write test cases  for testing an application.

What is  Test Case ?

Test case is “Documentation specifying inputs, predicted results, and a set of execution conditions for a test item.” The  purpose of Test Case  is to divide the software function into small units of function that is testable with input, and producing result that is measurable.

i-e  A test case is a feature/function description that should be executed with a range of input, given certain preconditions, and the outcome measured against expected result.

These are the  fields commonly present in the Test Cases :

  • Test case id
  • Test Case Description
  • Procedure / Test Steps
  • Test data
  • Expected result
  • Actual result
  • Status ( Pass/ Fail)
  • Comments

Test cases should be simple and easy to understand for Developers.

Test Case ID :

This ID should be Unique throughout the Testing Application and not to change at any moment.

Test Case Description:

Explain the function under test. Clearly state exactly what attribute is under test and under what condition.

Prerequisites– Every test needs to follow a sequence of actions, which lead to the function under test. It could be a certain page that a user needs to be on, or certain data that should be in the system . For example  registration step should be completed before start testing login.

Procedure/Steps:

Sequence of steps to execute the specific function.

Test data:

Specify the data used for a particular test or if it is a lot of data, mention the path of a file where this data is stored.

Expected Result:

Clearly specify the expected outcome in terms of the page/ screen that should appear after the test, changes that should happen to other pages, and if possible, changes that should happen to the database..

Actual Result :

State the actual result of the function execution. Especially in case the test case fails, the information under ‘actual result’ will be very useful to the developer to analyse the cause of the defect.

Comments:

In this section you can add your reviews, suggestions and ideas to developers for the bug how we fix that.  Especially this section made to communicate with developers.

Test case writing procedure

  • Get as much information about the application as possible through available documentation (requirement specs, use cases, user guides) , tutorials, or by exercising the software itself (when available)
  • Determine a list of features and different user roles.

 

Say for example, if you are writing Test Cases for testing  this Timesheet Application.

First you should understand the features available in this timesheet application by reading the help files and other available documents about this timesheet application.

You should know about different user roles (e.g user, admin) involved in this application.

Once you gather all the details about this application, you can start writing test cases. Find below one sample, and you can show/test your test case writing skills by adding more test cases thro’ the comments section.

  • Test case id – LG01 (LG refer as Log In)
  • Test Case Description -Check Case sensitivity in  Log In Functionality
  • Procedure
  1. Load login screen by visiting http://qualitypointtech.net/timesheetdemo/index.php
  2. Enter valid username and password in Upper case.
  3. Click “Login button”
  • Test data – Username as user || Password as USER
  • Expected result – Alert box like CAPS LOCK on to warn the user
  • Actual result – But its not visible and accessing with uppercase letters.
  • Status ( Pass/ Fail) – Fail
  • Comments –  Password is an user’s choice so we can’t restrict so we have to give the warn or alert box or format that password should be like this.
Like wise, for each and every action we have to write test cases.

At the time crunch of any project, the testers simply go with the Adhoc Testing and Exploratory testing.

 

Manual Testing

Manual testing is the process of manually testing software for the errors and bugs in it. It needs a tester to play the role of an end user. At the time of manual testing tester need only test case and with the information how to execute those test case. Manual testing is crucial for testing software applications more thoroughly.

In today’s technical world, most of the software engineering projects rely on manual testing only as it involves a demanding and accurate testing procedure.

Manual testing involves high-level test plan where we choose a methodology, and resources such as skilled people, computers, and software licenses are identified and acquired. Detailed test cases are written by the tester clearly and perfectly, with the expected Results.

The test cases were given to the testers should follow all the steps and record the results. At the end, the detailed test report is prepared to determine whether the software can be released or not. If not mean they asked to developers to fix the bug which impact the other main modules.

Advantages of Manual Testing :

  •  Easy to learn for new people who are entered into testing field.
  •  Running the test case is less cost than automation.
  •  Allows the tester to perform more Ad-hoc testing .Using this more bugs are found than automation.
  • Its very difficult to go for automation testing for Mobile applications
  •  Manual testing cost is low but in automation it is expensive

Disadvantages of Manual Testing :

  •  Regression Test cases are time consuming if it is manual testing.
  •  Requires heavy investment of human resources.
  •  For every build release you must re run the same set of tests which can be annoying.

Start with an Test Cases Writing:

What is a Test Case ?

Test Case is an Writing Statement which contains test data, outputs, expected and actual result of the application which is tested accord to the Client’s Requirements.

These are the fields present in the Test Cases :

Test case id
Test Case Description
Procedure
Test data
Priority
Expected result
Actual result
Status ( Pass/ Fail)
Comments

While writing test cases that all your test cases should be simple and easy to understand for Developers. Don’t give your explanations like essays.

Software Test Automation tool evaluation

In this chapter I will explain about evaluating Automation test tool and selecting appropriate tool suitable for our requirements.
Before start evaluating tool we should analyze whether automating software testing will really give any benefit over manual testing for your needs.
Actually, Software Test Automation is a good way to cut down time and cost.
But, it will reduce the cost and time only when it is really necessary or it is used effectively.

Test Automation is not required if you are going to use your application one time only or for short period only. For example, assume that you are having a website developed in ASP, and you are making some changes in this website. And, assume you are having solid plan for converting/migrating this ASP site into either ASP.NET or PHP in near future.

In this situation, it is not advisable to automate the testing of the new changes done in the ASP site.
In this case, simply you can complete the testing manually and then you can start your automation testing preparation once after the migration is done.

So, basically we need to automate our testing procedure when we have lot of regression work.Once after taking decision to do the test automation, the next step is selecting appropriate automation tool.

There are hundreds of tools available for automating the software testing and some of them are Free.
Test complete, SilkTest, SilkPerformer, QARun, QALoad, TestPartner, WinRunner, LoadRunner, QTP, Rational Robot,Selenium,WATIR and openSTA are some of them.

Some of these Tools (e.g Selenium) are open-sourced.We need to select appropriate tool based on below factors.

Budget allocated for the Testing process – Price for each automation tool will vary. Some of them are costly, and some of them are even free.License pattern will be varying for each tool. License cost of some tools will vary according to geography location also. And, some tool vendors will fix different price for seat license and floating license.

So, first we need to decide about our licensing needs. i-e Ask below questions,
– In case the tool price changes according to geographic location, whether it will be cost effective for your location.
– How many Automation Test engineers will simultaneously work in your automation project?
– Whether you need separate set up for developing the scripts and for executing the scripts?
– Whether you are having plan to automate your any other testing activities? Whether the selected tool can be used for other projects also?

Support available for the Automation Tool. We need to evaluate whether the Tool provider will provide enough support and bug fix releases. And, we need to think about the support provided by the Forum community also.

Analyze whether the execution speed of the automation tool matches with your requirements.

Check the installation requirements (both Software and Hardware) for installing the automation tool in your test script development environment.

List down current skill set of your testers and check whether the tool can be effectively used by your testers. For example QTP will support vbscript, if your testers know vbscript they can easily learn using QTP.

Feasibility study is very important before finalizing the Tool. Most of Tools will provide evaluation or Trail offer. For example QTP can be downloaded from HP site and we can use it for 14 days. During this trial period try to automate different portions of your application to make sure that the Tool can be used for automating your Testing needs.

Analyze the Market Share and financial Stability of the vendor of the tool. It will get significance if you are going to use the Automation tool for long term regression testing purpose.

Check whether the Tool can be easily integrated with bug tracking tools. For example, QTP will be closely integrated with Quality Center (Test Director) which is a Test Management Tool.

The best approach is, we can prepare a list with all these factors and add remarks for each tool. And, we can select the tool by analyzing this list.

QTP Questions and Answers

Find the answers at the end of the questions.

1) Quick Test Professional (QTP) is used as,
a) Functional Testing tool b) Performance Testing tool c) Usability Testing tool d) Bug tracking tool


2) The below vbscript code is used for,

Set qtApp = CreateObject(“QuickTest.Application”)
qtApp.Launch
qtApp.Visible = True

a) For launching Function Generator b) For opening QTP using Automation Object Model c) For creating Object Repository from Coding d) For making ActiveScreen visible


3) Extension of vbscript  function library file is,
a) .vbs b) .mtr c) .lib d) .qtp


4) Which one of the below is External add-in in QTP?

a) ActiveX add-in b) Visual Basic add-in c) Java add-in d) Web add-in


5) Which is used to add report statements in QTP report file?
a) showreport b) reporter.writeline c) reporter.reportEvent d) printReport


6) In QTP, properties of Test Objects are stored in
a) ObjectSpy b) Active Screen c) Object Repository d) Library


7) Which is used for storing Data used by Test Iterations in QTP?
a) Local sheet b) Global Sheet c) Action Sheet d) Object Repository


8) Which view will allow us to edit the vbscript code in QTP?
a) Keyword view b) Expert View c) code view d) view source


9) The Test Management Tool which can be easily integrated with QTP is,
a) Test Track b) Bugzilla c) Object Repository d) Quality Center


10) Which is used for storing Data used by Action Iteration in QTP?
a) Local sheet b) Global Sheet c) Object Repository d) External Action


11) Outcome of the below QTP code (vbscript) is,

Set obj = CreateObject("WScript.Shell")

sCmnd = "%windir%\SYSTEM32\rundll32.exe user32.dll,LockWorkStation"
obj.Run sCmnd, 0, False

a) Runtime error b) Computer will be locked automatically. c) Computer will be unlocked d) will throw syntax error


12) Which is used for verifying whether the Actual result matches with expected result in QTP?
a) ObjectSpy b) Object respository c) Checkpoints d) Expert view


13) Which is built-in add-in QTP?
a) TE add-in b) java add-in c) web add-in d) .net add-in


14) Setting in one instance of QTP IDE can be transferred to another machine using,
a) Data driver b) Function Generator c) Step Generator d) Automation Object Model


Answers


(1) a  (2) b  (3) a  (4) c  (5) c  (6) c  (7) b  (8) b  (9) d  (10) a  (11) b  (12) c  (13) c  (14) d

Wish list for the QTP future release.

We can not say that QTP is a complete Tool even when it has crossed lot of releases.  This is due to the fact that Test automation tools are complex to develop.

So, members of a Testing group had a discussion about things that need to be done in coming releases of QTP. I have mentioned below requirement in this discussion.

Allow QTP Script execution while minimizing it so that we need not have separate machine for test script execution.

Find below the requirements collected from others during this discussion. Most of the people want to have the ability for opening multiple tests at a time.

  • Provide better support for Ajax
  • Provide better support for remote test execution from Quality Center
  • A way to inherit test/action resources.
  • Better browser support. Support for non-IE browsers such as Chrome and Safari
  • Need easy license management
  • A better coding/IDE environment with better intellisense, code folding, better debugging (ability to see object contents)..
  • Better version control. Being able to check out previous versions of a test.
  • Shared code libraries in QC. i-e ability to save in a common library share that all projects could use.
  • Use an object orientated scripting language instead of or in addition to VB script
  • Embed the object spy in the browser similar to firebug for firefox
  • Ability to replace object repository with other repositories such as MySql Database
  • Reduce the cost. Selenium is evolving and is eating up market share because its free
  • Scripts should be able to run on a locked computer.
  • Add ability to right click on web browser object to spy on it
  • Ability to open more than 1 script at a time
  • User should be able to attach encoded functional library (I.e. .vbe extension file).
  • Ability to “pause” a run in order to edit a script during execution of multiple iterations
  • Support for FLASH/FLEX Applications.
  • Expose runtime engine as an API so we can start using languages other than VBScript.
  • Simple and cleaner uninstall process
  • Improved support for distributed parallel scalable execution (cloud/VM) with reporting concatenation.
  • Enhanced function libraries especially database operations
  • More descriptive error messages rather than “Generic Error” message.
  • User should be allowed to Export selected portions of Reports
  • Ability to see the partial report when the script execution continues

QTP methods and script for reading object properties

In the previous Chapter, I had written about Object Spy.

For using Object Spy, we need to point the Object Spy pointer on the Object.
i-e We can read the properties manually only. And it can be done in the design time only.
In this post, I am going to write about reading the properties of any Object in the application using scripting (i-e programmatically in run-time)

QTP is having below methods.

GetTOProperty– This method returns the value of the property from the test object’s description, i.e., the value used by QTP to identify the object. In other words the list of properties stored the Object Repository. If the property is not part of the test object’s description, a warning will be issued by QTP.

GetTOProperties – This method is similar to GetTOProperty, but it will list all/collection of properties and their values.

It can be used as below to get all the Test Object properties and their values in “Submit” button of “Login” window in a vb application.

Set theTestObject = VbWindow(“Login”).VbButton(“Submit”)

Set Props = theTestObject.GetTOProperties

PropsCount = Props.Count

For i = 0 To PropsCount – 1

PropName = Props(i).Name

PropValue = Props(i).Value

MsgBox PropName & ” = ” & PropValue

Next

Set theTestObject = VbWindow(“Login”).VbButton(“Submit”)
Set Props = theTestObject.GetTOProperties
PropsCount = Props.Count
For i = 0 To PropsCount – 1
PropName = Props(i).Name
PropValue = Props(i).Value
MsgBox PropName & ” = ” & PropValue
Next

GetROProperty – It will be used to get the value of an object property during runtime, such as the current list/combo item selection, page title, or the text in a WebEdit, or the size (width & height) of an object.

SetTOProperty changes the value of a test object property. Changing the property won’t make any change in the Object Repository, but it will just affect the way QTP identifies the object during runtime. Actually, this changes the properties of the temporary copy of the object stored in RAM by QTP.

i-e QTP is having the methods GetTOProperty,GetTOProperties and SetTOProperty for handing Test Objects.

And, it is having SetTOProperty method for handing Run-time object.
Obviously it can not have method SetROproperty, because QTP script should not change the actual objects (But still we can do it using “Object”. I will write a separate post about it later)

But it can have a method something like getROproperties. As of now, QTP is not having such a method.

So, we can read all RO properties from windows registry.
For example, below piece of code can read the name of properties for “Page” object from the registry.

Const HKEY_LOCAL_MACHINE = &H80000002

Set oReg = GetObject(“winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv”)

SKeyPath = “SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\Test Objects\page\Properties”

oReg.EnumValues HKEY_LOCAL_MACHINE, sKeyPath, arrNames

sNames = “List of Properties:” & vbNewLine

For i = 0 to UBound(arrNames)

sNames = sNames & arrNames(i) & vbNewLine

Next

Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg = GetObject(“winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv”)
sKeyPath = “SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\Test Objects\page\Properties”
oReg.EnumValues HKEY_LOCAL_MACHINE, sKeyPath, arrNames
sNames = “List of Properties:” & vbNewLine
For i = 0 to UBound(arrNames)
sNames = sNames & arrNames(i) & vbNewLine
Next

After reading the properties, the script can read each property name from the array “arrNames” and get the run-time object value using GetROproperty method.You can refer below piece of code.

Set TestPage = Browser(“Google”).Page(“qualitypoint”)

For i = 0 to UBound(arrNames)

sNamesRO = sNamesRO & arrNames(i) & “: ” & TestPage.GetROProperty(arrNames(i)) & vbNewLine

Next

MsgBox sNamesRO

Object Spy in QTP

QTP is having a Tool called as “Object Spy” for viewing the properties and methods of any object in an open application.

We can use the Object Spy pointer (a button with hand symbol) to point to an object in the application.

 

 

Object Spy Dialog window is having Two Tabs. One is “Properties Tab” and another is “Methods Tab“.

Each tab is having radio button to choose one of two options “Run-Time Object” and “Test Object”.

The Object Spy displays the selected object’s hierarchy tree and its properties and values in the Properties tab of the Object Spy Dialog box.

The Object Spy enables you to view both the run-time object methods and the test object methods associated with an object in the Methods tab of the Object Spy dialog box.

And, we can to view the syntax for a selected method.

We can bring the “Object Spy” by clicking the Tools->Object Spy… menu or by clicking a toolbar button (an icon showing a person with hat). This icon can be accessed from Object Repository window also.

To see the properties of an object, first click on the button showing hand symbol in the Object spy Dialog.

The mouse pointer now changes in to a hand symbol and we have to point out the object to spy the details about the object.

If the required object is not visible, or window is minimized then hold the Ctrl Key and activate the required window to bring the required window to the front.

Then release the Ctrl button to make the cursor again hands symbol so that you can point the required object.

You can watch the below Video explaining Object Spy.

Managing Object Repositories in QTP

QTP is having separate window named as “Object Repository Manager” for managing various object repositories.

You can open this window from the Menu “Resources->Object Repository Manager…

The Object Repository Manager enables you to manage all of the shared object repositories used in your organization from a single, central location.
It will be used for adding and defining objects, modifying objects and their descriptions, parameterizing repositories to make them more generic, maintaining and organizing repositories, merging repositories, and importing and exporting repositories in XML format.

The Object Repository Manager window will look like below one.

 

You can create new shared repository from this window and can store it as .tsr file.

While adding objects, you will be provided with two options. Either you can choose to add only the selected Object or you can choose to add the selected object and its descendants.

You can store the object repositories  either in file system or in Quality Center project.

The Object Repository(OR) Manager enables you to open multiple shared object repositories and modify them as needed.

This Object Repository Manager provides the options such as  “Add objects”, “Highlight in Application”,  and “Locate in Repository”  for the Shared object repository. It is similar to the local object repository. I will be explaining them in separate post.

By default this OR Manager will be in readonly mode. i-e you can not edit anything in this mode.

We need to choose File>Enable Editing for making it editable.

Update from Local Repository option in the OR Manager (Tools > Update from Local Repository) can be used for merging objects from the local object repository of one or more actions to a shared object repository.

And, it provides Object Repository Merge Tool for merging two shared object repositories.

At the end of the merge process, the Object Repository Merge Tool provides a graphic presentation of the original objects in both repositories, which remain unchanged, as well as the objects in the merged target object repository.

Objects that had conflicts are highlighted. The conflict of each object that you select in the target object repository is described in detail. The Object Repository Merge Tool provides specific options that enable you to keep the suggested resolution for each conflict, or modify each conflict resolution individually, according to your requirements.

And note that while the Object Repository Merge Tool is open, you cannot work with the Object Repository Manager.

Apart from this OR Manager, QTP is having “Associate Repositories” option for  enabling you to associate one or more shared object repositories with one or more actions in a test.

 

Descriptive Programming in QTP

Instead of using Object Repository for storing properties of Test objects, we can straight-away define the properties while writing the script itself.

It can be done in two ways.

One is, by giving the description in form of the string arguments.

For example a text box having html code as <input type=”text” name=”txtUser”> can be accessed as below.

Browser(“Browser”).Page(“Page”).WebEdit(“Name:=txtUser”,”html tag:=INPUT”).set “QualityPoint”.

The other way is using Decription.create as below.

Set objDesc = Description.Create

objDesc(“html tag”).value= “INPUT”

objDesc(“name”).value= “txtUser”

Browser(“Browser”).Page(“Page”).WebEdit(objDesc).set “QualityPoint”.

This Descriptive approach is having some short-comings.

The main disadvantage of Descriptive programming is Maintenance issue.
Since Object repository will be stored in centralized place, property definition for any Object can be easily changed at any time if the application developer changes the property of the actual object/control.

But, in descriptive programming (DP) it is difficult to change the object property as each QTP developer will be defining object property in many places using DP.

For example, assume that you and team member are developing automation test scripts for testing gmail application.
Gmail login script will be used in many test scenarios.

Assume that you are automating some scenarios and your team member is automating some other scenarios.
In case of Object Repository, you and your team member will be forced to use same object description for login page controls/Objects (e.g username, password, login button).

So in future if Google changes any property (e.g change the button name from “login” to “get into gmail”), all the scenarios can be easily updated just by updating this change in Object repository.

But in case of DP, there is a possibility of defining the login button in multiple places. One definition by you and another by your team. (Anyway proper Team Coordination will avoid this issue, but practically it is very difficult to achieve this coordination.).

So, comparatively updating DP style coding is bit difficult if the application properties got changed.

Anyway, Descriptive programming is having its own advantages as mentioned below.

1. We can start work on writing QTP scripts even before the application under Test is NOT available. It will help to increase the utilization of the Automation scripts as it will be immediately available once the application gets released.

2. We can define the properties of an object without considering the parent objects in the hierarchy. i-e Object identification will not depend on its parent object.