RE: Running tests from ant on a continuous integration server
RE: Running tests from ant on a continuous integration server
- Subject: RE: Running tests from ant on a continuous integration server
- From: "Brook, James" <email@hidden>
- Date: Thu, 23 Oct 2008 08:40:52 +0200
- Thread-topic: Running tests from ant on a continuous integration server
Chuck,
That's really helpful. Thanks. I might have guessed that you would be the one to answer.
Our Selenium tests are actually written in Java and run from TestNG using the Java driver for Selenium, so we have code that looks like this:
protected void login() {
browser.open(APP_PATH);
browser.type("username", USERNAME);
browser.type("password", PASSWORD);
browser.click("//input[@id='login']");
}
The Java code takes care of launching the Selenium server and the browser. The idea was that developers write and maintain tests with the minimum of context switching. The Java API actually is not so bad at all for test code. I had thought it would be more cumbersome. It's still too early to tell if we can keep our acceptance tests maintainable in this form, but I am hopeful that the automated build and test cycle will help.
Thanks for the ant help.
--
James
-----Original Message-----
From: Chuck Hill [mailto:email@hidden]
Sent: Wed 22.10.2008 19:37
To: Brook, James
Cc: email@hidden
Subject: Re: Running tests from ant on a continuous integration server
Hi James,
On Oct 22, 2008, at 8:18 AM, Brook, James wrote:
> Each of our applications is built automatically on a continuous
> integration server whenever new code is committed. I would now like
> our tests to be run once these continuous integration builds are
> completed. These tests should be run from an ant task. We are using
> the new wolips build style to make this possible (no more nasty
> woproject/ant.blah files).
>
> My question is: does anyone have a nice ant target/task for
> achieving this? We are happy to run junit or testng, but I would
> like a task that makes it easy to provide the WebObjects classpath.
> I saw that previously there was a task called wounit, which extended
> the junit task. This seems to have been dropped from the most recent
> version of WOUnitTest. I guess we could make our own task, but it
> would be nice not to do this if someone already has a solution.
>
> The plan is to run Selenium-RC tests from junit and it would be
> excellent to get them running on the continuous integration servers.
> Any pointers would be very much appreciated.
>
> It seems that some sort of vanilla 'run-tests' task would be a nice
> thing to have in the ant build files that WOLips generates.
I use this to run my TestNG tests:
<target name="test" depends="setProps" if="has.unit.tests">
<testng workingdir="${project.working.directory}"
outputDir="${test.report.dir}/${database.type}"
sourcedirref="${project.source.path}"
haltOnfailure="false">
<!-- Pass values to
net.hhshoppers.hh.testng.EOTestSuite.java -->
<jvmarg value="-DDBType=${database.type}" />
<jvmarg value="-DJDBCUrl=${database.url}" />
<jvmarg value="-DJDBCDriver=${database.driver}" />
<jvmarg value="-DDBUserName=${database.userid}" />
<jvmarg value="-DDBPassword=${database.password}" />
<!-- Make sure the tests run with enough memory -->
<jvmarg value="-Xmx768m" />
<classpath refid="project.classpath"/>
<classpath>
<fileset dir="${build.product.dir}" includes="**/
*.jar" />
</classpath>
<xmlfileset dir="Testing/" includes="${unit.test.suite}"/>
</testng>
</target>
project.classpath is created using wopath:
<wopath id="project.classpath">
<frameworks root="User" eclipse="true" />
<path refid="jars" />
</wopath>
<path id="jars">
<fileset dir="${JarsDir}" includes="*.jar" />
</path>
You can run Selenium tests directly from Ant:
<target name="run.suite">
<selenese
suite="${suite.path}"
browser="${browser.name}"
results="${results.path}"
timeoutInSeconds="2500"
startURL="http://${hostname}/"
/>
</target>
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden