Unit Testing - innoventsolutions/birt-functions-lib GitHub Wiki
All unit tests can be found in the test-src folder in the eclipse project.
Mocked Unit Tests
The following unit tests can be run from within the eclipse environment with no preparation:
- AppendLibraryContentTest
- BirtLoggerTest
- CoalesceTest
- ConcatenateUniqueTest
- CountUniqueTest
- TextWrapTest
- ThrowExeptionTest
These tests use Mockito to simulate the BIRT runtime environment. To run one of these tests from within the eclipse environment, right-click on the java file, choose run-as and then junit test.
Report Engine Unit Tests
The following tests cannot use Mockito so instead they start up a BIRT engine, run a test report, and then check the output.
- BindParametersTest
- ConvertFiltersTest
- DisplayParametersTest
- SetChartPaletteTest
- WhereClauseBindingTest
In order for this to work you will need to give each of them the proper classpath. Set up a run configuration as follows:
- Export birt.functions.lib as a deployable plug-in to a directory of your choice.
- In Run or Debug configurations, add a new JUnit test and make the test class innovent.birt.text.BindParametersTest.
- In the classpath tab click on User Entries and Add External JAR.
- Add the plug-in jar you created in step 1.
- From the 4.5.0 BIRT runtime library, add org.eclipse.birt.runtime_4.5.0.jar, org.w3c.css.sac_1.3.1.v200903091627.jar, org.eclipse.datatools.connectivity_1.2.11.v201401230755.jar, flute.jar, derby.jar, and all org.apache.batik.*.jar.
- Click run or debug.