Running JUnit Tests Standalone
You can run the Pentaho JUnit tests without an application server. We use a standalone context and session to start the required engines in the server, and then each JUnit test exercises its individual feature or function, without the complications of an application server.
You will need to make a few configuration file changes in order for this to work. Follow the instructions given below. I have based these instructions on running JUnit tests through the Eclipse IDE, but there is no reason why they shouldn't work for other development environments just as well.
Requirements
In order to run the JUnit tests for the Pentaho BI Server, you will need to have at least three projects from our SVN repository: the pentaho project, the pentaho-data project and a pentaho-solutions project. You can find instructions on how to get Pentaho projects from SVN here.
You do not need Eclipse or a Java SDK to follow the setup instructions for running the JUnit tests, but in order to actually run them, you will need the Java SDK, and some sort of Java development environment. You can read about the Eclipse setup that the Pentaho team uses here.
Necessary Tweaks to the Server
In order to run the server standalone, there are a number of "tweaks" we need to perform to align things just right, and exclude those components (like security) that are not necessary during a JUnit test run.
1. Modify TestSettings.java
First we need to hardcode the location of our solution project in the TestSetttings.java file. If we were running the server in a web container, it is smart enough to recursively search the directory hierarchy to locate the "pentaho-solutions" directory (or alternately check the web.xml file). Standalone, we are not quite as clever.
You can find this file in pentaho_project/server/pentaho/test/org/pentaho/test/TestSettings.java.
Change the value of the DEFAULT_SOLUTION_PATH field to point to the root of your pentaho-solutions project. Note that this must be an absolute path. For example, my DEFAULT_SOLUTION_PATH value is e:/workspace_1.6/pentaho-solutions.
Change the value of the DEFAULT_LIB_PATH field to point to the third-party/lib directory in your pentaho project. Note that this must be an absolute path. For example, my DEFAULT_LIB_PATH value is e:/workspace_1.6/pentaho/third-party/lib.