IRI Blog Articles

Diving Deeper into Data Management



Post image for How to Create Test XML Files

How to Create Test XML Files

by Chaitali Mitra

XML is a popular file format because of its value in data interchange. For this reason, XML test data generation can be an important part of the Software Development Life Cycle (SDLC), particularly for those applications which need to process XML data. In this article, we demonstrate how the IRI RowGen product (or the IRI Voracity data management platform which includes RowGen) can be used to create test files or any size in flat XML format.

Because production-quality test data can be complex, most data generators cannot produce the variety or volume of data required to stress-test applications, prototype operations, or benchmark new platforms. IRI RowGen rapidly creates very large database (VLDB), file, and report targets using a self-documenting 4GL and familiar GUI, built on Eclipse™ called IRI Workbench. RowGen can generate test XML files containing random values and randomly selected real values from set files for more realism. Refer to this article for more details about test data realism.

The RowGen job control language (.RCL) job script defining the target layout contains the /PROCESS=XML specification on output so records are generated within XML tags. The XML attribute and tag names are specified in an XDEF attribute for each /FIELD statement to define the XML data elements.

Step 1. Plan the Job

In this example, we know our table will contain these fields:

Employee_Id_ID,Employee_Name,Employee_Domain,Phone_Number, Address, State, Company_Name.

For each field, RowGen can either generate values from scratch in the data type and size you specify, or randomly select data from set files for more realism. Set files contain lists of one or more field values, separated by tab characters. IRI provides a few of these files, and you can create your own. There are several wizards in the Workbench that you can use to generate set files, including one that creates set files from DB columns. In this example I used the RowGen supplied files: addresses.set, names_first_last.set, phones_us.set, companynames.set, state_city.set

Step 2. Create the Job

  1. Create a New Project => Highlight the project and from the top (toolbar) RowGen Menu, Select “Select New Custom Test Data Job”
  2. Give your job a filename with an .rcl extension and click Next

All the metadata on your job can be saved here as comments in the script which you can search.

Step 3. Define the Generation

Next comes the Test Data Definition Screen where you define the “input” or generation section of the job. Specify a dummy filename and click on the Layout Fields button.

You can reuse this named “file” and its layouts to generate other targets in the future.

The “Layout Fields” dialog is next. By right-clicking on the Grid, select “Add Field.” Double-clicking the field will display the Generation Field Wizard.

Select the Set File, enter the Fieldname and other information, and Click OK, as shown:

Step 4. Format the Target

Next you will be provided with the Data Target screen, and this is where you define and layout your test files, databases, or even reports, by mapping the generated fields from the inputs to your output(s). Click on Add Data Target button, enter the filename “data.xml” and click OK, and then select the Finish button.

Once you click the OK button the output file “data.xml” in the Data Target screen, you have the option to select Target Field Layout button on the Data Targets screen.

In the output field layout edit, you can preview and modify the test target(s) visually:

Step 5. Review and Run the Job Script

When you complete the job wizard, the .RCL script is created. It will open automatically in the  GUI’s syntax-aware editing window, along with a dynamic outline.

You can modify the job in the editor, from the outline, dialogs that open with a right click in the editor, or by hand outside the GUI in notepad, etc. Run your job in the IRI Workbench or on the command line, or in batch scripts or other applications where you need to generate data before other steps occur.

Step 6. Review and Use Your Results

The screen below shows the test file in XML format.

Representation of the code in the Transform Mapping Diagram

The IRI Workbench also supports E-R and transform mapping diagrams, as well as work flows using Sirius graphics.

Again, XML is only one possible test file target format you can create with IRI RowGen. Others include COBOL (multiple), CSV, FIXED, LDIF, Line/Record/Variable Sequential, and TXT. See additional articles in this section of the blog for other output examples, including databases and feeding other tools with test data.

Ask your IRI representative about producing custom report targets with test data inside, as well as free sample test sets you can use for random lookups in your test environment. If you’re interested in the general topic, join the IRI Test Data Management group on LinkedIn.

Print Friendly

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: