Browse DevX
Sign up for e-mail newsletters from DevX


jDefend: One Configuration File for All Your Test Scenarios  : Page 3

How would you like to have a test driver that you don't need to recompile every time input parameters change?




Building the Right Environment to Support AI, Machine Learning and Deep Learning

The XML Config File
Your configuration file should now look like TestDriver.xml. The following are all the possible configuration parameters you can set for your own test scenarios:

  • TestDrivers
    <TestDrivers> </TestDrivers>
    Within the context of <TestDrivers>, you can have as many TestDriver classes as you want using the <TestDriver> tag.
  • TestDriver
    <TestDriver Id="1" Class="example.StdMgrTestDriver" Method_Dependency="Yes">
    For a detailed description of the TestDriver attributes, see the TestDriver Attribute Descriptions table.

    TestDriver Attribute Descriptions

    Class Fully qualified name of the TestDriver
    E.g., StdMgrTestDriver
    Id Unique identifier within the scope of <TestDrivers>
    E.g., 1
    Method_dependency If Yes, all the methods listed as part of the TestDriver will be executed sequentially.
    If No, each method will be executed in its own thread.
    E.g., Yes/No

  • Methods
    <Methods> </Methods>
    Within the context of <Methods>, you can list all the methods that are part of the TestDriver class using a <Method> tag.
  • Method
    <Method Name="testAdd" Method_Id="ADD" Participate="YES" Return_Type="boolean">
    For a description of the Method attributes, see the Method Attribute Descriptions table.

    Method Attribute Descriptions

    Name Name of the method in the TestDriver
    E.g., testAdd, testFindStudent, etc.
    Method_Id Unique identifier within the scope of <Methods>
    E.g., ADD, FIND
    Participate If set to YES, the method participates in the test run.
    By default, all methods participate.
    E.g., YES/NO
    Return_Type The return type of the method.
    By default, this value is "void."
    Order Order in which the methods should be executed.
    This will be used when the Method_Dependency flag is set to Yes.
    Number_Of_Threads If you want your method to be run on more than one thread, set the number_of_threads.
    E.g., 1, 2, etc.
    Is_Parent Setting this value to YES makes the method run as a top-level method. You can set up a dependency order between various methods; for example, you can say Method2 should be executed after Method1. In this case, Method1 will be a parent method and Method2 will not.
    By default this value is NO and hence you must set this value to YES if you want the method to participate in the test run (even when there are no dependencies).
    Next_Method_Id Referring to the Is_Parent description above, the Next_Method_Id value for Method1 will be the Method_Id value of Method2. This tells jDefend that Method2 has to be executed after it executes Method1.

  • Arguments
    <Arguments> </Arguments>
    Within the context of <Arguments>, you can list all the arguments that a Method accepts using the <Argument> tag.
  • Argument
    A simple argument (testFindStudent scenario) looks like this:
    <Argument Num="1" Type="String" VALUE="DolphinNose" />
    A complex argument (testAdd scenario) looks like this:
    <Argument Num="1" Type="example.Student" VALUE="CustomType" Id="StudentX" />
    For a description of the Argument attributes, see the Argument Attribute Descriptions table.

    Argument Attribute Descriptions

    Num Indicates the argument order.
    If Num is 1, the method accepts the argument type as the first argument.
    E.g., 1, 2, etc.
    Type Indicates the type of argument.
    This attribute supports all simple data types. For complex data types, this would be a fully qualified class name such as java.util.Vector.
    E.g., String, int, java.util.Vector, Student
    Value Indicates the value to be passed.
    E.g., DolphinNose, for the method testFindStudent.
    If the Type is a user-defined type or complex data type, Value should be set to CustomType.
    Id A unique Id for the given Argument.
    This is required only for CustomTypes.


    Comment and Contribute






    (Maximum characters: 1200). You have 1200 characters left.



    Thanks for your registration, follow us on our social networks to keep up-to-date