Adempiere Junit test
From ADempiere
This Wiki is read-only for reference purposes to avoid broken links.
Contents
Adempiere Junit test
Test Junit and make it work. Adempiere Junit test code is here: http://adempiere.svn.sourceforge.net/viewvc/adempiere/trunk/extend/src/test/
Adempiere Junit test code
the codes in functional extend class AdempiereTestCase.and class AdempiereTestCase extends TestCase.
Junit test
- First import adempiereTrunk source code into eclipse,build it.
Test
- The source codes of them at project adempiereTrunk -> extend/src -> test,test.functional,test.functional.inventory and test.performance.
- The compiled codes at adempiereTrunk -> extend -> build -> test
Test example
- Open test.functional -> AlertTest.java
- Right click it, select Run As -> JUnit Test,we will get information like follow at the console.
- And pop up a window let you select "test.properties" file.
- If we did not appoint test.properties file,the test will fail.
Review the failure Trace
- Then use the "test.properties" file, and test again.
- Edit "test.properties",you can see the template file at http://adempiere.svn.sourceforge.net/viewvc/adempiere/trunk/extend/test.properties.template or adempiere_sourcecode_home/extend directory
# cp test.properties.template test.properties
Edit it like this:
# nano test.properties
- Save it to AdempiereProperties as the properties file when you installed adempiere.
Note: Here you can put "test.properties" file to directory adempiere_Home/,codes will find it automatically when testing.
Test again
right click test.functional -> AlertTest.java,select Run As -> JUnit Test
appoint the "test.properties" file,hit the open button.
- We will see the informations at console and the test result with 0 errors.
Functional Test Suite
There is a class test.functional -> FunctionalTestSuite.java, a test suite for most of classes in test.functional.
FunctionalTestSuite.java
- run it as JUnit.
The result
All tests successful
- For classes such as AlertTest, MInvoiceTest,MMatchInvTest, MProductTest, MSessionTest, PackOutTest, WorkflowTest that are not in the test suite, we can add them to FunctionalTestSuite.java
Example add class AlertTest
suite.addTestSuite(AlertTest.class);
- If you want to run all tests in adempiere.right click project adempiereTrunk -> Run,and select it as follow.
- Then hit run button.