我可以从 Maven/Hudson 自动调用 QTP 测试套件吗?

发布于 2024-09-16 08:39:31 字数 143 浏览 6 评论 0原文

我们需要将 QTP 与 Hudson 集成,以针对 Hudson 中部署的代码自动调用测试套件。构建过程基于 Maven。

有没有什么插件或者什么东西可以实现这个?我们听说过 Hudson 的 Groovy 插件;我们可以用 Groovy 脚本来执行它吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

残花月 2024-09-23 08:39:31

Hudson 不运行测试,它获取输出并生成一份不错的报告。您应该了解如何让 Maven 运行测试,然后让 Hudson 获取输出以生成报告。

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.

婴鹅 2024-09-23 08:39:31

正如 Michael 所说,这是 Maven 集成问题,而不是 Hudson 问题。我不知道 QTP 的 Maven 插件,但你可以使用 exec-maven-插件 调用任意可执行文件,并为该可执行文件提供参数。 QTP 提供了一个“自动化”API,您应该能够相当轻松地将其包装在脚本中。它不会是一个巧妙的集成,但可能会满足您的目的。

以下是您可以使用的配置示例:

<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>

上一个问题的答案从 Ant 调用 QTP 是编写自动化集成的一个很好的起点。


更新:

这是一种可能适合您的方法。看来您可以直接调用 QTP 服务器,传递您想要执行的测试的名称。因此,您可以使用 antrun 插件 来调用 url 并将输出定向到目标目录。修改 url 和测试名称以匹配您的环境,并且应调用 QTP 并将结果放置在 target/qtp/results.html 中。这假设您有一个可以调用的测试来执行 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>

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>
棒棒糖 2024-09-23 08:39:31

我们通过 VBScript、JScript 和 RunTestSet 实用程序以 3 种方式实现了这种集成。在POM中,我们需要这样指定。

  <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>

使用 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>

问候,
拉姆亚。

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.

终陌 2024-09-23 08:39:31

您可以尝试 Jenkins 的质量中心插件:https://wiki.jenkins- ci.org/display/JENKINS/Quality+Center+Plugin

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

清晨说晚安 2024-09-23 08:39:31

我一直在使用这个

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

我直接调用的vbscript

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文