phone_countryContactLocale Aware

Mock Jutsu HOW-TO | EN

In the landscape of modern software development, generating realistic mock data is crucial for building robust international applications. The phone_country function within the mock-jutsu library serves as a specialized tool for developers who need to simulate international telephone country dial codes with high precision. Whether you are building a global registration form or testing localized notification services, this function provides the necessary variety to ensure your application handles global inputs correctly. By using mock-jutsu, engineering teams can move away from static, repetitive strings and embrace dynamic test data that accurately reflects real-world communication standards.

The phone_country function operates by generating dial codes compliant with recognized international standards, such as those defined in the ITU-T E.164 recommendation. When invoked, it returns formatted values like +1 for the United States, +44 for the United Kingdom, or +90 for Turkey. This versatility is accessible through multiple interfaces to fit any workflow: developers can utilize the Python API with jutsu.generate('phone_country'), trigger it via the command line using mockjutsu generate phone_country, or even integrate it into performance testing suites using the JMeter syntax ${__mockjutsu(phone_country,)}. This multi-platform support ensures that high-quality test data is available at every stage of the development lifecycle, from initial unit testing to complex load analysis.

Testing scenarios for phone_country are extensive, particularly in fields like e-commerce, telecommunications, and fintech. It is an essential component for validating input masks, testing SMS gateway integrations, and ensuring that backend databases correctly parse and store international prefixes. By incorporating diverse mock data into your CI/CD pipelines, you can proactively identify edge cases where specific dial codes might break string manipulation logic or cause validation errors. Furthermore, using mock-jutsu helps developers avoid the common pitfall of hardcoding values, which often leads to narrow testing scopes and missed bugs in production environments.

Ultimately, the primary benefit of the phone_country function is the efficiency and reliability it brings to the development process. Instead of manually maintaining exhaustive lists of international codes, developers can rely on mock-jutsu to provide accurate and randomized data on demand. This automation significantly reduces technical debt and allows engineers to focus on core application logic rather than tedious data preparation. By leveraging this function, your team ensures that the contact information components of your software are battle-tested against a global dataset, leading to a more seamless and professional user experience for an international audience.

CLI Usage
mockjutsu generate phone_country --locale TRmockjutsu generate phone_country --locale DEmockjutsu bulk phone_country --count 10 --locale TRmockjutsu export phone_country --count 10 --format json --locale TRmockjutsu export phone_country --count 10 --format csv --locale TRmockjutsu export phone_country --count 10 --format sql --locale TR# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate phone_country --locale TR --maskmockjutsu bulk phone_country --count 5 --locale TR --mask
Python API
from mockjutsu import jutsujutsu.generate('phone_country', locale='TR')jutsu.bulk('phone_country', count=10, locale='TR')jutsu.template(['phone_country'], count=5, locale='TR')# mask=True: regulation-compliant outputjutsu.generate('phone_country', locale='TR', mask=True)jutsu.bulk('phone_country', count=5, locale='TR', mask=True)
JMeter
${__mockjutsu_comm(phone_country,TR)}# JMeter Function: __mockjutsu_comm# Parameter 1: phone_country# Parameter 2: locale (TR/UK/US/DE/FR/RU)${__mockjutsu_comm(phone_country,DE)}# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_comm(phone_country,TR,mask)}
REST API
GET /generate/phone_country?locale=TR# → {"type":"phone_country","result":"...","status":"ok"}GET /bulk/phone_country?count=10&locale=TRPOST /template {"types":["phone_country"],"count":1,"locale":"TR"}# mask=true: regulation-compliant outputGET /generate/phone_country?locale=TR&mask=trueGET /bulk/phone_country?count=5&locale=TR&mask=true

Parameters

Parameter Values Description
--locale TR|UK|US|DE|FR|RU Region / locale for locale-aware output
--mask true | false Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…)

Other Languages