Saturday, December 24, 2011

QTP Grid

Launch QTP scripts on remote machine from any machine (even from linux)
This will allow you to trigger QTP scripts (Stored in Local Drive Or Shared Drive Or on QC Server)on a remote machine through a command line.
This trigger is independent which means that it is not dependent on QC or QTP (QC or QTP is not required to be installed on the machine from where you are triggering the script)
Trigger is also cross platform. hence you can trigger QTP scripts from Linux machine as well. You can also integrate this with any of Automated Build Tool. So as soon as code drop happens, QTP script on remote machine will start automatically.

How to Do it?
1. Save Code from all three locations.
http://paurushc.blogspot.com/2011/12/qtpgridserverjavatxt.html             >  with name QTPGridServer.java
http://paurushc.blogspot.com/2011/12/qtpgridclientjavatxt.html               > with name QTPGridClient.java
http://paurushc.blogspot.com/2011/12/qtptriggervbstxt.html                   > with name QTPTrigger.vbs

2. Compile and create Class files from java files. use any online compiler in case you don't have java compiler.
Place QTPGridServer.Class and QTPTrigger.vbs on the remote execution machine under same folder (for ex: C:\QTPGrid)

3. Start Server on remote machine by typing command "java C:\QTPGrid\QTPGridServer". You should see "waiting for Connection" in command prompt.
=================

Thats it.. you are done.. now for launching Script on remote machine just type below command from any of the machine

java QTPGridClient 192.168.xx.xx "<QTPGrid><TestCaseNames>C:\QTPScripts\Addition,C:\QTPScripts\Division</TestCaseNames></QTPGrid>"

where 192.168.xx.xx is remote machine IP add where server is runing

Above command will start script C:\QTPScripts\Addition script saved on local. you can replace it with shared drive path as well. in order to run multiple scripts give comma separated values.

Now if your scripts are saved on QC server then you need to single line value in below format:

<QTPGrid>
<scriptstoredat>QC</scriptstoredat>
<qcurl>http://qualitycenter.com/qcbin</qcurl>
<loginid>userid</loginid>
<loginpass>password</loginpass>
<qcdomain>ProjectDomain</qcdomain>
<qcproject>ProjectName</qcproject>
<testsetfolderpath>Subject\CalculaterTesting\Release1</testsetfolderpath>
<testsetname>PhaseOneRegression</testsetname>
<testcasenames>Addition,Division</testcasenames>
<emailids>abc@gmail.com,xyz@gmail.com</emailids>
</QTPGrid>

Note: If you want to execute complete Test Set then do not mention TestCaseName tag. then it will start executing all scripts present in testset.

in whole command will be:
java QTPGridClient 10.10.10.10 "<QTPGrid><scriptstoredat>QC</scriptstoredat><qcurl>http://qualitycenter.com/qcbin</qcurl><loginid>userid</loginid><loginpass>password</loginpass><qcdomain>ProjectDomain</qcdomain><qcproject>ProjectName</qcproject><testsetfolderpath>Subject\CalculaterTesting\Release1</testsetfolderpath> <testsetname>PhaseOneRegression</testsetname>  <testcasenames>Addition,Division</testcasenames> <emailids>abc@gmail.com,xyz@gmail.com</emailids></QTPGrid>"

See this in Action: http://www.youtube.com/watch?v=aclyWHMjoFI




No comments:

Post a Comment