Classes and Methods

A JTestCase XML file can contain the test data for several test classes and test methods therein. The XML is therefore structured in <class> and <method> tags:

<?xml version ="1.0" encoding = "UTF-8"?>
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:noNamespaceSchemaLocation="<URI of jtestcase.xsd>/jtestcase.xsd">
    <class name="class name">
        //.. some other stuff
        <method name="method name">
            <test-case="name_your_test_case_here">
                //.. some other stuff
            </test-case>
        </method>
        //.. other methods
    </class>
    //..other classes
</tests>

As you can see in the example the <class> tag has a name attribute. This contains the class name of your test class (e.g. "MyCodeTest" if your test class is named "MyCodeTest.java").

The <class> tags contain <method> tags which in turn contain <test-case> tags.

Each tag must have and unique name attribute

There may be several <test-case> tags with the different name attribute.
This gives you the possibility to create more than one test case with the same JUnit test method.

Control Parameters

You can define some parameters that controls the behaviour of your test runs. These are independent of any specific test class or method.

<?xml version ="1.0" encoding = "UTF-8"?>
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:noNamespaceSchemaLocation="<URI of jtestcase.xsd>/jtestcase.xsd">
  <params>
    <param_name="variable_name" type="variable_type">variable_value</param>
    //..other control parameters
  </params>
  //.. class tags
</tests>
      

Global Parameters

Global parameters are parameters that you want to use in all test methods of a test class. These parameter can be defined directly inside of the <class> tag:

<class name="class_name">
  <!-- global variables for this class --> 
  <params>
    <param_name="variable_name" type="variable_type">variable_value</param>
    //..other global variables
  </params>
  //.. method tags
</tests>