happy ‘09

January 7, 2009 by testraven

Upgrading from QTP 9.1 to 9.5 this month- will let you know how that goes… in the meantime, ran into a very cool QTP site  http://www.advancedqtp.com/  - check them out.  Dani Vainstein has generously posted chapters of his QTP book on this site  http://www.advancedqtp.com/knowledge-base/scripting-qtp/   Looks like some excellent reference material.  For you QTP newbies I would at least recommend that you read the ‘VBScript Basics’ chapter and take a try at ‘VBScript Advanced’.    I am currently in the ‘advanced’ chapter (typically do ‘optional’  reading when I eat my Wheat Chex snack at night)  learning why I may want to use ‘dictionary objects’ vs.  arrays for some test storage tasks.

The ‘Windows Script Host’ chapter 9 of Vainsteins book is just an awesome reference for those of us already using this capability in our QTP scripts.  I’m sure there are a lot of gems there I’ll uncover with further perusal.

cheers

take control of your test looping

December 16, 2008 by testraven

‘ tested using QTP 9.1 and QTP 9.5

Aren’t data tables great ? they are !
Ever wish you could have total control over what dataRow you start at and how many loops you run ?
You can .. assuming you are willing to step out of the box a bit!

Set the test settings to run only ‘one row’ of your ‘main action’
then you can take control of where to point to get your data.

What about re-useable Actions ?
Re- implement them as inline VBScript Sub Procedures, or create a library of re-useable
VBScript sub procedures linked via your test settings

‘dim custname, custAddress

isRandom=MsgBox (“Answer YES to RANDOMLY pick a starting data row,– NO to CHOOSE  the data row to start at–”, 36, “manual Step !”)
If (isRandom=6) Then
randomize
currDataRow=RandomNumber (1,99)  ‘ if you have 99 rows of data
Else
currDataRow= inputBox (“Input the data row of the spreadsheet to start at as an integer”, “Row to start data”, 1)
End If
counter= 1
‘ set current data row
currDataRow= 1

DataTable.SetCurrentRow(currDataRow)
counter=1
loopEndCounter =inputBox (“how many rows of data do you want to enter- ie how many loops to run ?”)
‘ OR …
‘loopEndCounter= [some fixed number if you want to do the same every time]

‘ if you need to logon…
‘ login inside the loop or outside of it ? depends on your test and your app
‘ most browser apps will let you logoff and logon as ’some other test account’
‘ if I am running a test with multiple test accounts, I try to logon inside the loop
‘ …..usually I would not close the initial browser until I exit the bottom of the main loop
‘ re- instantiating the browser-under- test is tricking and doesn’t always work well

‘################################
Do While(counter <= CInt(loopEndCounter))   ‘ start main loop
If (counter > 1)  Then
currDataRow= currDataRow +1

End If

DataTable.SetCurrentRow(currDataRow)
custName= DataTable(“custName”, dtGlobalSheet)
custAddress= DataTable(“custAddress”, dtGlobalSheet)
‘etc
‘   msgBox currDataRow

‘ #############################
‘ do your testing here !!!!
‘ logoff
counter= counter + 1

Loop
‘ end man loop

Browser(mySpiffy App Browser).Close
‘ or whatever cleanup steps you need

quote of the day

December 16, 2008 by testraven

“Everything is vague to a degree you do not realize till you have tried to make it precise.” [or test it for precision ] – Bertrand Russell

blogOPhobia and auto test design

December 10, 2008 by testraven

why did I never blog before ? no time.

Heres a quick one on auto test design while my brain is away doing my day job :

Ask yourself- is the basic, repetitive use case in my app something where the user is

A. ’creating a new thing’ – or

B. one where they modify an existing thing  ?   

If B.  then is the system you test on typically pre- loaded with data?  Does it get refreshed periodically from a ‘production’ environment.  Do you need to handle test artifacts that may come up in a variety of states ?

In my experience- none of these items are show stoppers for gui system test automation if you can plan for them and have some capacity to ‘think backwards’ during your test design phase.

how to log to a .csv file using QTP

December 4, 2008 by testraven

‘how to log to a .csv file in QTP

‘ useful if you need to produce test reports in a certain format/

‘ or html results dont give you the right granularity.. audit trail, etc.

localDate= Date
localTime= Time
localDateString= replace(localDate, “/”, “-”)
localTime= replace(localTime, “:”, “-”)
localTimeString=Left(localTime, 6)

‘  ####################################################
‘ setup logging        logging                logging                logging
‘ sample useage in test           f.WriteLine (“myVar is ” & myVar)
‘ more formal useage eg use with header below
‘ f.WriteLine(“test step descrip,more description,” & result & “,” & date & “,” & time & “,” & outData6 & “,” & outData7)

Set fs = CreateObject(“Scripting.FileSystemObject”)
doesFileExist= fs.FileExists(“c:\_0_AutoTestOutput\\RegressionTest” & localDateString & “.csv”)
If (fs.FileExists(“c:\_0_AutoTestOutput\\RegressionTest” & localDateString & “.csv”)) Then
Set f= fs.OpenTextFile(“c:\_0_AutoTestOutput\\RegressionTest” & localDateString & “.csv”, 8, True)
f.WriteLine (“output file reOpen,  ” & testUrl & “, info,” & date & “,”  & time)
Else
Set f= fs.CreateTextFile (“c:\_0_AutoTestOutput\\RegressionTest” & localDateString & “.csv”,True)
‘ if new file write a header
f.WriteLine(“test step,more description,result/status ,date,time,outData6, outData7″)
f.WriteLine (“output file initial Open , info, ,”  & date & “,”  & time)
End If

why did I start a public blog about software testing ?

December 4, 2008 by testraven

why did I start a public blog about software testing  when there are so many other good ones out there ?

I work with HP QuickTest Pro ( QTP ), an automated gui testing tool.  I also read blogs about testing. there is a lot of hype about what gui test tools can do and cannot do.  I’d like to share some of the things I have done successfully with QTP that are not ‘out of the box’, but help me test software.

I am just a guy who has pushed a lot of buttons, typed in a lot of text boxes, and written a lot of bugs.  I promise not to push too much deep philosophy at ya.

I may also state sometimes what manual test techniques work for me and what don’t, or talk about load testing.

My motives are partially selfish, because I want to build respect and support in the testing & developer community for what gui tools can do when used intelligently.  I also want to explicitly state what tasks I have found gui tools not particularly good at. Hopefully this will have a good karmic effect for me and any readers. If you don’t use test tools you have probably stopped reading already.

At the start will say all my posts will refer to some ‘generic’ situation, and that I do not have time to answer specific questions from readers via blog comments. The QuickTest Pro forum at qaforums.com has some good basic knowledge if you need that. Use their google search first to make sure someone else has not asked your question first. I use QTP and whatever other term string I am looking for. Their onsite search is somehat useless, but they have a google search box that is site specific.

I also reserve the right to change the technical direction of this blog somewhat over time, but I promise not to rant here about most topics unrelated to sw testing.