The age function is a vital component of the Demographic category within the mock-jutsu library, designed to provide developers with realistic, randomised human ages. When building applications that require user profiles or statistical simulations, having access to authentic mock data is essential. This function generates an integer typically ranging between 18 and 90, reflecting the standard adult demographic most software systems target. By integrating this tool, engineers can quickly populate databases with diverse age values without the privacy risks associated with using real-world sensitive information or personally identifiable data.
Under the bonnet, the algorithm ensures a uniform distribution across the specified range, providing a balanced spread of values that mimic a standard adult population. This approach to generating test data adheres to common demographic modelling practices, ensuring that the output remains within the bounds of biological and legal plausibility. Whether you are invoking the command via the CLI with "mockjutsu generate age" or embedding it directly into a Python script using "jutsu.generate('age')", the consistency of the output ensures your datasets remain robust and reliable throughout the entire development lifecycle.
This function is particularly beneficial for testing scenarios involving age-restricted access, insurance premium calculations, or pension eligibility logic. For instance, QA engineers can use mock-jutsu to verify that a web form correctly handles different age inputs or that a backend service accurately categorises users into specific cohorts for marketing analytics. Furthermore, the JMeter integration—using the syntax ${__mockjutsu(age,)}—allows performance testers to simulate high-concurrency traffic with unique age attributes for every virtual user, uncovering potential edge cases in data processing or business logic that might otherwise go unnoticed during manual checks.
The primary benefit of using mock-jutsu for age generation is the significant reduction in manual data preparation time. Instead of hard-coding static values or writing custom randomisation scripts, developers can leverage a standardised, well-documented tool that fits seamlessly into existing CI/CD pipelines. This not only improves the quality of the test data but also fosters a more agile development environment where realistic datasets are available on demand. By automating the creation of demographic attributes, teams can focus on refining core application features while maintaining high standards of data integrity and privacy compliance.
mockjutsu generate agemockjutsu bulk age --count 10mockjutsu export age --count 10 --format jsonmockjutsu export age --count 10 --format csvmockjutsu export age --count 10 --format sqlmockjutsu generate age --min int# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate age --maskmockjutsu bulk age --count 5 --maskfrom mockjutsu import jutsujutsu.generate('age')jutsu.bulk('age', count=10)jutsu.template(['age'], count=5)# with --min parameterjutsu.generate('age', min='int')# mask=True: regulation-compliant outputjutsu.generate('age', mask=True)jutsu.bulk('age', count=5, mask=True)${__mockjutsu_identity(age)}${__mockjutsu_identity(age:18-35)}# JMeter Function: __mockjutsu_identity# Parameter 1: age OR age:# Qualifier values: min-max (int)# Parameter 2: (not required for this function)# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_identity(age,mask)}GET /generate/age# → {"type":"age","result":"...","status":"ok"}GET /bulk/age?count=10POST /template {"types":["age"],"count":1}# mask=true: regulation-compliant outputGET /generate/age?mask=trueGET /bulk/age?count=5&mask=true| Parameter | Values | Description |
|---|---|---|
| --min | int | Minimum numeric value |
| --max | int | Maximum numeric value |
| --mask | true | false | Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…) |