Friday, November 23, 2007

QTP Output Values

This is a very small tutorial on output values, just to make you familiar with the process so that you can start on your own. For complete understanding of Output values please see QTP User Guide.

    1. Open a new test and also open a sample Flight application (Flight Reservation window)

    2.Make sure that both (new test and Flight Reservation window) are open and visible.

    3. Click on Record in order to record a test.

    4. Go to Insert (Menu)->Output Value->Standard Output Value.

    5. QTP will be minimized and mouse pointer will take the shape of a hand. Click on 'Insert Order' button in 'Flight Reservation window.'

    6. "Object Selection - Output Value Properties" window opens with WinButton :
    Insert Order
    highlighted. Click Ok.

    7. "Output Value Properties" window opens with 'Insert Order' in the Name text field.

    8. Click on first checkbox (which is Property enabled and Value False).

    9. In the 'Configure Value' area click on Modify button.

    10. 'Output Options' window opens. In this window just click Ok. (It creates Insert_Order_enabled_Out column in Global datasheet in Data Table with a Value False in the first row)

    11. It will bring you back to "Output Value Properties" window. Now earlier where under Value it was showing False (see step 8) now it will show Insert_Order_enabled_Out.

    12. Again Click Ok to come out of this "Output Value Properties" window.

    13. Click Stop in order to stop the test.

    14. Now it means whatever the value of Insert Order button's Enable Property will be, QTP will show that value in Data Table (under Insert_Order_enabled_Out column) at Run time.



Just make that Insert Order button enable by putting some values in Flight Reservation window and then see that column (Insert_Order_enabled_Out ) in Data table. It will show a true value in there at run time. It will also show that captured value in the Results window.

These above steps show you how to use output values with Data Table. Below tutorial shows how to use output values with Environment variables.

    1. Open a new test and also open a sample Flight application (Flight Reservation window)


    2. Make sure that both (new test and Flight Reservation window) are open and visible.

    3. Click on Record in order to record a test.

    4. Go to Insert (Menu)->Output Value->Standard Output Value.

    5. QTP will be minimized and mouse pointer will take the shape of a hand. Click on 'Insert Order' button in Flight Reservation window.

    6. "Object Selection - Output Value Properties" window opens with WinButton : Insert Order highlighted. Click Ok.

    7. "Output Value Properties" window opens with 'Insert Order' in the Name text field.

    8. Click on first checkbox (which is Property enabled and Value False).

    9. In the Configure Value area click on Modify button.

    10. Output Options window opens.

    11. In 'Output Options' window, from 'Output Types' dropdown, select Environment, and
    click Ok.

    12. Now Insert_Order_enabled_out will be User-Defined internal environment variable.

    13. Click Ok to come out of this "Output Value Properties" window. (You can check that environment variable by going to File->Settings, Environment Tab and choosing User-Defined from variable type)

    14. Just add the below line in the Expert View at the end to see the value of the environment variable.

    msgbox(environment("Insert_Order_enabled_out"))

    15. Now you can Run the test.

    Just make that Insert Order button enable by putting some values in Flight Reservation window and then see that environment variable value (Insert_Order_enabled_Out ). It will show a true value in there at run time. It will also show that captured value in the Results window.