Setting the class path for automated tests on solutions

If you plan to run your test cases often by using a testing framework, you must include the required Java™ archive (JAR) files and libraries in your class path.

About this task

You can run JUnit tests from outside of Insight Designer by including the test driver JAR files in the <InstallDir>/runtime/ia/testdriver directory and the libraries that you need to run your tests in your class path.

To run your tests in Ant, for example, integrate JUnit testing into an Ant build script, define a class path variable, and call your <junit> tasks.

Procedure

  1. Create a test case that can run in Java. Test cases can call test artifacts, such as entity loaders, event sequences, and test scenarios. For more information about setting up tests cases in Java or in test artifacts, see the topics under Creating automated test cases.
  2. In your build.xml file, add a definition for your test class path and include the JAR files in the <InstallDir>/runtime/ia/testdriver directory. For example:
    <!-- Set variables -->
       <property name="dsi.home" location="c:\dsi" /> 
    
    <!-- Build the CLASSPATH --> 
       <path id="classpath.test" >  
       <fileset dir="${dsi.home}"
          includes="runtime/ia/testdriver/*jar"/> 
       </path>
  3. Add a target that runs your test cases. For example:
    <!--   
    Execute Unit Tests  
    -->
    <target name="test" >  
       <junit printsummary="yes" fork="no" haltonfailure="yes" >   
       <classpath refid="classpath.test" / >   
       <formatter type="xml" / >   
       <test name="com.example.unittest.TestScenario" />  
       </junit> 
    </target>