Wednesday 28 May 2008

Sharing Code base with QTP

As I mentioned before some test automation can be executed via a vbs stand-alone file instead of using QTP. How do you do that without the need of multiple code basis or branches?

The solution (the function getTextFileContent can be found in a previous post):




'************************************
'*** AUT test suite driver script ***
'*** vbs standalone version ***
'*** by Stefan Thelenius May 2008 ***
'************************************

'Load common functions from library
Execute getTextFileContent("\\server\path\libraryFileName","Unicode")

'Set initial test run option parameter
strRunCode = "intTestRunOptionId = 2" & vbLF

'Load QTP test code
strRunCode = strRunCode & _
getTextFileContent("\\server\path\yourQTPTestName\Action1\Script.mts","utf-8")

'Execute test
Execute strRunCode





Pros:
Faster execution time
Licence free

Cons:
No run-time debugging
Not possible to use QTP features (Test object model...)
Need to implement parameter "TestTool" (If objParameter("TestTool") = "QTP" Then) for all QTP specific code lines, for example using the QTP native Reporter object.

I use it for Web Service testing and some URL bases web testing. Those test can executed via QTP as well using this concept (just change one parameter) so I usally run the test via QTP at first so debugging is possible and when stable I use my vbs-file instead.

4 comments:

Anonymous said...

I need some help to display the passed results in numbers.I mean How many it got passed.When I ran the QTP script successfully,it is showing '0' in passed list under summary section.

Please help

Stefan Thelenius said...

I think I need some more info in order to help you. For example what QTP script did you try to run?

/Stefan

Chebrolu said...

Hi Stefan,

This is Poorna, I am working on EXTjs pages automation.

QTP not identifying so many objects of EXTjs page, QTP will supports EXTJs pages or not?.
how it is different from normal WEB page?.

I heard about Web-Extensibility Add-Ins in some other Blogs.

I have confident on you because 1 year back I taken help for web services.

Can please help me about it.

Let me know which tool is very good for EXTJs pages or I can use same QTP.

Please send me your comments to my

mail-id :
poorna817@yahoo.com
chandra_rao99@yahoo.com
chebrolu.poorna@gmail.com

Thanks & Regards

--Poorna

Stefan Thelenius said...

Hi,

I don't know much about ExtJS and the Web-Extensibility but I did a small record/playback test with one sample application and it worked without porblems so I guess QTP should be a good candidate for this type of application.

Regards

/Stefan