RUNID - File Generator - Version 1.0.0
Overview
RUNID - File Generator is a C# console application designed to automate the generation of XML files based on customizable templates and rules. This tool is perfect for creating large sets of XML data for testing middleware, APIs, or other systems that require bulk XML input.
Features
- Template-Based XML Generation: Define your XML structure using a template with placeholders for dynamic data.
- Customizable Data Generation Rules: Use a JSON setup file to specify how each placeholder in the template should be populated, including options for random integers, dates, numbers, text, and data from external files.
- Dynamic Filename Convention: Customize the naming convention for generated files with placeholders for the current date, time, and sequence numbers.
- Random Data Generation: Generate random delivery numbers, quantities, batch numbers, and other types of data.
- External Data Integration: Seamlessly integrate data from external files to ensure consistency in related fields.
- Flexible Date Generation: Generate past, future, or any dates with optional custom ranges for more realistic data.
- Decimal Number Generation: Generate random decimal numbers with customizable ranges and precision.
Setup and Usage
- Define Your Template: Create an XML template file (
template.xml) with placeholders for dynamic data. - Create Setup File: Define a JSON setup file (
setup.json) to specify the rules for data generation. - Run the Application: Use the console application to generate the specified number of XML files based on your template and rules.
Example
template.xml
<InboundDelivery>
<DeliveryNumber>{DeliveryNumber}</DeliveryNumber>
<DeliveryDate>{DeliveryDate}</DeliveryDate>
<PaymentDate>{PaymentDate}</PaymentDate>
<Total>{Price}</Total>
<Items>
<Item>
<Material>{MaterialNumber}</Material>
<Description>{MaterialDescription}</Description>
<BatchNumber>{BatchNumber}</BatchNumber>
<ManufactureDate>{RandomPastDate}</ManufactureDate>
<ExpirationDate>{RandomFutureDate}</ExpirationDate>
<Quantity>{Quantity}</Quantity>
</Item>
<Item>
<Material>{MaterialNumber2}</Material>
<Description>{MaterialDescription2}</Description>
<BatchNumber>{BatchNumber2}</BatchNumber>
<ManufactureDate>{BatchCreationDate}</ManufactureDate>
<ExpirationDate>{BatchExpiryDate}</ExpirationDate>
<Quantity>{Quantity2}</Quantity>
</Item>
</Items>
</InboundDelivery>setup..json
{
"rules": {
"DeliveryNumber": "random[deliveryNumber]",
"DeliveryDate": "random[date:past:2]",
"Quantity": "random[quantity]",
"Quantity2": "random[quantity]",
"Description": "random[text]",
"MaterialNumber": "file[materials:0]",
"MaterialDescription": "file[materials:1]",
"MaterialNumber2": "file[materials2:0]",
"MaterialDescription2": "file[materials2:1]",
"BatchNumber": "file[batches:0]",
"BatchNumber2": "file[batches2:0]",
"BatchCreationDate": "file[batches:1]",
"BatchExpiryDate": "file[batches:2]",
"PaymentDate": "random[date:any:30]",
"Price": "random[decimal:10,1000,2]",
"RandomPastDate": "random[date:past:180]",
"RandomFutureDate": "random[date:future:720]"
},
"name_convention": "sap_to_1wxp-IDB-{date}_{time}_{sequence}.xml",
"date_format": "yyyyMMdd",
"time_format": "HHmmss"
}