Find out more about eggPlant

Forum IndexForum Index
Forums FAQForums FAQ
Search ForumsSearch Forums
MemberlistMemberlist
UsergroupsUsergroups
RegisterRegister
Your ProfileYour Profile
Log inLog in
Keyword Driven Testing

 
Post new topic   Reply to topic   Printer-Friendly View    Forum Index -> Eggplant Examples
View previous topic :: View next topic  
Author Message
SenseTalkDoug
Auberlord


Joined: 27 Jun 2003
Posts: 588
Location: Colorado

Posted: Wed Mar 19, 2008 4:33 pm
Post subject: Keyword Driven Testing
Reply with quote

In recent years, many software testers have chosen to adopt a "Keyword Driven" approach to test automation (sometimes also called "action words", "test frameworks", or "third-generation test automation"). In this approach, test cases are not defined directly in scripts, but in a simplified table format. Typically, each row in the table contains a keyword and associated parameters. So a table might look something like this:
Code:
   launch     SuperApp
   verify     SAMainScreen
   login      joeuser         secretPassword
   verify     loginSucceeded
   logout

Here, the keywords are launch, verify, login, and logout, but they could be any actions relevant to your testing context. The parameters are specific to each keyword, but might be image names or text to be typed and so forth.

One of the main reasons for adopting this approach is that it provides a fairly high-level, abstract representation of the steps to be taken to validate some functionality, without specifying the low-level details of how to carry out each of those actions. This makes it possible to specify a test before an application is fully functional and ready to be tested. The actual implementation of the scripts to carry out each keyword action can be developed later and can be changed over time to match changes in the application without having to change the test description in the table.

Some organizations also like this approach because it allows tests to be created by non-programmers, using a familiar tool such as a spreadsheet to create the table.

The suite presented here provides a foundation that shows one possible way to implement keyword driven testing in Eggplant. There is actually very little code involved. The KeywordDriver script provides the keywords and parameters, and calls the executeKeywords handler, which contains all of the interesting code.

The other scripts in the suite (launch.script, login.script, logout.script, and verify.script) are merely placeholders in this example that define the implementation of the keywords. To create your own keyword driven framework you would simply provide your own scripts to handle these or other keywords that are relevant in your test environment.

For those who like to look before they try, here is the complete executeKeywords handler:
Code:
to executeKeywords sourceText
   -- get the list of valid keywords and display it
   set validCommands to the short name of \
         each item of the files of my folder \
         where each ends with ".script" and each is not my name
   put validCommands, "- - -"
   
   -- process all of the source keywords and parameters
   repeat with each line sourceLine of sourceText
      put sourceLine split by comma into (command, paramList...)
      if command is not in validCommands then
         logError "Invalid Keyword: " & command
      else
         try
            -- run the command; pass paramList as individual params
            run command paramList as parameters
         catch
            logError "Error running " & command && paramList \
                  & ": " & the exception
         end try
      end if
   end repeat
end executeKeywords



KeywordDriven.suite.zip
 Description:
Example suite showing one way to implement Keyword Driven testing in Eggplant

Download
 Filename:  KeywordDriven.suite.zip
 Filesize:  27.79 KB
 Downloaded:  835 Time(s)

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   Printer-Friendly View    Forum Index -> Eggplant Examples All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
 
TestPlant
©TestPlant Ltd 2009. All rights reserved.