| Author |
Running JUnit against TomCat server from Ant
|
Anthony Bull
Greenhorn
Joined: Nov 08, 2004
Posts: 8
|
|
Hi, I have a bunch of j-unit tests I have written, half of which have to be run from my TomCat server (integration style tests). In my build script I am deploying my WAR to the TomCat server. My question is, is it possible to get Ant to run these j-unit tests on the running TomCat server using the <junit> task? I don't want to go down the route of Cactus or something, as the tests that require TomCat running are designed to be full integration tests where the environment is setup as a production environment. Cheers, Ants.
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
No, you can't do that with the <junit> task unless you write your own TestRunner implementation that contacts your application running on Tomcat and sends it a list of class names to execute as JUnit tests. Effectively, you'd be reinventing Cactus...
|
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
Anthony Bull
Greenhorn
Joined: Nov 08, 2004
Posts: 8
|
|
Originally posted by Lasse Koskela: No, you can't do that with the <junit> task unless you write your own TestRunner implementation that contacts your application running on Tomcat and sends it a list of class names to execute as JUnit tests. Effectively, you'd be reinventing Cactus...
Ok, I know how to get my build script to kick my unit testing off on the TomCat server - all I need to know is - can I somehow log the results of the unit tests and then get my build script to generate a report based on those? And also fail or email a failure message based on the results?
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
|
Again, Cactus would do this (collect test results) for you. I know that Cactus is a bit of a pain to set up but once you've done that, it should be a relatively smooth ride (compared to writing your own).
|
 |
 |
|
|
subject: Running JUnit against TomCat server from Ant
|
|
|