template

Mock Jutsu HOW-TO | UK

The template function within the mock-jutsu library serves as a sophisticated orchestrator designed to streamline the creation of complex, structured records. By acting as a central command for data synthesis, this function allows developers to combine disparate data types—such as names, national identity numbers like the TCKN, and localised phone numbers—into a single, cohesive unit. Whether you are building a prototype or populating a staging environment, the template command ensures that your mock data remains consistent across various output formats, including JSON objects, CSV rows, and SQL INSERT statements. This versatility makes it an indispensable tool for modern software development lifecycles where data structure is as critical as the data itself.

Technically, the template function leverages a modular mapping algorithm that synchronises multiple generator engines to produce high-fidelity test data. When a user defines a schema, mock-jutsu intelligently maps each field to its corresponding generation logic, ensuring that the resulting record adheres to industry-standard formatting. For instance, generating a user profile requires the library to balance string formatting for names with strict numerical validation for identification numbers. This standardised approach ensures that the output is not just random noise, but a realistic representation of production data that can be used to validate database constraints and API contract requirements without compromising sensitive information.

In practical testing scenarios, the template function excels at facilitating end-to-end integration tests and performance benchmarking. Developers can utilise the Python interface for unit testing or the CLI for rapid prototyping, while QA engineers can leverage the JMeter integration to inject dynamic mock data into load testing scripts. This cross-platform compatibility ensures that the same data logic used during initial development is preserved through to the final testing phases. By using a unified template, teams can avoid the common pitfalls of manual data entry, such as formatting errors or unrealistic data distributions that fail to trigger edge cases in the application logic.

The primary benefit of adopting the mock-jutsu template command is the significant reduction in time-to-market and the improvement in overall software quality. By automating the generation of structured test data, developers can focus on refining core features rather than managing cumbersome datasets. The ability to switch seamlessly between JSON, CSV, and SQL outputs provides the flexibility needed to support diverse tech stacks, from NoSQL document stores to traditional relational databases. Ultimately, this function empowers teams to build more resilient applications by providing a reliable, scalable, and highly customisable source of synthetic data.

CLI Usage
mockjutsu template fullname tckn phone --locale TRmockjutsu template fullname tckn phone --locale DE
Python API
from 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')
JMeter
${__mockjutsu(template,TR)}# JMeter Function: __mockjutsu# Parameter 1: template# Parameter 2: locale (TR/UK/US/DE/FR/RU)${__mockjutsu(template,DE)}
REST API
GET /generate/template?locale=TR# → {"type":"template","result":"...","status":"ok"}GET /bulk/template?count=10&locale=TRPOST /template {"types":["template"],"count":1,"locale":"TR"}

Parameters

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)

Other Languages