Hi Jari!

Jari Worsley wrote:
> isn't there something called jxunit that gets data for tests out of an
> xml file? couldn't we do something similar, and have a separate
> "cactus.xml" (or whatever) that acts as web.xml for MO implementation?
> and could also act as configuration for some of the IC tests that need
> servletcontext settings - e.g. when testing a servlet that expects
> certain settings in web.xml.

This sounds nice.

> > > Now, I don't like putting meat inside a servlet. Unit tests apply to
> > > unit functionality, and that should be in different classes. So, I see
> > > all tests done on a servlet as functional -- they apply to many
> >
> 
> I'm not sure I like the arbitrary distinctions between unit and
> functional testing. Can any of us actually agree on what the scope of a
> unit test is? Does anyone agree on where unit and "functional" testing
> begin and end? Or is it more useful to think of "testing code using
> other code" - i.e. what tests can you usefully write in source code, and
> what tests do you need to leave to a testing suite (like load testing or
> regression testing)?

The old distinction between "white box" and "black box" is good enough
for me: you either know how it works internally (and pass the
appropriate parameters for the test cases) or don't (and follow links
and fill out forms).

Any other distinction is more of a personal thing. In Vincent's
classification, "end-to-end" vs "unit" seems quite blurry: "end-to-end"
testing is nothing more than "unit" tests chained. Similarly for
"functional" vs "unit": a "unit" test for a servlet is a "functional"
test for the webapp.

To illustrate my point: you have 2 servlets and 30 aux classes. Every
class has its own test case. For the aux classes you use normal JUnit
tests, and just test individual behaviors.

For the servlets, you use Cactus to unit-test them. In fact, the
servlets use the 30 aux classes, and so you're testing the full-blown
webapp. Is it a "functional" or "unit" test?

To make the test comprehensive, you write tests to add, edit and delete
a personal record via forms in the servlet. They must be run in the
sequence above (so as to not delete before it's added). You're in fact
testing the normal lifecycle of a user. Is it "end-to-end" or "unit"?

So, when I spoke about "functional" tests on a servlet, I just wanted to
stress the point that we cannot agree on what is what. Cactus should
allow any white box tests, any way you want to categorize them. I hope
the point is clearer now.

Un saludo,

Alex.

Reply via email to