Regression testing framework in QTP

By | July 30, 2009

Regression testing framework in QTP

QTP is the best tool for regression testing.

First of all you must know what is regression testing and how it will be helpful to your project, regression testing is nothing but repetition of the test cycle again and again whenever new bug fixing or new functionality is added to project. So thus you can test your product and can find new bug easily in minimum amount of time.

I am going to give you example of regression testing framework and its development procedure which will be very much helpful for you in context to regression testing using qtp.

Regression testing framework development procedure:

1. Embed your one test case to different sub procedure. For e.g

Sub TC_001

–recorded script 1–

End sub

Sub TC_002

–recorded script 2–

End sub

2. Now save all above test case scripts in VBS file.

You can do so by going, File->New->Function Library and then paste all test case script here and save it in VBS format.

3. Now call sub procedure from your main qtp test project file. For e.g.

For i=0 to 100



In above case test cycle will be repeated by 100 times. You can change it according to your needs.

4. Now last but not the least, don’t forget to attach vbs file to your qtp test project.

Go to File->setting and the resource tab, than add vbs file by clicking on “+” sign and click ok.

So this is the simple regression frame work that you can implement for your project.

You can also develop regression frame work in vb script according to your project requirement.

You are always welcome to share your experience on this post regression testing framework in qtp.

If you like this article, You can subscribe through mail.

9 thoughts on “Regression testing framework in QTP

  1. Radhika

    Hi Neelkanth,

    Nice topic you have covered.
    I am beginner with qtp and referring to ur blog for reference.

    Could you please elaborate the procedures you have created with some real example like login script in one procedure, booking flight in another and so on….(with actual script sentences….if possible)


  2. Radhika

    Hi Neelkanth,

    Radhika again…

    I tried with an example…
    Script 1:
    Dialog(“Login”).WinEdit(“Agent Name:”).Set “Radhika”
    Dialog(“Login”).WinEdit(“Agent Name:”).Type micTab
    Dialog(“Login”).WinEdit(“Password:”).SetSecure “4ab2635dabe0ff4c6f9e7cad0def4c9d68221718”
    Window(“Flight Reservation”).Activate

    Script 2:
    Window(“Flight Reservation”).Activate
    Window(“Flight Reservation”).WinObject(“Date of Flight:”).Type “091909”
    Window(“Flight Reservation”).WinComboBox(“Fly From:”).Select “Denver”
    Window(“Flight Reservation”).WinComboBox(“Fly To:”).Select “Frankfurt”
    Window(“Flight Reservation”).WinButton(“FLIGHT”).Click
    Window(“Flight Reservation”).Dialog(“Flights Table”).WinButton(“OK”).Click
    Window(“Flight Reservation”).WinEdit(“Name:”).Set “RD”
    Window(“Flight Reservation”).WinRadioButton(“First”).Set
    Window(“Flight Reservation”).WinButton(“Insert Order”).Click
    Window(“Flight Reservation”).WinMenu(“Menu”).Select “File;New Order”

    And then added this in Function library as
    Sub TC_001
    End Sub

    Sub TC_002
    –Script 2
    End Sub

    Saved this with .vbs

    Then i Went to Action1 and deleted all recoded script and wrote
    For i=0 to 2

    But when RUN it is showing error…Type mismatch…

    Please help

  3. Anonymous

    Hi Neelkanth,

    Recently in an interview i was asked this question. What is regression testing. I told them if a change is done in the application or if a bug is fixed by the developer, we use to do regression testing and ensure that this bug is not having impact on the other modules of the application.

    Interviewer asked, so for example if I have 1000 test cases with me should we run and see all the test cases for this bug fixing?.

    I was not able to answer this question. Please help me.

  4. Neelkanth

    Hi Radhika,

    I suspect that you forget 4th step of this post. You must link your script file to your test and save it.

    Let me know if you still find any issue.

    @ Anonymus person:
    Let me explain in detail, If you can test 1000 test cases in 10 days in first time, than I am sure that if you are going to test it second time you will require 2 to 3 days and in case of third time not more than 1 days, because you know the whole system properly, So in the case of regression testing, if tester face this kind of situation than he/she will not go in detail but atleast he will do top level kind of testing and can make sure that all functionality has been coverd and not affected.

    So,In this way you can give answer I hope that I am able to give satisfied answer..

    If any have any suggestion or more satisfied answer than he/she is always welcome.


  5. Anonymous

    mail your question and get the code for that from
    qtpexperts at hotmail .com

  6. Anonymous

    Nice to read all your posts..

    You have given practical examples in a easy way…

    Thanks Neelkanth….

  7. Anonymous


    I am not able to view application in active screen window after recording i.e. when i click on any step in keyword view or expert view not able to see its corresponding view in active screen.
    i tried all the options available in qtp for viewing..
    kindly help…what must be the problem?


  8. Pingback: All QTP topics | QuicklearnQTP

  9. kamal


    Regression Testing:
    “Interviewer asked, so for example if I have 1000 test cases with me should we run and see all the test cases for this bug fixing?.”

    Answer: you should say to them only those test case are run which are related to Integrated Modules in case of Regression Testing.



Leave a Reply

Your email address will not be published. Required fields are marked *