Can I invoke QTP test suits automatically from Maven/Hudson?

情到浓时终转凉″ 提交于 2019-12-01 06:39:11

问题


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 the Groovy plugin for Hudson; Can we execute it with a Groovy script?


回答1:


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.




回答2:


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>



回答3:


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.




回答4:


You can try Quality Center Plugin for Jenkins : https://wiki.jenkins-ci.org/display/JENKINS/Quality+Center+Plugin




回答5:


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



来源:https://stackoverflow.com/questions/1164443/can-i-invoke-qtp-test-suits-automatically-from-maven-hudson

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!