|
MavenIntegration
Running Robot Framework tests as a part of Maven build.
en, ja
IntroductionHere's a quick and very basic example of using Robot Framework from Maven builds. Notice that Robot Framework itself is available through Maven. If your looking for an advanced guide, please check out the excellent blog post by Andreas Ebbert-Karroum. There is nowadays also a separate Maven Plugin for Robot Framework available. 1. Create a projectmvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app 2. Create a directory for robot testscd my-app mkdir -p src/test/resources/robot-tests 3. Create a robot testvim src/test/resources/robot-tests/test.txt *** Test Cases ***
Hello World
Log Hello, World!4. Add Robot test execution to Maven pom.xml<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>my-app</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>pybot</executable>
<workingDirectory>.</workingDirectory>
<arguments>
<argument>-d</argument>
<argument>target/robot</argument>
<argument>src/test/resources/robot-tests/test.txt</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>5. Run Robot tests with Mavenmvn integration-test 6. Enjoy reports and greenesstarget/robot/log.html ResourcesThe example sources in a zip file Please read more about the Maven Exec-plugin and its configuration at the Exec-plugin site. |
► Sign in to add a comment
That's quite similar to our setup. What I do additionally is
compiling java classes to keywords copying all maven dependencies and add them to the classpath call jython with dependencies and own classes on classpath => easy setup to write your own keywords use maven profiles to configure the setup
http://blog.codecentric.de/en/2010/03/robot-framework-fachtests-in-eclipse-entwickeln-und-mit-maven-ausfuhren/
Out of curiosity. Have you googled "maven robot framework" before setting it up yourself, and didn't find our blog. Or did you just start?
try this instead:
http://robotframework-maven-plugin.googlecode.com
Separate Maven plugin is sweet! Added a note about it to the introduction. I wonder should this whole wiki page be deprecated now.
perhaps :-)