1 / 36

Req0009

Req0009. Implementation of Req0009. Topics covered. Implementing Req0009 Manually adding an environment variable. Creating a regular “successful login” process. Usage of global dictionary. Adding tests to MTM. Using the action return value. Requirement - Req0009.

Télécharger la présentation

Req0009

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Req0009 Implementation of Req0009 Dani Vainstein & Monika Arora Gautam

  2. Topics covered • Implementing Req0009 • Manually adding an environment variable. • Creating a regular “successful login” process. • Usage of global dictionary. • Adding tests to MTM. • Using the action return value. Dani Vainstein & Monika Arora Gautam

  3. Requirement - Req0009 Dani Vainstein & Monika Arora Gautam

  4. Req0009 – Scenario Details • Step 1 – Type a valid “Agent Name”, should be more than 3 characters long. • Step 2 – Type an invalid password • Leave it blank ( Zero Length ) • Less than 4 characters. • Incorrect password. • Step 3 – Press OK and close the dialog. • Return To Step 2. • Step 4 – again in the 4th attempt enter invalid password. • A) Popup dialog is displayed. • B) Popup title : Flight Reservations • C) Message type : Exclamation • D) Message text “Login unsuccessful. Please try again later.” • Step 5 – Press “OK” and close the dialog. • Application close itself. Dani Vainstein & Monika Arora Gautam

  5. Displayed And Popup Req0009 – Overview Details Title = Flight Reservations Icon = Exclamation text = Agent name must be at least 4 characters long. Dani Vainstein & Monika Arora Gautam

  6. InvokeApp Function Passed Start Set Agent Name Set Password Press OK Failed Login Exist? Report micPass Report micFail End Press OK Req0009 – Process Design x4 4th iteration No Yes Dani Vainstein & Monika Arora Gautam

  7. Implementing Business Req0008 • Open the test busLogin, action busLoginMng • Menu : File  Open  Test Dani Vainstein & Monika Arora Gautam

  8. Creating a new step • Add a new step case “req0009” ( remember to write the string in lower case ) req0009 Dani Vainstein & Monika Arora Gautam

  9. Implementing Business Req0009 • We want to set an “Agent Name”, a “Password” and press OK. • We’ll ignore the error message until the last iteration (as we’re testing the final message) • For this requirement we are not going to implementing a process that checks if an error message exists, in this case we are ignoring error messages that relate to invalid password and continuing by pressing the “OK” button on error message popup/s. • Similarly we will not check the icon type, message and the title for popup messages that relate to invalid password. GDictionary.Add "OK", vbNullString : GDictionary.Add"AGENT_NAME", "advancedQTP" GDictionary.Add"IGNORE_ERROR", "OK" Dani Vainstein & Monika Arora Gautam

  10. Implementing Business Req0009 • We have a “Login” process in guiLogin, which we will modify. • We will add a new keyword flag “IGNORE_ERROR”. • If this keyword exists, it will check if an error message pops up and it will press a button. • Which button? GDictionary( “IGNORE_ERROR” ) button can be “OK” or “Cancel”. GDictionary.Add "OK", vbNullString : GDictionary.Add "AGENT_NAME", "advancedQTP" GDictionary.Add "IGNORE_ERROR", "OK" Dani Vainstein & Monika Arora Gautam

  11. Implementing Business Req0009 • We are going to use a loop that iterates 4 times exactly. • The For…Next loop is an excellent choice for this task. • We are going to use the same String function, as we did in Req0005. • But, we want to generate all types of errors • Empty Password. • Incomplete Password ( less than 4 characters long ) • Incorrect Password. • We will take advantage of the For…Next loop and String function. • String( 0, “P” ) will return an Empty String. • The loop will iterate from 0 ( zero ) to 3 ( 4 times ) Dani Vainstein & Monika Arora Gautam

  12. Implementing Business Req0009 • In the first loop String function will generate an empty string  ( 2 * 0, “P” ) • In the second loop String function will generate an incomplete password  ( 2 * 1, “P” ) • The third and fourth loops will generate an incorrect password. • Now, we are ready to call the “Login” process For i = 0 To 3 GDictionary( "PASSWORD" ) = String( 2 * i, "P" ) RunAction "guiLogin [guiLogin]", oneIteration, "Login" Next Dani Vainstein & Monika Arora Gautam

  13. Implementing Business Req0009 • We need to wait till last iteration ( i=3 ) • The Last iteration will check the displayed error message(“Login unsuccessful. Please try again later” ) • At last, we will check that the “Login” dialog is closed. as we did in Req0008. If i = 3 Then RunAction "CheckDialog [guiLogin]", oneIteration, "MSG0006" bExist = RunAction( "guiLogin [guiLogin]", oneIteration, "DialogExists" ) IfNot bExist Then Reporter.ReportEvent micPass, "Req0009", "Dialog not exists." Else Reporter.ReportEvent micFail, "Req0009", "Dialog exists." EndIf EndIf Dani Vainstein & Monika Arora Gautam

  14. Business Req0009 – Final Look Dani Vainstein & Monika Arora Gautam

  15. Modifying guiLogin - “Login” Process • The location of amended code inside case “login” is very important. It must follow the business flow. • The code must be implemented after pressing OK, not before. • Don’t forget to declare a variable buttonName ( Dim Statement ) If GDictionary.Exists( "IGNORE_ERROR" ) Then If Dialog("Login").Dialog( "text:=Flight Reservations","nativeclass:=#32770" ).Exist( 1 ) Then buttonName = GDictionary( "IGNORE_ERROR" ) Dialog("Login").Dialog( "text:=Flight Reservations","nativeclass:=#32770" ).WinButton( "text:=" & buttonName ).Click EndIf End If Dani Vainstein & Monika Arora Gautam

  16. Updating Data Source • And … don’t forget to add the new messages to the data source. Dani Vainstein & Monika Arora Gautam

  17. Create Tests Req0009 • Create Test Req0009 as explained in previous presentations. • This is a copy of action look at req0004 for complete information how to do it if you have forgotten. (08 Req0004_v1.pps) Dani Vainstein & Monika Arora Gautam

  18. Adding Tests to the MTM • Excel file must be close every time you run a script or/and a .mtm or .mtb batch file Dani Vainstein & Monika Arora Gautam

  19. Finalizing busLogin • We have one more task, just before “closing” the busLoginMng reusable action, in busLogin we need to implement the following features: • A regular successful Login process. • Going forward, we may want the “Agent Name” to be flexible and configurable, since password will always remain same for this application. • The next few slides will implement all these features. Dani Vainstein & Monika Arora Gautam

  20. Automation FR LIB RA BL GL RS DOC DAT SETTING TESTS RES BATCH ENV Adding the “Agent Name” to environment file • Open the FR.xml file for editing in notepad, or another XML editor. FR.xml Dani Vainstein & Monika Arora Gautam

  21. Inserting a New Variable and Value • Add the Variable AGENT_NAME with a value that includes at least 4 characters. • Save the file. Dani Vainstein & Monika Arora Gautam

  22. Regular “Login” business Action • For a successful business login action is required an agent name, a valid password, click OK and verifies that the “Main” window is displayed. • During the run-time if any error occurred then there is no point to continue testing any further. Case "login" GDictionary.Add"AGENT_NAME", Environment( "AGENT_NAME" ) GDictionary.Add"PASSWORD", "Mercury" : GDictionary.Add "OK", vbNullString GDictionary.Add "MAIN", vbNullString RunAction "guiLogin [guiLogin]", oneIteration, "Login" If Reporter.RunStatus = micFail Then ExitTest( micFail ) Dani Vainstein & Monika Arora Gautam

  23. busLogin – Final Look Dani Vainstein & Monika Arora Gautam

  24. busLogin – Final Look Dani Vainstein & Monika Arora Gautam

  25. busLogin – Final Look Dani Vainstein & Monika Arora Gautam

  26. busLogin[busLoginMng] – Final Look Dani Vainstein & Monika Arora Gautam

  27. guiLogin – Final Look Dani Vainstein & Monika Arora Gautam

  28. guiLogin – Final Look Dani Vainstein & Monika Arora Gautam

  29. guiLogin – Final Look Dani Vainstein & Monika Arora Gautam

  30. FR.vbs – Final Look Dani Vainstein & Monika Arora Gautam

  31. FR.vbs – Final Look Dani Vainstein & Monika Arora Gautam

  32. FR.vbs – Final Look Dani Vainstein & Monika Arora Gautam

  33. Summary • We learned how to use the Global Dictionary as a set of instructions and data usage for the GUI layer • We learned how to use already implemented functionality for new tests. Dani Vainstein & Monika Arora Gautam

  34. What’s Next? • Debugging Your Scripts. • Watch Expressions. • Debug Viewer. • Watch Variables. • Run-time Commands. • Debug Toolbar. • Debug Options. • Breakpoints. • Analyzing Test Results. • Filtering Messages. • Exporting to html. Dani Vainstein & Monika Arora Gautam

  35. Special Thanks To • Tali Hizkia from Israel, Tel-Aviv. • Paul Grossman from USA, Chicago. • Dalvinder Matharu from USA, San Jose. • Mike Manchester from USA, Bolivar. • Joydeep Das from India, Hyderabad. • Richi Sharma from USA, New Jersey. • Sanjeev Mathur from India, Noida. Dani Vainstein & Monika Arora Gautam

  36. Make sure to visit us for: Tutorials Articles Projects And much more @ www.AdvancedQTP.com 36 Dani Vainstein & Monika Arora Gautam

More Related