David,

I agree that there should be a method for testing the business logic
layer separate from the presentation layer.  Here are some of my
suggestions:

Presentation Layer Testing

- Use a tool like WebTest, Selenium, or grinder
- The key to these tests should be ease to setup and execute.  If they
are too difficult no one will use them

Business Logic Layer

- In the ofbiz world, this is the service layer.
- The easiest method I have found to test this is to use regular JUnit
tests and export the service you want to tests.  Some of the drawbacks
to this approach are as follows:
---> requires the service to be set as exportable which is means you
have to manually switch them back to non-exportable if you want to run
them in production
---> RMI Serialization incompatibilities when you compile ofbiz from
Ant but run your JUnit test from an IDE like eclipse.  You can work
around these issues but that is a topic for further discussion


Unit Testing

- These would be JUnit tests at the component level like entity and
service engine.  I haven't found this level of testing that productive
as the framework is mature.  It would be  a good idea to have the
community develop key unit tests for new features added to these
components.


Automated JUnit test with Ant

OFBiz has a mechanism to run automated tests in the ant build.  Here
are my thoughts and feedback on this type of testing.

Good
- These are very helpful for automated build tests and for sharing
tests within the community.
- They are also helpful if you want to run something like
CruiseControl each night to verify that your builds are working
correctly

Bad
- They take too long to execute because the test has to run through an
entire build, then startup up the ofbiz app server, and then execute
the tests.
- One of the key objectives of XP is to be able to test frequently and
often and this means they have to execute quickly.

I am currently working on some JUnit tests that will work in the
automated build but can also be run as a standalone client to tests
against an exported service.


Feedback is always welcome.


Brett

On 12/2/06, David Welton <[EMAIL PROTECTED]> wrote:
Quick thought of my own:

I'd suggest having a look at something that can be run from the
command line to test the controller logic with the default store's
data, which could be added to as needs to be.  It would IMO be handy
to be able to skip the presentation layer in order to test the logic
without worrying about the browser.

--
David N. Welton
 - http://www.dedasys.com/davidw/

Linux, Open Source Consulting
 - http://www.dedasys.com/

Reply via email to