AntSys
Why write AntSys
I was looking for a well-know and easy to use open source tool for our system testing.
My requirements are:
* configure parameters
* setup environment variables
* able to redirect stand input, output, and error
* get back the process exit code
* check if output file is created as expect
* check the content of output file against expected file.
* check process exit code
* check the content of system.ouput.
* check the content of system.error.
such as create/delete directory, copy files, and even xml processing.
Although the requirements are quite generic, I can't find a well-known OSS project. Most companies are
using their own home-grow system test framework.
Let's create a OSS tool to solve this problem then!
What is AntSys
AntSys is a lightweight and powerful system test framwork built on top of Ant.
It is designed to be easy to work and user can create system/function test cases in xml file without writing single line of code.
AntSys Tasks
AntSys provides the following Ant tasks to write a system test:
Example test script
Here is one example of test script to test echo command.
<project name="antsys-systemtest" basedir="." default="systemtest">
<target name="systemtest">
<!-- this test suite is using AntSys to test echo shell commands -->
<testsuite name="CommandTestSuite" failonerror="false" todir="./report" htmlreport="true">
<!-- test echo command output -->
<testcase name="echo_test">
<!-- create working dir for testing -->
<mkdir dir="work"/>
<!-- use echo to create a test file -->
<exec vmlauncher="false" executable="echo" output="work/test.dat">
<arg value="testmessage"/>
</exec>
<!-- check the file exists or not -->
<assertfileexist file="./work/test.dat" errormsg="should generate test.dat" />
<assertfilegrep file="./work/test.dat" regexp="^test" errormsg="should start with test" />
<assertfileequal expectedfile="./work/test.dat" actualfile="./work/test.dat"/>
<delete dir="work"/>
</testcase>
</target>
</project>
No comments:
Post a Comment