Uche,

This looks like a nice addition. If you are interested in contributing this to OFBiz a good way to get feedback would be to create a patch and basic instructions to a new Jira issue for OFBiz.

I'll add this to my list of things to keep in mind at the upcoming OFBiz developers conference (Mar 5-9). Testing infrastructure enhancements are one of the main priorities to work on for this event.

-David


On Feb 7, 2007, at 10:02 PM, Akotaobi, Uche wrote:

Hi, everyone. I'd like to start of by saying that we've been very impressed
with the OFBiz product in the brief time we've been using it.


Our team is big on continuous integration and unit testing, so it was natural for us to write JUnit TestCases for most of the major functionality of our OFBiz hot-deploy component, and then add those TestCases directly to our <test-suite/> XML file. We could then run our unit tests by hand with "ant
run-tests" from the ofbiz/ directory.  Good, great.

The problem we had was making sure that running the unit tests would generate XML report files suitable for merging via Ant's <junitreport/> task. It expected XML, and run-tests couldn't give us that XML, so the CruiseControl server couldn't really display a report of which of our tests passed or
failed.

Mind you, we solved the problem eventually, but our solution seems a
tad...inelegant:


- Drop Ant 1.7.0's ant-junit.jar directly inside framework/base/lib and hope
  for the best.
- Declare an org.apache.tools.ant.taskdefs.optional.junit.JUnitXMLFormatter directly inside TestRunContainer.java. Create JUnitTest objects for each class being tested [1], runner.startTestSuite() on each of the JUnitTests, and set the output to go to a FileOutputStream. Add each formatter as a
  listener to the TestResult.
- After the TestSuite run()s, tell each runner to endTestSuite() on those
  JUnitTest objects in order to write the XML output files.
- Add an extra rule to the main OFBiz build file to turn all this stuff on.

So now our CruiseControl runs "ant run-tests-xml" to give us the output we need, suppressing the normal OFBiz test result output in the process. It's
rough around the edges, but it works.


My question is just this: isn't there a better way? Surely I'm not the first
person to want to build and test an OFBiz component with a continuous
integration server? Those of you who have done this, how do you manage without XML output? Maybe there's some patch sitting in the bowels of Jira
that solves this problem already?

Thanks in advance for your responses!


[1] This required further modifications to ModelTestSuite.java, since it's the last part of the test workflow that has direct access to those class names
before they are converted to Test objects.  Maybe I'm wrong, though.

--
Uche O. Akotaobi
Workflow Engineer
Xerox Corporation
701 South Aviation Blvd., ESAE-116
El Segundo, CA  90245
Phone (310) 333-2403  Internal 8*823-2403
Fax (310) 333-8419
[EMAIL PROTECTED]

XEROX
Technology.  Document Management.  Consulting Services

www.xerox.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to