Difference between revisions of "Unit Testing"

From Opentaps Wiki
Jump to navigationJump to search
(New page: __TOC__ ==How to Write Unit Tests== For opentaps 1.0, you would write a set of Junit tests in a class, then add it to In opentaps 0.9, you would write your Junit tests class and add y...)
 
m (Protected "Unit Testing": Sysop page [edit=sysop:move=sysop])
(No difference)

Revision as of 01:20, 21 September 2007


How to Write Unit Tests

For opentaps 1.0, you would write a set of Junit tests in a class, then add it to

In opentaps 0.9, you would write your Junit tests class and add your it to the base/config/test-containers.xml file, in the "junit-container" at the bottom, like this:

    <container name="junit-container" class="org.ofbiz.base.container.JunitContainer">
        <property name="base-test" value="org.ofbiz.base.test.BaseUnitTests"/>
        <property name="entity-test" value="org.ofbiz.entity.test.EntityTestSuite"/>
        <property name="service-test" value="org.ofbiz.service.test.ServiceEngineTests"/>
        <property name="crm-security" value="com.myofbiz.test.MyTestSuite"/>  <!-- your unit tests -->
        <!--
        <property name="usps-test" value="org.ofbiz.shipment.thirdparty.usps.UspsServicesTests"/>
        <property name="jxunit-test" value="net.sourceforge.jxunit.JXTestCase"/>
        -->
    </container>

Then you would do

 $ ant run-tests

or

 $ java -jar ofbiz.jar -test

Your tests will run alongside the existing OFBIZ test suites.

IMPORTANT: Make sure that the "test" delegator in framework/entity/config/entityengine.xml is set to the right database.