The template function within the mock-jutsu library serves as a versatile blueprinting tool designed to generate complex, structured mock data for modern software development. By allowing users to combine multiple distinct data types—such as full names, identification numbers like TCKN, and formatted phone numbers—into a single coherent record, it effectively bridges the gap between simple random strings and realistic business entities. This capability is essential for developers who need to simulate real-world objects without the privacy risks associated with using production data in non-production environments.
Flexibility is a core pillar of the mock-jutsu architecture, and the template command exemplifies this by supporting multiple output formats, including JSON, CSV, and SQL INSERT statements. Whether you are working within a Python script using the jutsu.generate('template') method, executing quick commands via the CLI, or integrating dynamic values into a JMeter performance test with the custom plugin syntax, the function ensures that your test data remains consistent across different platforms. This multi-format support allows engineering teams to seamlessly populate relational databases, feed NoSQL document stores, or generate realistic payload bodies for RESTful API testing.
Under the hood, the template algorithm leverages a structured mapping system that organizes disparate data generators into a unified, schema-driven record. By following standardized data patterns and localization rules, mock-jutsu ensures that every generated record adheres to the specific formatting requirements of the target system. This level of precision is particularly beneficial in testing scenarios involving data migration, ETL pipeline validation, and microservices orchestration, where the structural integrity of the mock data can directly impact the success of complex integration tests and validation logic.
For developers and QA engineers, the primary benefit of using the template function is the significant reduction in manual data preparation time. Instead of hardcoding static values or writing custom scripts to randomize individual fields, users can define a template once and generate thousands of unique, high-fidelity records instantly. This automation not only accelerates the software development lifecycle but also enhances test coverage by providing a diverse set of inputs that can uncover edge cases in data processing logic. By integrating mock-jutsu into automated CI/CD pipelines, teams can ensure that their staging environments are always equipped with high-quality, reliable test data.
mockjutsu template fullname tckn phone --locale TRmockjutsu template fullname tckn phone --locale DEfrom mockjutsu import jutsujutsu.generate('template', locale='TR')jutsu.bulk('template', count=10, locale='TR')jutsu.template(['template'], count=5, locale='TR')# with --count parameterjutsu.generate('template', count='int', locale='TR')${__mockjutsu(template,TR)}# JMeter Function: __mockjutsu# Parameter 1: template# Parameter 2: locale (TR/UK/US/DE/FR/RU)${__mockjutsu(template,DE)}GET /generate/template?locale=TR# → {"type":"template","result":"...","status":"ok"}GET /bulk/template?count=10&locale=TRPOST /template {"types":["template"],"count":1,"locale":"TR"}| Parameter | Values | Description |
|---|---|---|
| --locale | TR|UK|US|DE|FR|RU | Region / locale for locale-aware output |
| --count | int | Number of records to generate (default: 10) |
| --format | json|csv|sql | Color output format (default: hex) |
| --table | string | SQL table name for INSERT statements (default: records) |