Hello Everyone,

After refactoring the start component and while starting on the base
component I realized that the testing framework for OFBiz is not good. You
cannot do real test driven development or red-green-refactor with the
current setup, hence my proposal to change it. I explain below:

Problem with current design
----------------------------------------
- What we have right now is not unit tests, it's really integration tests.
You have to start the framework, the database, the service engine, the
entity engine and pretty much everything.
- Testing is very slow, because it's an integration test as I mentioned
above. 10 minutes on a good computer!
- There is zero mocking! We actually have to --load-data for things to
work. Again, these are integration tests.
- Too complex: Integration tests by their nature are grabbing too much.
Mind you, I am not objecting to integration tests (I actually like them)
but I am objecting to not having real unit-tests. Unit tests should all run
in a few seconds.

Proposed solution
--------------------------
- We keep what is considered real integration tests the way they are right
now and keep using them
- We move what should be unit tests into simple JUnit classes, and we do
not run them using java -jar ofbiz.jar --test, but instead run them
directly from the build.xml script, so these files are not identified in
any XML document, but are simply called immediately from the build scripts.
- We clearly mark the difference between integration tests and unit tests
(inside the source files or in the suite declarations).
- We change the run-tests target in build.xml to run both unit tests and
integration tests.

I intend to heavily refactor the framework and I would feel better about
introducing this change while refactoring. What do you guys think? Ideas?
Suggestions? Approvals and thumbs up?

Regards,

Taher Alkhateeb

Reply via email to