Keyword Driven Testing.ppt

2,081 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,081
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
42
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Keyword Driven Testing.ppt

  1. 1. Keyword Driven Testing Using WRSAFS By John Crunk
  2. 2. Agenda <ul><li>Some information about testing in general </li></ul><ul><li>Install Winrunner </li></ul><ul><li>Install Engine </li></ul><ul><li>Learn how to write scripts </li></ul><ul><li>Break </li></ul><ul><li>Write some scripts </li></ul><ul><li>Solve Problems and discover solutions </li></ul><ul><li>Questions </li></ul>
  3. 3. Keyword Driven Testing <ul><li>Action Word Testing </li></ul><ul><li>Data-Driven Testing </li></ul><ul><li>Keyword Driven Testing </li></ul><ul><li>It’s all the same thing, a specific set of actions happen for a given word. </li></ul>
  4. 4. Why use Keyword Testing <ul><li>Reusability!!! </li></ul><ul><li>Common components handled by standard libraries </li></ul><ul><li>The details of the scripts are hidden from the user. </li></ul><ul><li>Users don’t have to learn the script language to write scripts. </li></ul>
  5. 5. Reusability <ul><li>Standard components are handled the same </li></ul><ul><li>Common screens are handled with the same test tables. </li></ul><ul><li>Test tables can be used in many different applications instead of creating one for each application. </li></ul>
  6. 6. What can I test with a Framework? <ul><li>Web based applications </li></ul><ul><li>Java based applications </li></ul><ul><li>Windows based applications </li></ul><ul><li>C/C++/C# Applications </li></ul><ul><li>VB Applications </li></ul><ul><li>.NET Applications </li></ul><ul><li>COM (with enhancements) </li></ul><ul><li>Oracle (with enhancements) </li></ul><ul><li>Delphi (with enhancements) </li></ul>
  7. 7. Looking… Beyond “The Project” <ul><li>Is your automated test effort really unique? </li></ul><ul><li>Do you really think your problems are novel? </li></ul><ul><li>Do you really want to do this all over again? </li></ul>Generally, a finite set of common components make up our infinite set of unique applications. We are all trying to solve the same problems! Carl Nagle SAS
  8. 8. I don’t have time to learn something new!!! <ul><li>There is to much to do </li></ul><ul><li>Time lines are fast approaching </li></ul><ul><li>I can’t add to my already cramped workload. </li></ul><ul><li>Aren’t you telling me I am going to have to do more? </li></ul>
  9. 9. Advantages of a Framework <ul><li>Using a framework will actually give you more time. </li></ul><ul><li>Shared test among projects that don’t seem to have anything to do with each other. </li></ul><ul><li>Mundane task no longer need be manual. </li></ul><ul><li>Computers don’t forget to do something once they are told once. </li></ul><ul><li>Boring task are automated. </li></ul><ul><li>You look like a hero for finishing on time!!! </li></ul>
  10. 10. How WRAFS Interfaces with your application
  11. 11. Installing WRAFS <ul><li>Backup any prior installs and uninstall </li></ul><ul><li>Install Java Virtual Machine (JVM) from http://java.sun.com/j2se/ </li></ul><ul><li>Run the WRSAFS Install </li></ul><ul><li>Install SAFS by running Setup.vbs </li></ul><ul><li>Scripts are installed to C:WRSAFS </li></ul><ul><li>Test Tables are installed to C:Datapool </li></ul><ul><li>Services are installed to C:SAFS </li></ul><ul><li>STAF is installed to C:STAF </li></ul><ul><li>Verify c:staf; c:safs;c:stafin are added to the path </li></ul><ul><li>Verify Classpath additions have been made for STAF and SAFS jar files </li></ul><ul><li>Verify registry entries have been made and are pointed to the correct directories </li></ul>
  12. 12. Getting down to business with WRAFS!!! <ul><li>Cycle Driver </li></ul><ul><ul><li>The main script calls Suite Drivers </li></ul></ul><ul><ul><li>.CDD extension </li></ul></ul><ul><li>Suite Driver </li></ul><ul><ul><li>Intermediate scripts, calls Step Drivers </li></ul></ul><ul><ul><li>.STD Extension </li></ul></ul><ul><li>Step Driver </li></ul><ul><ul><li>This is where all your work happens. </li></ul></ul><ul><ul><li>.SDD Extension </li></ul></ul>
  13. 13. Some File Structure Information <ul><li>Datapool </li></ul><ul><ul><li>Bench </li></ul></ul><ul><ul><li>Cycle </li></ul></ul><ul><ul><li>Dif </li></ul></ul><ul><ul><li>Logs </li></ul></ul><ul><ul><li>Step </li></ul></ul><ul><ul><li>Suite </li></ul></ul><ul><ul><li>Taborder </li></ul></ul><ul><ul><li>Test </li></ul></ul>
  14. 14. Other Settings
  15. 15. Other Settings Continued… <ul><li>;Note: the section name and the Key should not be changed </li></ul><ul><li>[STAF] </li></ul><ul><li>ENABLED = TRUE </li></ul><ul><li>[LOGMODE] </li></ul><ul><li>ConsoleLOg = TRUE </li></ul><ul><li>SQALog = TRUE </li></ul><ul><li>TextLog = TRUE </li></ul><ul><li>STAFLog = TRUE </li></ul><ul><li>[SAFSLOGS] </li></ul><ul><li>JarFile = C:safslibsafslogs.jar </li></ul><ul><li>Machine = local </li></ul><ul><li>TextLog = TRUE </li></ul><ul><li>XMLLog = FALSE </li></ul><ul><li>;Directory = S: estothersdatapoollog </li></ul><ul><li>;LogFacility = mylog </li></ul><ul><li>[SAFSVARS] </li></ul><ul><li>JarFile = C:safslibsafsvars.jar </li></ul><ul><li>[SAFSMAPS] </li></ul><ul><li>JarFile = C:safslibsafsmaps.jar </li></ul><ul><li>[DIFFER] </li></ul><ul><li>TOOL_EXE=C:Documents and SettingsjcrunkDesktopUnxUtilsusrlocalwbinDIFF.EXE </li></ul><ul><li>TOOL_OPTIONS=&quot;/t&quot; </li></ul><ul><li>TOOL_BINARY_OPTIONS=&quot;--binary -s&quot; </li></ul><ul><li>[DIFFVIEWER] </li></ul><ul><li>TOOL_EXE=C:ExamDiffExamDiff.exe </li></ul><ul><li>TOOL_OPTIONS=&quot; &quot; </li></ul>
  16. 16. What does a command look like? <ul><li>T; Login; Login; Click </li></ul><ul><li>T; Login; Username; SetTextValue; “jdoe” </li></ul><ul><li>T; Login; Password; SetUnverifiedTestValue, “password” </li></ul>
  17. 17. Welcome to the Application Map File <ul><li>[ApplicationConstants] </li></ul><ul><li>FlightApp=&quot;C:Program FilesMercury InteractiveWinRunnersamplesvbappfltvb41a.exe“ </li></ul><ul><li>[Login] </li></ul><ul><li>Login={class: &quot;window&quot;, label: &quot;Login&quot;, MSW_class: &quot;ThunderRT6FormDC&quot;} </li></ul><ul><li>Help={class: &quot;push_button&quot;, vb_name: &quot;cmdHelp&quot;} </li></ul><ul><li>Cancel={class: &quot;push_button&quot;, vb_name: &quot;cmdCancel&quot;} </li></ul><ul><li>OK={class: &quot;push_button&quot;, vb_name: &quot;cmdOK&quot;} </li></ul><ul><li>AgentsName={class: &quot;edit&quot;, vb_name: &quot;txtAgentsName&quot;} </li></ul><ul><li>Password={class: &quot;edit&quot;, vb_name: &quot;txtPassword&quot;} </li></ul><ul><li>[InvalidPassword] </li></ul><ul><li>InvalidPassword={class: &quot;window&quot;, label: &quot;Flight Reservation Message&quot;, MSW_class: &quot;#32770&quot;} </li></ul><ul><li>OK={class: &quot;push_button&quot;, label: &quot;OK&quot;} </li></ul>
  18. 18. Creating an Application Map <ul><li>Select Tools|GUI Map Editor in Winrunner </li></ul><ul><li>Open the Application to be tested </li></ul><ul><li>Click on Learn in the Map Editor </li></ul><ul><li>Select the Window of the Application </li></ul><ul><li>Answer Yes to the prompt </li></ul><ul><li>Navigate to the next screen to learn </li></ul><ul><li>Go to Step 3 until all application has been learned </li></ul><ul><li>Save the GUI Map File </li></ul><ul><li>Open and run ProcessMapFile Script </li></ul><ul><li>You Application Map file is saved at the same place as your GUI Map File with a similar name. </li></ul>
  19. 19. A little about Variables <ul><li>Component Names </li></ul><ul><li>Window Names </li></ul><ul><li>Data Values </li></ul><ul><li>Others? </li></ul>
  20. 20. How to use Variables <ul><li>Can be in the Map File or the Test Tables </li></ul><ul><li>In the test table variables are preceded by a ^ (carot sign) </li></ul><ul><li>When assigning a value, simple type ^var=“value” or ^var1=^var2 </li></ul><ul><li>When using a variable just type in ^variable in the place you want to use it. </li></ul>
  21. 21. Where do all these commands come from? <ul><li>Coders that have something to add write generic code for the commands </li></ul><ul><li>Documentation is updated and the commands are tested for all to use. </li></ul><ul><li>Documentation is located at http:// safsdev . sourceforge .net/sqabasic2000/ RRAFSReference . htm </li></ul>
  22. 22. Start Scripting!!! Keep It Simple Silly (KISS) <ul><li>T; LaunchApp </li></ul><ul><li>T; Flights </li></ul>Cycle Driver Flight.CDD
  23. 23. Start Scripting!!! Keep It Simple Silly (KISS) <ul><li>T; LaunchFlight </li></ul><ul><li>T; login </li></ul>Suite Driver LaunchApp.STD
  24. 24. Start Scripting!!! Keep It Simple Silly (KISS) <ul><li>T AddFlight </li></ul>Suite Driver Flights.STD
  25. 25. Start Scripting!!! Keep It Simple Silly (KISS) <ul><li>C; SetApplicationMap; “c:DatapoolFlightReservation.gui” </li></ul><ul><li>C;LaunchApplication;TestApp;^FlightApp </li></ul>Step Driver LaunchApp.SDD
  26. 26. Start Scripting!!! Keep It Simple Silly (KISS) <ul><li>C; SetApplicationMap; “C:DatapoolFlightReservation.gui” </li></ul><ul><li>T;Login; AgentsName; SetTextValue; “jdoe” </li></ul><ul><li>T; Login; Password; SetUnverifiedTextValue; “mercury” </li></ul><ul><li>T; Login; OK; Click </li></ul>Step Driver Login.SDD
  27. 27. Start Scripting!!! Keep It Simple Silly (KISS) <ul><li>T; FlightReservation; NewFlight; Click </li></ul><ul><li>T; FlightReservation; Departures; SelectTextItem; &quot;Los Angeles“ </li></ul><ul><li>T; FlightReservation; Destinations; SelectTextItem; &quot;Portland&quot; </li></ul><ul><li>T; FlightReservation; Flights; Click </li></ul><ul><li>T; FlightsTable; OK; Click </li></ul><ul><li>T; FlightReservation; CustomerName; SetTextValue; &quot;Sue Smith&quot; </li></ul><ul><li>T; FlightReservation; FirstClass; Click </li></ul><ul><li>T; FlightReservation; TicketsOrdered; SetTextValue; &quot;2&quot; </li></ul><ul><li>T; FlightReservation; InsertOrder; Click </li></ul>Step Driver AddFlight.SDD
  28. 28. What did we just do??? <ul><li>Started the Application. </li></ul><ul><li>Verified the application started. </li></ul><ul><li>Set the Text Value of Agent name. </li></ul><ul><li>Verified we set the Text Value of Agent Name. </li></ul><ul><li>Verified the value we set to Agent name is what we sent to it. </li></ul><ul><li>Set the Text Value of Password. </li></ul><ul><li>Verified that we set the text value of password. </li></ul><ul><li>Clicked the Ok button. </li></ul><ul><li>Verified we clicked the OK button. </li></ul>
  29. 29. What Next??? <ul><li>Make it reusable so we can use the same script over and over </li></ul><ul><li>Make the information generic </li></ul><ul><li>Parameterize names or variables so they can change values </li></ul>
  30. 30. How do I do that? <ul><li>T; LaunchApp </li></ul><ul><li>T; Login; ^UserName=“jdoe”; Password=“mercury” </li></ul><ul><li>T; ExitApp </li></ul><ul><li>T; Logoff </li></ul><ul><li>T; Login; ^UserName=“ssmith”; Password=“InvalidPassword” </li></ul><ul><li>T; VerifyInvalidPassword </li></ul><ul><li>T; Login; ^UserName=“bjones”; Password = “Mercury” </li></ul>C; SetApplicationMap; “C:DatapoolFlightReservation.gui” T;Login; AgentsName; SetTextValue; ^UserName T; Login; Password; SetUnverifiedTextValue; ^Password T; Login; OK; Click StartApplication.STD Login.SDD
  31. 31. ExitApp.SDD <ul><li>C; SetApplicationMap; “C:DatapoolFlightReservation.gui” </li></ul><ul><li>T, FlightReservation, FlightReservation, SELECTMENUITEM, “File;Exit” </li></ul>
  32. 32. VerifyInvalidPassword.SDD <ul><li>C; SetApplicationMap; “C:DatapoolFlightReservation.gui” </li></ul><ul><li>T; InvalidPassword; InvalidPassword; VerifyProperty; Visible; 1 </li></ul><ul><li>T; InvalidPassword; OK; Click </li></ul>
  33. 33. What is different about this one? <ul><li>We do all of the things the first script did, but this time we do a lot more! </li></ul><ul><li>Added test tables for Exit and invalid user </li></ul><ul><li>Verify you can login with a valid user </li></ul><ul><li>Verify you can exit the application </li></ul><ul><li>Verify an invalid user can gain access to the system </li></ul><ul><li>Make a login test table that works for most any application that has a login. Just make sure the name is the same, in the application map files. </li></ul>
  34. 34. Let’s Do some more… <ul><li>Launch Application </li></ul><ul><li>&quot;C:Program FilesMercury InteractiveWinRunnersamplesvbappfltvb41b.exe“ </li></ul><ul><li>&quot;C:Program FilesMercury InteractiveWinRunnersamplesvbapp&quot; </li></ul><ul><li>Create Reservation </li></ul><ul><li>Find Reservation </li></ul><ul><li>Update Reservation </li></ul><ul><li>Delete Reservation </li></ul>
  35. 35. Your Turn!!! <ul><li>http://safsdev.sourceforge.net/sqabasic2000/RRAFSReference.htm </li></ul>
  36. 36. Flight.CDD Revisted <ul><li>T; LaunchApp </li></ul><ul><li>T; Flights </li></ul>
  37. 37. LaunchApp.STD <ul><li>T; LaunchFlight </li></ul><ul><li>T; login; ^user.name=&quot;jcrunk“; ^user.password=&quot;mercury&quot; </li></ul>
  38. 38. Flights .STD <ul><li>C; SetVariableValues; ^Class=&quot;FirstClass“; ^NbrTickets=&quot;2&quot; </li></ul><ul><li>T; AddFlight; ^Departure=&quot;Los Angeles“; ^Destinations=&quot;Portland“; ^Customer=&quot;Sue Smith&quot; </li></ul><ul><li>C; SetVariableValues; ^Class=&quot;BusinessClass“; ^NbrTickets=&quot;3“ </li></ul><ul><li>T; AddFlight; ^Departure=&quot;Denver“; ^Destinations=&quot;Los Angeles“; ^Customer=&quot;John Doe&quot; </li></ul><ul><li>C; SetVariableValues; ^Class=&quot;EconomyClass“; ^NbrTickets=&quot;1&quot; </li></ul><ul><li>T; AddFlight; ^Departure=&quot;Portland“; ^Destinations=&quot;Seattle“; ^Customer=&quot;Bob Jones&quot; </li></ul><ul><li>T; FindFlight; ^Customer=&quot;Sue Smith&quot; </li></ul><ul><li>T; UpdateFlight; ^NbrTickets=&quot;1“; ^Class=&quot;BusinessClass&quot; </li></ul><ul><li>T; FindFlight; ^Customer=&quot;John Doe&quot; </li></ul><ul><li>T; UpdateFlight; ^NbrTickets=&quot;2“; ^Class=&quot;EconomyClass&quot; </li></ul><ul><li>T; FindFlight; ^Customer=&quot;Bob Jones&quot; </li></ul><ul><li>T; UpdateFlight; ^NbrTickets=&quot;3“; ^Class=&quot;FirstClass&quot; </li></ul><ul><li>T; FindFlight; ^Customer=&quot;Sue Smith&quot; </li></ul><ul><li>T; DeleteFlight </li></ul><ul><li>T; FindFlight; ^Customer=&quot;John Doe&quot; </li></ul><ul><li>T; DeleteFlight </li></ul><ul><li>T; FindFlight; ^Customer=&quot;Bob Jones&quot; </li></ul><ul><li>T; DeleteFlight </li></ul>
  39. 39. AddFlight.SDD <ul><li>T; FlightReservation; FlightReservation; SelectMenuItem; “File; New Order” </li></ul><ul><li>T; FlightReservation; Departures; SelectTextItem; “Denver” </li></ul><ul><li>T; FlightReservation; Destinations; SelectTextItem; “Portland” </li></ul><ul><li>T; FlightReservation; Flights; Click </li></ul><ul><li>T; FlightsTable; AvailiableFlights; SetSelectedRow; 2 </li></ul><ul><li>T; FlightsTable; OK; Click </li></ul><ul><li>T; FlightReservation; CustomerName; SetTextValue; ^Customer </li></ul><ul><li>T; FlightReservation; ^Class; Click </li></ul><ul><li>T; FlightREservation; InsertOrder; Click </li></ul>
  40. 40. LaunchFlight.SDD <ul><li>C; LaunchApplication; Flight; ^FlightApp; ^FlightPath </li></ul>
  41. 41. Login.SDD <ul><li>T; Login; AgentsName; SetTextValue; ^user.name </li></ul><ul><li>T; Login; Password; SetUnverifiedTextValue; ^user.password </li></ul><ul><li>T; Login; OK; Click </li></ul>
  42. 42. AddFlight.SDD <ul><li>T; FlightReservation; NewFlight; Click </li></ul><ul><li>T; FlightReservation; Departures; SelectTextItem; ^Departure </li></ul><ul><li>T; FlightReservation; Destinations; SelectTextItem; ^Destinations </li></ul><ul><li>T; FlightReservation; Flights; Click </li></ul><ul><li>T; FlightsTable; OK; Click </li></ul><ul><li>T; FlightReservation; CustomerName; SetTextValue; ^Customer </li></ul><ul><li>T; FlightReservation; ^Class; Click </li></ul><ul><li>T; FlightReservation; TicketsOrdered; SetTextValue; ^NbrTickets </li></ul><ul><li>T; FlightReservation; InsertOrder; Click </li></ul>
  43. 43. FindFlight.SDD <ul><li>T; FlightReservation; FlightReservation; SelectMenuItem; &quot;File;Open Order...&quot; </li></ul><ul><li>T; FindOrder; ByCustName; Click </li></ul><ul><li>T; FindOrder; CustomerName; SetTextValue; ^Customer </li></ul><ul><li>T; FindOrder; OK; Click </li></ul>
  44. 44. UpdateFlight.SDD <ul><li>T; FlightReservation; ^Class; Click </li></ul><ul><li>T; FlightReservation; TicketsOrdered; SetTextValue; ^NbrTickets </li></ul><ul><li>T; FlightReservation; UpdateOrder; Click </li></ul>
  45. 45. DeleteFlight.SDD <ul><li>T; FlightReservation; DeleteOrder; Click </li></ul><ul><li>T; ConfirmationMessage; Yes; Click </li></ul>
  46. 46. Where to go from here? <ul><li>Start experimenting with other applications </li></ul><ul><li>Read some of the documentation on http://safsdev.sourceforge.net </li></ul><ul><li>Have Confidence…You can Do it!!! </li></ul>
  47. 47. References <ul><li>Nagle, C. Test automation frameworks; 1999 </li></ul><ul><li>Kit, E. & Prince, S. &quot;A Roadmap for Automating Software Testing&quot; Tutorial presented at STAR’99 East Conference, Orlando, Florida, May 10, 1999. </li></ul><ul><li>Hayes, L. &quot;Establishing an Automated Testing Framework&quot; Tutorial presented at STAR’99 East Conference, Orlando, Florida, May 11, 1999. </li></ul><ul><li>Kit, E. &quot;The Third Generation--Integrated Test Design and Automation&quot; Guest presentation at STAR’99 East Conference, Orlando, Florida, May 12, 1999. </li></ul><ul><li>Mosley, D. & Posey, B. Just Enough Software Test Automation New Jersey: Prentice Hall PTR, 2002. </li></ul><ul><li>Wust, G. &quot;A Model for Successful Software Testing Automation&quot; Paper presented at STAR’99 East Conference, Orlando, Florida, May 12, 1999. </li></ul><ul><li>Dustin, E. Automated Software Testing: Introduction, Management, and Performance . New York: Addison Wesley, 1999. </li></ul><ul><li>Fewster & Graham Software Test Automation: Effective use of test execution tools New York: Addison Wesley, 1999. </li></ul><ul><li>Dustin, E. &quot;Automated Testing Lifecycle Methodology (ATLM)&quot; Paper presented at STAR EAST 2000 Conference, Orlando, Florida, May 3, 2000. </li></ul>
  48. 48. References <ul><li>Kit, E. & Buwalda, H. &quot;Testing and Test Automation: Establishing Effective Architectures&quot; Presentation at STAR EAST 2000 Conference, Orlando, Florida, May 4, 2000. </li></ul><ul><li>Sweeney, M. &quot;Automation Testing Using Visual Basic&quot; Paper presented at STAR EAST 2000 Conference, Orlando, Florida, May 4, 2000. </li></ul><ul><li>Buwalda, H. &quot;Soap Opera Testing&quot; Guest presentation at STAR EAST 2000 Conference, Orlando, Florida, May 5, 2000. </li></ul><ul><li>Pollner, A. &quot;Advanced Techniques in Test Automation&quot; Paper presented at STAR EAST 2000 Conference, Orlando, Florida, May 5, 2000. </li></ul><ul><li>Cem Kaner, http://www. kaner .com </li></ul><ul><li>Zambelich, K. Totally Data-Driven Automated Testing 1998 http://www. sqa -test.com/w_paper1.html </li></ul><ul><li>SQA Suite Users, Discussions and Archives, 1999-2000, http://www. dundee .net/ sqa / </li></ul><ul><li>Nagle, C. Data Driven Test Automation: For Rational Robot V2000 1999-2000 DDE Doc Index </li></ul>

×