|
SAMIESimple
Automation
Module For Internet Explorer Samie is now graciously accepting
donations through PayPal. Samie Updates 04/21/2005 - Samie has been accepted for an article in the lastest version of www.perl.com 02/12/2005 - Samie 2.0 is now available. Thanks to a suggestion by Danny R. Faught, you no longer need to use WaitForDocumentComplete or WaitForBusy in your Samie scripts. 01/13/2005 - Introducing Samie's Slingshot - a Samie GUI tool that will help you write automation scripts for an $11 donation. Just click on the PayPal button above. Here is a short slingshot demo movie. (IE required for viewing.) You can find a tutorial located here. 09/28/2004 - Apparently, Samie could be having an effect on Mercury Profits.
05/08/2004 Samie now does popup windows that contain frames. Samie has come a long way since the original post on September 5, 2002.
Kris Wehner gave me a nice review on his blog
Samie has been able to perform and
verify more than two hundred thousand unique
testcases per day for the past two years at Upromise.com
He is also currently running regression tests for the National Leisure Group
|
Don't underestimate what can be done using the application server's database schema to hold your test data. Just think of the backend database as the perfect place to hold your samie data up front. It probably already has tons of data that you can query from to fill every page as your browser presents html forms to samie.
I was taught this method by Matt Bowser. Who learned it from Mike Haggerty. If you're serious about loading up samie with ton's of test data, it's actually a lot easier to query from the same schema that development uses than it is to rewrite your own methods and data structures.There is a venerable book out on the topic of Win32
perl.
Although I did not use it to write samie, after samie was done, I
noticed some rather good explanations of the basics of what was
accomplished. The authors' name is Dave
Roth . His book is called Win32 PerlProgramming.
Specifically chapter 5 on OLE automation.
Which reminds me of a nice Oreilly website called
Safari. With this site you can
read as many as 5 different books for $10.00 a month.
Many thanks to Bob Marchetti for getting so excited about the
creation of samie, originally posting my code to
the
web and starting this sourceforge project, even though he didn't know
how to use cvs! He also drew the humble picture of
little samie and showed me this nice open source
Perl IDE
for debugging. I believe his original name for samie was
bamie (basic) or wamie (windows). Anyway he was
the first user other than myself and is an excellent Quality Engineer.
Mr. Marchetti was also responsible for coaching me on how to
change the belt on my clothes dryer, to which I will ever be grateful.
Bob and friends have been working on a python version of samie for a while now. His project is called Pamie.
If you would like to write in Ruby there are a bunch of folks putting together a worthy alternative to samie called WATIRList of Features
Setup info
How does samie know when a page is complete?
Samie 2.0, SAM.pm contains an internal function called WaitForDocumentComplete. Whenever you call a function from samie that loads a new page, this function blocks your script from proceeding while samie watches for events being fired from Internet Explorer.
How is samie able to watch events being fired by Internet Explorer?
SAM.pm contains the Event subroutine. This subroutine has been setup to be a COM callback subroutine. Through it's connection to the Internet Explorer COM object Samie is able to catch an event whenever it is fired by Internet Explorer because IE actually calls Samie's Event subroutine. This is interprocess communication. Remember that the internal WaitForDocumentComplete has been blocking the samie script, but it does not block calls to the Event callback subroutine.
Now that we are hooked up to IE Events, I simply wait until the number of BeforeNavigate2 events is equal to the number of DocumentComplete events, then tell Samie to stop blocking and script execution continues.
Here is an example:
$seconds = Navigate("http://www.yahoo.com");
print "Yahoo took $seconds seconds to load.\n";
Here is a list of the
functions
currently available:
ClickAClassNameHyperlink
ClickBackButton
ClickCheckBox
ClickFormButton
ClickFormButtonByIndex
ClickFormButtonByLabel
ClickFormImage
ClickImage
ClickLink
ClickRadioButton
DismissSecurityAlert
DismissSecurityAlertsub
GetActiveObject
GetCurrentListBoxItem
IEQuit
isTextPresent
logtofile
LookForListBoxItem
MessageLoop
Navigate
QuitMessageLoop
RefreshIE
SetCheckBox
SetEditBox
SetListBoxItem
StartIE
VerifyCheckBox
VerifyEditBox
VerifyFormElementExists
VerifyLinkTextExists
VerifyListBoxItem
VerifyMessageBox
VerifyMessageBoxText
VerifyRadioButton
VerifyStatusBarMessage
VerifyTableText
VerifyTextNotPresent
VerifyTextArrayPresent
VerifyTextPresent
WaitForDocumentComplete
WaitForDocumentCompleteForPopup