Grouping of test cases in Japex


I mentioned to Santiago that it would be useful to group test cases in Japex so that they could share common parameters instead of having to repeat common parameters per test case. A day later he implemented it!

So now you can do the following (which is an actual fragment from a real test case we use for measuring XML and JAXB performance):

<testCaseGroup>
    <!-- This param applies to all test cases in this group -->
    <param name="contextPath" value="com.sun.xmltest.genjaxb"/>    

    

    <testCase name="inv5K.xml">
        <param name="japex.inputFile"
            value="data/Invoice/instance/inv1.xml"/>
    </testCase>
    <testCase name="inv13K.xml">
        <param name="japex.inputFile"
            value="data/Invoice/instance/inv10.xml"/>
    </testCase>
    <testCase name="inv96K.xml">
        <param name="japex.inputFile"
            value="data/Invoice/instance/inv100.xml"/>
    </testCase>
</testCaseGroup>

Before being able to group tests it was necessary set the contextPath parameter on each test case (this parameter is passed to a JAXBContext).

On the subject of reuse a useful tip when using Japex is to separate the test cases from the configuration file (with the drivers) by using entities. The following is an example Japex configuration file used by the XMLStreamBuffer project (see here) for measuring the performance of creating a buffer compared to creating a DOM:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project [
<!ENTITY testCases SYSTEM "testcases.xml">
]>
<testSuite name="parse" xmlns="http://www.sun.com/japex/testSuite">

    <param name="japex.warmupTime" value="5"/>
    <param name="japex.runTime" value="5"/>
    <param name="japex.resultUnit" value="ms"/>

    <driver name="XercesJAXPSAXDriver" normal="true">
        <param name="japex.driverClass"
            value="com.sun.japex.jdsl.xml.parsing.sax.XercesJAXPSAXDriver"/>
        <param name="jdsl.doNotReportSize" value="true"/>
    </driver>
    <driver name="JAXPSAXParserCreatorDriver">
        <param name="japex.driverClass"
            value="com.sun.xml.stream.buffer.japex.SAXParserCreatorDriver"/>
    </driver>
    <driver name="XercesJAXPDOMParser">
        <param name="japex.driverClass"
            value="com.sun.japex.jdsl.xml.parsing.dom.XercesJAXPDOMDriver"/>
        <param name="jdsl.deferNodeExpansion" value="false"/>
        <param name="jdsl.doNotReportSize" value="true"/>
    </driver>

&testCases;

</testSuite>

When the XML document is parsed the parser will substitute &testCases for the contents of the file testcases.xml.

In fact now that test groups are supported Japex is much more friendly to such composibility using XML Include.
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

sandoz

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today