Introducing SIFL
The Inquisitors are proud to introduce a bit of code we have been working on. We are calling it the Software Inquisition Foundation Library for QTP, but you can call it SIFL (pronounced like "sniffle", but without the "n").
SIFL is a collection of QTP functions that we have been using for a while as a base framework for our QTP tests. Having eschewed checkpoints, the object repository, and the idea of record-and-playback testing, we needed a uniform way to write tests. SIFL is what we came up with.
Before I get into the details, let me show you a sample test to give an idea of what we are looking at. This is a quick example that uses the all-too-familiar Mercury Tours web site. We will open the site, navigate to the cruises page and make sure the departure time for the Skagway cruise is 5 pm.
-
BrowserDefault.Navigate "http://newtours.mercuryinteractive.com"
-
BrowserDefault.Link("innerText:=Cruises").Click
-
Set oTable = BrowserDefault.WebTable("innerText:=Cruise Itinerary.*")
-
sDeparture = oTable.GetXWhereYisString("Departure", "Port of Call", "Skagway, Alaska")
-
assertStringEquals sDeparture, "5 pm"
If you are used to seeing QTP code, that should look somewhat – but not entirely – familiar. I’ll go line-by-line to show you what is happening.
BrowserDefault.Navigate "http://newtours.mercuryinteractive.com"
The “BrowserDefault” function returns the current default browser. Because we have not already defined a default browser, it will open a new instance of IE for us and make it the default for future calls to BrowserDefault. The “Navigate” portion of that line is just the browser object’s standard navigate method. This causes the newly opened instance of IE to navigate to the Mercury Tours site.
BrowserDefault.Link("innerText:=Cruises").Click
Here we are calling the default browser again. This time we are clicking a link in the default browser.
Set oTable = BrowserDefault.WebTable("innerText:=Cruise Itinerary.*")
Once again, this is pretty standard. We are just assigning this web table instance to oTable. This step isn’t really necessary, but I wanted to keep the next line short
sDeparture = oTable.GetXWhereYisString("Departure", "Port of Call", "Skagway, Alaska")
Here we are using the SIFL method “GetXWhereYisString”. To put it simply, this gets the data from the “Departure” column in the row where the “Port of Call” column is “Skagway, Alaska”. If everything is kosher on the site, sDeparture should be a string with the value “5 pm”.
assertStringEquals sDeparture, "5 pm"
Here we assert that the string sDeparture equals “5 pm” and note the results in the log. If the assertion is correct, it passes, if not, it fails. Note the fine control we have over the types involved in this homemade "checkpoint". This is what allows us to execute tests across continents without a complicated source tree.
I am writing this on a plane that is about to land, so that's it for now. Expect to see more on SIFL in the next few days along with a link to download it for yourself.
Tags: assert, BrowserDefault, Framework, GetXWhereYisString, qtp, QTP-9.2, QuickTest Pro, QuickTest-Pro-9.2, SIFL, Software-Test-Automation, Software-Testing, VBScript


August 29th, 2007 at 9:32 am
Hi,
Just read your brief explanation of SIFL. Can’t wait to know more..
Ken Phipps
Reply to Ken Phipps
August 30th, 2007 at 1:47 pm
Love to see a link for SIFL!
Reply to bj
September 21st, 2007 at 6:00 am
Hi Will,
Nice to see work like SIFL …
Wondering what will happen to QTP statement like
Browser(”eee”).Page(”sss”).WebElement(”fff”).Link(”ddldld”).click
How SIFL is planning to handle the hierarchy based functional call like the one above?
Shrini
Reply to Shrini
January 11th, 2008 at 3:23 am
Hi Will,
I was just wondering the advantage of this framework. We are just eliminating the Browser(”xxx”).page(”yyy”) with the BrowserDefault Function. Further if user wants to Navigate to different page and perform actions, how is he going to navigate to a specific page as I do not see any parameter passed to BrowserDefault Function? In the QTP staments we have the option Browser(”xx).page(”yy”), where the identification properties for page can be changed.
Regards,
Priya
Reply to Priya