Data Subset for XSD Sources
You can create a data subset from XML sources. TDM creates a data subset that contains complete XML objects. The subset operation includes all child elements of any parent element that the subset includes based on the filter criteria.
To create a data subset, apply the subset criteria to one or more elements or attributes in the XSD file and define the scope of the criteria. Criteria determines the filter that you apply to an element or attribute. You can apply one filter for each hierarchy.
The scope determines the level at which you apply the filter. The level at which you apply the criteria affects the outcome of the data subset operation.
After you apply the criteria and define the scope of the criteria, add the XSD file as the subset component to a plan. Generate and run a workflow from the plan. The workflow creates and saves a subset of the source data into the target directory.
Data Subset for XSD Sources Task Flow
To define a data subset, import the XSD files into the project and then apply the criteria and the required scope of the criteria. Create a data subset plan and add the XSD files to the plan. To create the data subset, generate and start a workflow from the plan.
Perform the following high-level tasks to create the data subset:
1. Create a project.
2. Import the XML source definition from the PowerCenter repository.
3. Open the XSD file from within the project and apply the criteria and scope of the criteria to an element or attribute.
4. Create a data subset plan and add the XSD file to the plan. You can add multiple XSD files to a plan. Define parameters to create the data subset. For example, you can choose to format the data in the file, or to create the file with unformatted data.
5. Generate a workflow from the plan.
6. Start the workflow.
7. Monitor the progress of the workflow.
8. In the target file directory, verify that the data subset contains the correct data.
Applying Criteria to an Element or Attribute
Apply subset criteria and specify the scope of the criteria to create a data subset from an XSD source. The scope and criteria determine the output of a data subset operation. You can apply criteria to elements and attributes in an XSD file.
Import the XML source definition from the PowerCenter repository into the project before you apply the criteria.
1. Open a project and click Discover > Files.
A list of XSD files in the project appears.
2. To open the required file in a separate page, select the file.
3. Select the element or attribute on which you want to apply the subset criteria.
4. Click Edit on the Criteria tab of the Details tab.
The Edit Criteria window opens.
5. Select the required operator from the list of operators.
6. Enter the value or set of values for the criteria.
You cannot enter a parameter.
7. Select the scope from the list of options and click OK.
The criteria appears in the Criteria tab. To clear criteria, select Criteria from the list and click the Clear button.
Add the XSD file with the scope and criteria assignment to a plan. Run the plan and workflow to create a data subset with the required data.
Example - Data Subset for XSD Data Sources
A product test team maintains its test data in a master XML file. To test specific features of the product, different test groups require specific test data. Test group A requires data on a specific skill set Java. Test group B requires data on a specific location BLR.
To create different test data files for each test group, the test team uses TDM to create data subsets with the required information.
The master data file contains records of employee and contractor information including name, department, address, office location, and skill set.
The XML source definition file (XSD) defines the structure of the master file and data subset files that you create from the master data file. The XSD file defines the Street, Zip, City, and State elements as child elements of the element Address. The elements Name, Skill, and Address are child elements of the elements Employee and Contractor. Address, Employee, and Contractor are child elements of the element Department.
Ancestor and child relations affect the outcome of a data subset operation.
The following image shows the Criteria tab on the file page in Test Data Manager:
To create a data subset that contains employee information for the skill set Java, apply the criteria to the element Skill on the Employee branch. Select the operator as equals. Enter the value on which to filter the data as JAVA. Define the scope as Employee.
Create and run a plan that includes the XSD file and the criteria and scope of the data subset.
The subset operation applies the filter on the element Employee and includes all employees with skills that match the criterion. The data subset file that the workflow creates contains data on all employees with Java skills. Department is an ancestor element of Employee. The subset therefore includes all departments that have employees with Java skills and all child elements of Departments.
Edit the data subset criteria and then run the plan again to create a data subset with the data that test group B requires. Delete the criteria on the element Skill.
To create a data subset of departments located in BLR, apply the filter criteria to the element City. Select the operator as equals. Enter the value on which to filter the data as BLR. Define the scope as Department.
The subset operation applies the filter on the element City and includes all departments with addresses that have cities that match the criterion. The data subset file that the workflow creates contains data on all departments with the city as BLR. The subset includes all child elements of the element Department.
Example XML Structure Definition
Consider the following XSD structure of the master test data file:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Skill" type="xsd:string"/>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="Street" type="xsd:string"/>
<xsd:element name="State" type="xsd:string"/>
<xsd:element name="City" type="xsd:string"/>
<xsd:element name="Zip" type="xsd:string"/>
<xsd:attribute name="id" type="xsd:integer"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="location" type="xsd:string"/>
<xsd:element name="Address">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Street" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Zip" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="City" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="State" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Employee">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Name" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Address" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Skill" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute ref="id"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Department">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Address" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Employee" minOccurs="1" maxOccurs="unbounded"/>
<xsd:element ref="Contractor" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute ref="name"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Departments">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Department" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute ref="location"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Contractor">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Name" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Address" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="Skill" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute ref="id"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Example Master XML Data
Consider the following master test data file:
?xml version="1.0" encoding="US-ASCII" standalone="no"?>
<Departments location="INDIA" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Department name="QA">
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Employee id="101">
<Name>RAMA</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>SELENIUM</Skill>
</Employee>
<Employee id="102">
<Name>KRISHNA</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>JAVA</Skill>
</Employee>
<Contractor id="901">
<Name>RAMESH</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>TESTING</Skill>
</Contractor>
<Contractor id="902">
<Name>PAVAN</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>JAVA</Skill>
</Contractor>
</Department>
<Department name="DEV">
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Employee id="201">
<Name>ANAY</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>MAPGEN</Skill>
</Employee>
<Contractor id="903">
<Name>AJEET</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>JAVA</Skill>
</Contractor>
</Department>
<Department name="DEVOPS">
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Employee id="301">
<Name>NARAYAN</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>BUILD</Skill>
</Employee>
<Contractor id="904">
<Name>SHILPA</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>BUILD</Skill>
</Contractor>
<Contractor id="905">
<Name>AJEET</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>JAVA</Skill>
</Contractor>
</Department>
<Department name="DBA">
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Employee id="402">
<Name>REKHA</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>SQL_SYBASE</Skill>
</Employee>
<Employee id="402">
<Name>RAMESH</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>ORACLE</Skill>
</Employee>
<Contractor id="907">
<Name>RAMANA</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>JAVA</Skill>
</Contractor>
<Contractor id="906">
<Name>VASU</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>TERADATA</Skill>
</Contractor>
</Department>
<Department name="HR">
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Employee id="501">
<Name>SURENDRA</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>RECRUIT</Skill>
</Employee>
<Contractor id="907">
<Name>LAVANYA</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>RESOURCE</Skill>
</Contractor>
</Department>
</Departments>
Data Subset for Group A
Run the plan the first time with the criteria to create a data subset that meets the requirements of Group A.
The output of the subset operation includes the following data:
<?xml version="1.0" encoding="US-ASCII" standalone="no"?>
<Departments location="INDIA" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Department name="QA">
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Employee id="102">
<Name>KRISHNA</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>JAVA</Skill>
</Employee>
<Contractor id="901">
<Name>RAMESH</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>TESTING</Skill>
</Contractor>
<Contractor id="902">
<Name>PAVAN</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>JAVA</Skill>
</Contractor>
</Department>
</Departments>
Data Subset for Group B
Run the plan again with the criteria to create a data subset that meets the requirements of Group B.
The output of the subset operation includes the following data:
<?xml version="1.0" encoding="US-ASCII" standalone="no"?>
<Departments location="INDIA" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Department name="DEV">
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Employee id="201">
<Name>ANAY</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>MAPGEN</Skill>
</Employee>
<Contractor id="903">
<Name>AJEET</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>JAVA</Skill>
</Contractor>
</Department>
<Department name="DBA">
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Employee id="402">
<Name>REKHA</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>SQL_SYBASE</Skill>
</Employee>
<Employee id="402">
<Name>RAMESH</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>ORACLE</Skill>
</Employee>
<Contractor id="907">
<Name>RAMANA</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>JAVA</Skill>
</Contractor>
<Contractor id="906">
<Name>VASU</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>TERADATA</Skill>
</Contractor>
</Department>
<Department name="HR">
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Employee id="501">
<Name>SURENDRA</Name>
<Address>
<Street>INFA</Street>
<Zip>500030</Zip>
<City>BLR</City>
<State>KARNATAKA</State>
</Address>
<Skill>RECRUIT</Skill>
</Employee>
<Contractor id="907">
<Name>LAVANYA</Name>
<Address>
<Street>VBIT</Street>
<Zip>500081</Zip>
<City>HYD</City>
<State>TELANGANA</State>
</Address>
<Skill>RESOURCE</Skill>
</Contractor>
</Department>
</Departments>