Revision: 4020
Author: KariHusa
Date: Tue Aug 31 22:10:14 2010
Log: Edited wiki page JavaIntegration through web user interface.
http://code.google.com/p/robotframework/source/detail?r=4020
Modified:
/wiki/JavaIntegration.wiki
=======================================
--- /wiki/JavaIntegration.wiki Tue Aug 31 08:10:30 2010
+++ /wiki/JavaIntegration.wiki Tue Aug 31 22:10:14 2010
@@ -1,4 +1,4 @@
-#summary Describes various ways to use Robot Framework from Java.
+#summary Describes various ways to use Robot Framework from and with Java
and such things.
= Introduction =
@@ -33,3 +33,92 @@
Javadocs for individual release are found below:
*
[http://robotframework.googlecode.com/svn/tags/robotframework-2.5.3/doc/java/index.html
2.5.3]
+
+= Executing Robot Tests as a part of Maven build =
+
+Here's a quick example of using Robot Framework from
[http://maven.apache.org/ Maven] builds.
+
+1. Create a project:
+{{{
+mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes
-DgroupId=com.mycompany.app -DartifactId=my-app
+}}}
+2. Create a directory for robot tests:
+{{{
+cd my-app
+mkdir src/test/resources
+mkdir src/test/resources/robot-tests
+}}}
+3. Create a robot test:
+{{{
+vim 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 maven:
+{{{
+mvn integration-test
+}}}
+6. Enjoy reports and greeness.
+{{{
+target/robot/log.html
+}}}
+
+Please read more about the Maven Exec-plugin and its configuration at the
[http://mojo.codehaus.org/exec-maven-plugin/ Exec-plugin site].