views:

1869

answers:

5

We need to integrate QTP with hudson to automatically invoke test suites against the code deployed in hudson.The build process is based on Maven.

Is there any plugin or something to achieve this?We heard about groovy plugin for hudson can we be able to execute it with groovy script?

Please guide.

+2  A: 

Hudson does not run tests, it takes the output and generates a nice report. You should look at how to make Maven run the tests, and then have Hudson pick up the output to generate a report.

Michael Donohue
+1  A: 

As Michael says, this is a Maven integration issue not a Hudson one. I don't know of a Maven plugin for QTP, but you can use the exec-maven-plugin to invoke an arbitrary executable, and provide arguments to that executable. QTP provides an "Automation" API that you should be able to wrap in a script fairly easily. It won't be a slick integration but may serve your purposes.

Here's an example of the configuration you could use:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.1.1</version>
  <executions>
    <execution>
      <goals>
        <goal>exec</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <executable>[qtp executable]</executable>
    <workingDirectory>/target</workingDirectory>            
    <arguments>
      <argument>[an argument to configure QTP]</argument>
      <argument>[another argument to configure QTP]</argument>
    </arguments>          
  </configuration>
</plugin>

An answer to a previous question on invoking QTP from Ant is a good starting point for writing the Automation integration.


Update:

Here's an approach that may work for you. It appears that you can directly invoke the QTP server, passing the name of the test you want executing. So you can use the antrun plugin to invoke the url and direct the output to a target directory. Modify the url and test name to match your environment and QTP should be invoked and the results placed in target/qtp/results.html. This assumes that you have a single test you can invoke to do everything you need to in QTP.

<plugins>
  <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.3</version>
    <executions>
      <execution>
        <phase>test</phase>
        <configuration>
          <tasks>
            <get verbose="true" src="http://[servername]/qtp/LaunchQTP.plx?testname=[test name]"
              dest="${project.build.directory}/qtp/results.html" />
          </tasks>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
</plugins>
Rich Seller
Can you please elaborate me what exactly i need to do with QTP automation API as i am new to QTP? Thanks,Ramya.
I'm afraid I have no access to or experience with the API. The simplest thing to do would be to take the VB in the referenced question and invoke that from the exec plugin.
Rich Seller
Thank you so much for your reply. i tried adding this plugin and configuration tags part in pom.xml,but still am not getting solution.can you please explain me the above configuration part with an example like what are the exact parameters to be given for the tags in configuration?
Hi,Can you please tell me where can i find that LaunchQTP.plx or i need to write that one?second thing is i have a vbscript with me to open QTP and Invoke tests in it.i have it in physical location.Also we dont have any port or server with QTP.Do we need to store that vbscript in QualityCenter and need to invoke it using the server name and port of QC? or it can be run without QC? Please clarify me.Thank You so much.
A: 

We have implemented this integration in 3 ways, using VBScript,JScript and RunTestSet utility. In POM, we need to specify like this.

  <build>
  <plugins>
  <plugin>    
    <artifactId>maven-antrun-plugin</artifactId>  
    <version>1.3</version>    
    <executions>      
      <execution>        
      <phase>test</phase>        
      <configuration>     
      <tasks>    
     <property name="vbs.script" value='qtp.vbs'/>
             <exec executable="WScript.exe" spawn="true" resolveExecutable="true">
     <arg line="${vbs.script}"/> 
    </exec>
                       </tasks>
     </configuration>       
     <goals>          
        <goal>run</goal>        
     </goals>     
   </execution>    
 </executions>  
 </plugin>
</plugins>
</build>

Using RunTestSet,

<exec executable="location of RunTestSet.exe" output="outputFolder"> 
<arg line="/s:qc url"/>
<arg line="/n:Domain"/> 
<arg line="/d:Project"/> 
<arg line="/u:username"/> 
<arg line="/p:password"/>  
<arg line="/f:TestSetFolder"/> 
<arg line="/t:TestSet"/> 
<arg line="/l"/>  
</exec>

Regards,
Ramya.

A: 

Hi, can you please guide me for this API. Because i want to execute QTP script from different city. QTP is installed in my office location. And i want to execute script from home pc. I do not have any vpn. is it possible? if yes then how?

Please explain in detail. Thanks alot

A: 

I've been using this vbscript

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible

qtApp.Open "<fullpathto>\XlTest", True ' Open the test in read-only mode

' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Run ' Run the test

qtTest.Close ' Close the test
qtApp.Close ' Close the app

Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object

which I call directly

Basim Baassiri