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: 603
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:  1157 Time(s)

Back to top
View user's profile Send private message
eggtester
Knight of the Nightshade


Joined: 26 May 2010
Posts: 25
Location: Bristol, UK

Posted: Fri Jul 23, 2010 7:45 am
Post subject:
Reply with quote

I don't suppose you have any more examples of keyword driven testing using eggPlant do you? Mr. Green
Back to top
View user's profile Send private message Send e-mail
umamaheswarreddy.t



Joined: 27 Jul 2010
Posts: 2
Location: Hyderabad

Posted: Tue Jul 27, 2010 8:50 pm
Post subject: 'Create Automated Install Test of PRODUCT on differnt OS'
Reply with quote

hi can u please give me code, on a product should install on different os(XP,Vista,Mac,Win7), please provide me script how to automate[/b]
Back to top
View user's profile Send private message Send e-mail
eggtester
Knight of the Nightshade


Joined: 26 May 2010
Posts: 25
Location: Bristol, UK

Posted: Mon Aug 02, 2010 8:08 am
Post subject:
Reply with quote

Hi,

I'm trying to set up a keyword driven framework and I'm stumbling a little at the first hurdle.

I'm just trying to run a .csv file called smokeTest.csv, which has a maximum of 5 delimited values in each row.

Am I correct in thinking that I don't need to change the keywordDriver script and that I'd need another script that calls the handler with the CSV as a parameter of it?

Basically that's what I'm trying to do without much luck at the moment! Embarassed
Back to top
View user's profile Send private message Send e-mail
EggplantMatt
Auberlord


Joined: 24 Jun 2003
Posts: 573
Location: Boulder, CO

Posted: Mon Aug 02, 2010 2:46 pm
Post subject:
Reply with quote

We need a little more info on what problem you're having. The approach you've outlined seems fine, but it seems like there's a lot of room for interpretation in "without much luck at the moment." Posting or sending your scripts would also help.
Back to top
View user's profile Send private message AIM Address
EggplantMatt
Auberlord


Joined: 24 Jun 2003
Posts: 573
Location: Boulder, CO

Posted: Mon Aug 02, 2010 2:53 pm
Post subject:
Reply with quote

Quote:
hi can u please give me code, on a product should install on different os(XP,Vista,Mac,Win7), please provide me script how to automate[/b]

@umamaheswarreddy.t: No one is going to be able to give you code to do this, since no one knows exactly what the steps are for the install, or whether the steps are the same on all platforms. In addition, you'll need to capture your own images. The script itself is probably going to be mostly a series of Click commands.
Back to top
View user's profile Send private message AIM Address
eggtester
Knight of the Nightshade


Joined: 26 May 2010
Posts: 25
Location: Bristol, UK

Posted: Mon Aug 02, 2010 11:53 pm
Post subject:
Reply with quote

Hi EggplantMatt,

I think the issue I'm having is that I don't know how to feed the CSV file into the "executeKeywords" handler. At the moment I have a suite with the keyword Driver script in it (which I've renamed to executeKeywords) and I have another suite that has the keywords suite as a helper. In the suite without the driver I have a script called smokeTest that has the line

Code:
executeKeywords "smokeTest.csv"


I've tried different variants of this without much success. All that happens is I get a list of scripts that are in the keyword scripts folder and nothing else happens.

Do you need anymore info?
Back to top
View user's profile Send private message Send e-mail
eggtester
Knight of the Nightshade


Joined: 26 May 2010
Posts: 25
Location: Bristol, UK

Posted: Tue Aug 03, 2010 12:24 am
Post subject:
Reply with quote

Think I cracked it. I've basically done the following:

Code:
put file "/keywordScripts/smokeTest.csv" into blabla
executeKeywords blabla


This now runs the script from the rows in the CSV file.

I'm going to fiddle about with it more now so it works sweetly with runwithnewresults to improve feedback.
Back to top
View user's profile Send private message Send e-mail
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.