Thursday, March 19, 2015

Example to execute RobotFramework test cases using maven plugin

I spent some time using maven plugin to run the RobotFramework tests. It is OK, run as expected.
But I feel it is a kind of restrictive.

Here I post my one maven pom.xml example.

For details, please check my github source code:
1. https://github.com/stevez/robotframework-maven-plugin-example
2. https://github.com/stevez/robotframework-java-keyword


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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.robotframework</groupId>
<artifactId>robotframework-maven-plugin-test-java-keyword</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Test</name>
<build>
<plugins>
<plugin>
<groupId>org.robotframework</groupId>
<artifactId>robotframework-maven-plugin</artifactId>
<version>1.4.4</version>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
view raw gistfile1.txt hosted with ❤ by GitHub

Execute RobotFramework test cases using Gradle script


I did some research for RobotFramework using maven plugin. But I don't like it. it is too restrictive.Today I tried to implement a Gradle script, it is working, surprising easy.  Here is the code sample.

For details please refer my github repository.

build.gradle
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
runtime group: 'org.robotframework', name: 'robotframework', version: '2.8.7'
runtime group: 'com.github.markusbernhardt', name:'robotframework-selenium2library-java', version:'1.4.0.7'
}
clean{
delete 'target'
}
task(run, type: JavaExec) {
main = 'org.robotframework.RobotFramework'
classpath = sourceSets.main.runtimeClasspath
args '--variable', 'BROWSER:gc'
args '--outputdir', 'target'
args 'tests'
}
defaultTasks 'run'
view raw gistfile1.txt hosted with ❤ by GitHub