Maven 2 我可以从Maven/Hudson自动调用QTP测试套件吗?
我们需要将QTP与Hudson集成,以便根据部署在Hudson中的代码自动调用测试套件。构建过程基于MavenMaven 2 我可以从Maven/Hudson自动调用QTP测试套件吗?,maven-2,integration,hudson,qtp,Maven 2,Integration,Hudson,Qtp,我们需要将QTP与Hudson集成,以便根据部署在Hudson中的代码自动调用测试套件。构建过程基于Maven 有没有什么插件或东西可以实现这一点?我们听说了Hudson的Groovy插件;我们可以用Groovy脚本执行它吗?Hudson不运行测试,它接受输出并生成一个漂亮的报告。您应该看看如何让Maven运行测试,然后让Hudson获取输出以生成报告。正如Michael所说,这是Maven的集成问题,而不是Hudson的问题。我不知道有没有用于QTP的Maven插件,但您可以使用调用任意可执行
有没有什么插件或东西可以实现这一点?我们听说了Hudson的Groovy插件;我们可以用Groovy脚本执行它吗?Hudson不运行测试,它接受输出并生成一个漂亮的报告。您应该看看如何让Maven运行测试,然后让Hudson获取输出以生成报告。正如Michael所说,这是Maven的集成问题,而不是Hudson的问题。我不知道有没有用于QTP的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>
An是编写自动化集成的良好起点
更新:
这里有一个方法可能对你有用。似乎可以直接调用QTP服务器,并传递要执行的测试的名称。因此,您可以使用调用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>
我们使用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>
问候,,
Ramya.我一直在使用这个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
我直接调用它你可以试试Jenkins的Quality Center插件:你能详细说明我对QTP自动化API的具体需求吗,因为我是QTP新手?谢谢,Ramya。恐怕我没有API的使用权限或经验。最简单的方法是使用引用问题中的VB,并从exec插件调用它。非常感谢您的回复。我尝试在pom.xml中添加这个插件和配置标签部分,但仍然没有得到解决方案。你能用一个例子向我解释一下上面的配置部分吗?比如,在配置中,标签的确切参数是什么,你能告诉我在哪里可以找到LaunchQTP.plx,或者我需要写一个吗?第二件事是我有一个vbscript可以打开QTP并在其中调用测试。我有它在物理位置。我们也没有任何端口或服务器与QTP。我们需要将该vbscript存储在QualityCenter中,并需要使用服务器名称和端口调用它吗质量控制?或者它可以在没有QC的情况下运行?请澄清。非常感谢。他可能问了太多强调哈德逊的原始问题,但这仍然是一个值得回答的好问题。