This tutorial is meant to show how easy you can use Robot Framework with Apache Ant. You can use later the build file for example with Jenkins.
Preconditions
- Robot Framework installed
- Apache Ant installed
Instructions
My folder structure looks like this:
Within the folder “report” all logs and reports should be stored. Inside the folder “testsuite” are all Robot Framework files. The “build.xml” looks like this:
<?xml version="1.0"?> <project name="RobotFramework" basedir="." default="run"> <description> Simple Apache Ant example for running RobotFramework </description> <property name="suite.dir" location="testsuite" /> <property name="docs.dir" location="report" /> <!-- set time --> <target name="init"> <tstamp> <format property="TODAY_DE" pattern="dd.MMMM.yyyy" locale="de" /> </tstamp> </target> <!-- delete docs.dir --> <target name="clean" depends="init"> <delete dir="${docs.dir}" /> </target> <!-- create docs.dir --> <target name="setup" depends="clean"> <mkdir dir="${docs.dir}" /> </target> <!-- running testsuite --> <target name="run" depends="setup"> <echo message="${TODAY_DE}" /> <exec executable="pybot"> <arg line="-d ${docs.dir}" /> <arg value="${suite.dir}" /> </exec> </target> </project>
The content of the build.xml is self-explanatory. Now opening a terminal and run Apache Ant.
# direct on folder simple type ant $ ant # you can specify the build file $ ant -buildfile build.xml # you can specify the target $ ant run