quality@glassfish.java.net

Re: Testing strategies in Glassfish/J2EE

From: Chun, Byung C <byungchun_at_statestreet.com>
Date: Tue, 18 Nov 2008 19:31:34 -0500

You could always take the integration testing route by using a combination of selenium, selenium rc, and cubit, all open source :-) from openqa.org. Also, for code coverage and static/heuristic testing, take a look at sonar.codehaus.org which wraps around pmd, findbugs, checkstyle, and cobertura with hudson integration, all open source :-)


Jin
> mobile on blackberry [857-222-7518]

----- Original Message -----
From: Darryl.Mocek_at_Sun.COM <Darryl.Mocek_at_Sun.COM>
To: quality_at_glassfish.dev.java.net <quality_at_glassfish.dev.java.net>
Sent: Tue Nov 18 18:42:03 2008
Subject: Testing strategies in Glassfish/J2EE

Hello,

  I'm working on an application built using J2EE and running under
Glassfish v2u2. I use NetBeans 6.5 for development. I'm trying to find
the best strategies for testing my application. I am used to using unit
tests, so I've been looking at JUnit. I also attended a session at the
last JavaOne which discussed DBUnit. I like DBUnit because my
application is heavily database dependent and I'd like to put the
database into a testing state so I can test various specific scenarios.
I currently have static (not running under Glassfish) and runtime
(running under Glassfish) tests built, but only a couple. I plan on
using a mix of various tests to comprehensively test my application.

My issue is that I need to test methods which interact with the database
and which use an entitiy manager within Glassfish. So static testing
with JUnit and/or DBUnit will not work since my methods being tested
expect to have a J2EE entity manager available. Runtime testing with
JUnit/DBUnit does not seem to work. If I extend either of these classes
and build a test to instantiate my extended class, the tests don't
run...as if the class never was instantiated. I would expect at least
an error around not finding appropriate J2EE container information. I
am starting to look into using mock testing. I'm also looking into
using EJB3Unit (http://ejb3unit.sourceforge.net), which looks promising,
and TestNG, which I have seen some Glassfish blog posts which state
Glassfish itself is tested using TestNG. Part of the problem I'm having
is as I search the Internet for testing frameworks for J2EE
applications, most of what I see is old (e.g. J2EEUnit) and not in use
or at least not in development any longer. It's almost as if various
strategies have been tried, but nothing nothing really worked so work on
it stopped.

What is the best way to perform testing on J2EE applications and which
testing frameworks should I be looking at?

Thanks,
Darryl

---------------------------------------------------------------------
To unsubscribe, e-mail: quality-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: quality-help_at_glassfish.dev.java.net