Testing JLense Applications and Developing a JLense Test Case

The JLense org.jlense.test plugin provides a basic framework for running JUnit test cases.

JUnit is a toolkit for building and running tests. When testing some unit of code that will eventually be deployed in the JLense platform it is important that the code be tested inside the JLense runtime environment. This is so that the tests will be executed in the same runtime environment as they wil eventually run. For instance, class loading is one of the biggest sources of problems for developers that are new to the JLense environment, and class loading problems will only be detected if tests are run inside Eclipse.

The org.jlense.test plugin provides support for running tests in two ways:

  • It declares an application, org.jlense.test.TestRunner, for running tests.
    That is, the org.jlense.test plugin declares an application with an id of org.jlense.test.TestRunner. This application is run just as any other JLense application is run. If no command line arguments are supplied to this application when it is run then all registered test cases are run otherwise the id of a specific testcase may be given and just that test case is run.
  • It declares an extension point, org.jlense.test.testCases, that plugins may use to declare test cases.

The org.jledger.ui plugin contains several test cases that you can use as an example of how to creeate your own test cases. Below are the org.jlense.test.testCases extension declarations from the org.jledger.ui/plugin.xml file:

    <extension id="AccountTest" point="org.jlense.test.testCases">
       <test    name="AccountTest" 
    <extension id="ChartOfAccountsTest" point="org.jlense.test.testCases">
       <test    name="ChartOfAccountsTest" 
    <extension id="AccountTriggerTest" point="org.jlense.test.testCases">
       <test    name="AccountTriggerTest" 
    <extension id="AccountNotificationTest" point="org.jlense.test.testCases">
       <test    name="AccountNotificationTest"