Executing XML one after another

  • Mayura


    In our test design, one xml corresponds to one testcase element. As one test case itself is so huge that, having multiple testcase element in one xml becomes unmanagable.

    Is there anyway in stax that we can select multiple xml files to get executed one after another?

    one way we know is creating sub-jobs in master xml and corresposing xmls will be called as defined. But we were looking for even more flexible option wherein we have the liberty of selecting the order of xml.

    Please suggest if there is any way to do it.


  • Sharon Lucas
    Sharon Lucas

    Sure, there are many different ways you could do this.

    You could define the xml files (and any corresponding arguments as needed) in a separate .py file that you can input to your master STAX job via a SCRIPT argument (on a STAX EXECUTE request) or via the Script tab if submitting the master STAX job via the STAX Monitor.  For example, you could have this file contain a Python file named tests.py and edit this file before running the STAX job so that it contains a Python list of the files you want to run in the order you want to run them.  For example:

    Or, if you didn't want to define the tests via a separate file, you could enter this list as an argument to your master STAX job..

    Then your master STAX job can use an <iterate> element to iterate through this list to run each test sequentially in the order specified, using a <job> element to run each test if you wanted to run each test as a separate STAX job.

    Or, instead of using sub-jobs, you could import the functions in your xml files (assuming you used unique function names) using the <function-import> element in your master STAX job.  You could input an argument containing a list of the functions to be called in the order you want them run - or using a script or script file to specify this list - to your master STAX job.  Then your master STAX job can use the <iterate> element to iterate though this list of functions and call each function so that each function will be run sequentially in the order specified by your input function list.  For example:

    <iterate var="functionName" in="functionList">
        <call function="functionName"/>

    This would run all the tests in a single STAX job.

  • Mayura

    Thank you so much! This would surely help us.