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?
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With