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

后端 未结 5 2061
伪装坚强ぢ
伪装坚强ぢ 2021-01-14 04:03

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 plugi

相关标签:
5条回答
  • 2021-01-14 04:23

    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.

    0 讨论(0)
  • 2021-01-14 04:32

    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.

    0 讨论(0)
  • 2021-01-14 04:32

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

    0 讨论(0)
  • 2021-01-14 04:32

    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

    0 讨论(0)
  • 2021-01-14 04:39

    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>
    
    0 讨论(0)
提交回复
热议问题