Jeté Sample: SystemTest

Home Overview
The class org.jete.SystemTest is the entry point to the
Jeté system testing framework.  In the samples, this class is referenced as a JUnit test via Ant's junit extension.  This is currently run as a normal TestSuite, but more configurability is expected.  The SystemTest is configured via the sampleSystemTests/SystemTest.xml file (which must be in the classpath).

SystemTest.xml
The top level bean to be configured in the SystemTest.xml file is the SystemTest bean.  This bean is configured with a test suite name and a collection of testcases that make up the suite.  

    <bean id="SystemTest" class="org.jete.SystemTest">
        <property name="name">
            <value>sampleSuite</value>
        </property>
        <property name="testCases">
            <list>
                <ref bean="subfile.tests"/>
                <ref bean="method.invocation.tests"/>
                <ref bean="db.tests"/>
            </list>
        </property>
    </bean>

TestCases

The test cases are instances of ContextFileTestCase, which defines another file that includes the testcases used for testing.  In this way overall system test case management is achieved, by moving the test definition files into appropriate sub directories where tests may be added to these files (or other test files).

There are 3 tests defined:
- fileTest1 specifies test cases in another file to run a couple of web tests pooled
- methodTest1 specifies test cases in another file to invoke an object method
- dbTest1 specifies test cases in another file to load and retrieve data from a database

The methodTest1 and dbTest1 tests also remove the Spring loaded context objects when complete, as specified by setting the "removeContext" property to true.

    <bean id="fileTest1" class="org.jete.cases.ContextFileTestCase">
        <property name="contextFile">
            <value>subtests/SubTest.xml</value>
        </property>
        <property name="pooledExecutor">
            <ref bean="threadPool"/>
        </property>
        <property name="poolShutdownWaitTime">
            <value>20000</value>
        </property>
    </bean>

    <bean id="methodTest1" class="org.jete.cases.ContextFileTestCase">
        <property name="contextFile">
            <value>subtests/MethodTest.xml</value>
        </property>
        <property name="removeContext">
            <value>true</value>
        </property>
    </bean>

    <bean id="dbTest1" class="org.jete.cases.ContextFileTestCase">
        <property name="contextFile">
            <value>subtests/DBTest.xml</value>
        </property>
        <property name="removeContext">
            <value>true</value>
        </property>
    </bean>
ThreadPool
The ContextFileTestCase is an extension of the MultiTestCase, and as such a thread pool may be used to run tests in parallel without using up resources.  One common thread pool is defined in the SystemTest.xml context file, for use by the various test cases.
    <bean id="threadPool" class="EDU.oswego.cs.dl.util.concurrent.PooledExecutor">
        <constructor-arg><ref bean="queueChannel"/></constructor-arg>
        <constructor-arg value="100"/>
        <property name="minimumPoolSize" value="10"/>
        <property name="keepAliveTime" value="300000"/>
    </bean>
    <bean id="queueChannel" class="EDU.oswego.cs.dl.util.concurrent.LinkedQueue"/>
hosted by SourceForge Logo