struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: Junit tests on remote Struts application in Eclipse
Date Mon, 10 Jul 2006 18:10:42 GMT

It sounds like you're trying to run the tests inside the container.  If
so, JUnit can't do that on it's own.  You can use Cactus to proxy from
the testrunner (outside the container) to the tests (inside the

I've always found Cactus to be a bit of a PITA, however, and have
changed my testing strategy to avoid it.  My tests are split into three

 - POJO JUnit tests which test the java code and run very fast.  These
drive most of my development via TDD.
 - Tests that involve other systems, principally the database.  I
substitute a DAO factory that uses a local JDBC Connection instead of
getting a datasource from the container.  These tests check the
Persistence layer.  They're much slower than the ordinary JUnit tests
(particulary because they use DBUnit to set up test data), but they're
still faster and easier than in-container tests.
 - Acceptance or System tests that test the application as a whole,
running in the container, through the normal web interface (using
HttpUnit).  These don't have to test the edge conditions, because those
are tested in the other tests, above.

Hope that helps.

 - George

> -----Original Message-----
> From: Chris Loschen [] 
> Sent: Monday, July 10, 2006 1:25 PM
> To: Struts Users Mailing List
> Subject: Junit tests on remote Struts application in Eclipse
> Hi all,
> This is admittedly tangential to our topic, but some other 
> questions on Eclipse came up last week, and people here seem 
> knowledgeable on all sorts of subjects... If you know of a 
> better list on which I could ask this question, please let me 
> know: I should probably be on it.
> I have a struts application deployed on a localhost app 
> server (the stack is Windows/Oracle/WebLogic), and I'm using 
> the new Eclipse 3.2 IDE (downloaded last week, at least 
> partly to try to solve the current problem). I've set up the 
> project as a regular Java project, which I did before WTP 
> came out. I haven't yet been able to figure out how to use 
> the WTP tools, or if there's something I need to do with my 
> project to enable those, but that's another issue. I've been 
> able to debug the application in Eclipse just fine for 
> several months by connecting to my localhost app and setting 
> breakpoints in my source code etc. 
> Now I'm trying to get some Junit tests running. The tests 
> themselves already exist, though eventually I'll be writing 
> some new ones to test some new functionality I'm working on. 
> But I haven't been able to run the tests at all yet. I keep 
> getting a null pointer exception on the tests which try to 
> actually connect to the DB. All the DB connections are 
> handled in my app server setup, so I think the difficulty is 
> that I'm just connecting to the code but not to the running 
> application.
> I've got TPTP in this new version of Eclipse but haven't 
> totally figured it out yet. Does anyone have any suggestions 
> to get me started or for some references on how to make this work?
> Thanks for your help!
> Chris
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message