Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Do you think it professional QTP code ?
#1
Not Solved
Hello

i am new to QTP and learning code. I try to implement some programming and try to test and it working fine but i don't know how much professional code it is and can i use during job ?

QTP VERSION 10.

APPLICATION : Sample Application Flight which comes with QTP10.

Test Step:

Don't enter value and hit OK
Enter a hit OK
Enter Invalid Password and username and Hit OK
Enter correct password and username and validate next page.
First I need all the recording of contention and get all the pop message and validation message and create variable and get all the validation message in GETROPROPERTY and now using If then endIF condition and try to check validation message with Variable and execute step according to Validation message.
============code ===
Code:
SystemUtil.Run"C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"

Dialog("Login").Activate
Dim ValidTex ,ValidTex1,ValidPass,WronPass
Dialog("Login").WinButton("OK").Click


ValidTex = Dialog("Login").Dialog("Flight Reservations").Static("Please enter agent name").GetROProperty("text")
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click

If ValidTex = "Please enter agent name" Then
Dialog("Login").WinEdit("Agent Name:").Set "a"
Dialog("Login").WinButton("OK").Click

ValidTex1 = Dialog("Login").Dialog("Flight Reservations").Static("Agent name must be at least 4 characters long.").GetROProperty("text")



If ValidTex1 = "Agent name must be at least 4 characters long."  Then

    Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
    Dialog("Login").WinEdit("Agent Name:").Set "admin"
    Dialog("Login").WinButton("OK").Click

  ValidPass = Dialog("Login").Dialog("Flight Reservations").Static("Please enter password").GetROProperty("text")

  msgbox(ValidPass)

If ValidPass = "Please enter password"  Then

Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinEdit("Password:").SetSecure "4fe23773f09965919fa8269a0927d143"
Dialog("Login").WinButton("OK").Click
WronPass = Dialog("Login").Dialog("Flight Reservations").Static("Incorrect password. Please try again").GetROProperty("text")

If WronPass = "Incorrect password. Please try again" Then

Dialog("Login").WinEdit("Password:").SetSecure "4fe2377997ce1b7724cfd7f10c577e2d50a391ab"
Dialog("Login").WinEdit("Password:").Type  micReturn
Window("Flight Reservation").WinButton("Button").Click

End If

End If

End If

End If


IF IT IS NOT PROFESSIONAL CODE THEN HOW YOU WILL WRITE PROFESSIONAL CODE AND TRY TO UNDERSTAND INDUSTRIAL STANDARD.

THANK YOU VERY MUCH TO ALL OF YOU...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Output is different from two different machines for the same block of code in QTP. bdash_10 0 2,082 04-13-2012, 03:38 PM
Last Post: bdash_10
Exclamation QTP - Code to select a link Unleash Rajesh 3 17,140 01-03-2012, 06:57 PM
Last Post: prabhukrishna
  How to recycle application pool on remote machine using QTP code. rajivr81 0 2,266 11-01-2011, 11:34 AM
Last Post: rajivr81
  Secure QTP Code and Error Handling Scenario. knarravu 0 4,194 11-02-2010, 12:40 AM
Last Post: knarravu
  How to write the code for creating excel in QTP vaigundamoorthy 2 15,978 02-28-2010, 08:16 PM
Last Post: vaigundamoorthy

Forum Jump:


Users browsing this thread: 1 Guest(s)