utrIdentity

Mock Jutsu HOW-TO | UK

The utr function within the mock-jutsu library is a specialised identity generator designed to produce realistic UK Unique Taxpayer References. In the realm of British taxation and financial services, a UTR is a critical ten-digit identifier assigned by HM Revenue and Customs (HMRC) to individuals and organisations. When developing or testing financial software, using authentic-looking mock data is essential to ensure that validation logic and database schemas function as intended without compromising sensitive personal information or violating data privacy regulations.

Every value generated by the mock-jutsu utr function adheres strictly to the official format, which consists of ten numerical digits. Crucially, the library implements the Modulo 11 checksum algorithm, the same mathematical standard used by UK government systems to verify the validity of a taxpayer reference. By incorporating this check, mock-jutsu ensures that the test data produced will pass through front-end validation scripts and back-end integrity checks that are programmed to reject incorrectly formatted strings. This level of precision is vital for developers who need to simulate realistic data entry scenarios and ensure their systems are resilient against invalid inputs.

Integrating this functionality into your workflow is remarkably straightforward, whether you are working in a local development environment or a continuous integration pipeline. Developers can generate a UTR via the command line using the simple command mockjutsu generate utr, or programmatically within a Python script using the call jutsu.generate('utr'). Furthermore, for performance and load testing, the library provides a dedicated JMeter function, ${__mockjutsu(utr,)}, allowing testers to populate large-scale stress tests with valid, unique identifiers that mirror real-world traffic patterns.

The primary benefit of using mock-jutsu for UTR generation is the ability to conduct robust testing across various scenarios, such as self-assessment portals, payroll systems, and fintech applications. Instead of relying on static or repetitive test data, which can lead to biased results where tests pass only under specific, narrow conditions, our library provides a diverse range of valid outputs. This helps in identifying edge cases in data processing and ensures that your application remains compliant with UK financial data standards. By automating the creation of these identifiers, engineering teams can significantly reduce the time spent on manual data preparation while maintaining high standards of software quality.

CLI Usage
mockjutsu generate utrmockjutsu bulk utr --count 10mockjutsu export utr --count 10 --format jsonmockjutsu export utr --count 10 --format csvmockjutsu export utr --count 10 --format sql# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate utr --maskmockjutsu bulk utr --count 5 --mask
Python API
from mockjutsu import jutsujutsu.generate('utr')jutsu.bulk('utr', count=10)jutsu.template(['utr'], count=5)# mask=True: regulation-compliant outputjutsu.generate('utr', mask=True)jutsu.bulk('utr', count=5, mask=True)
JMeter
${__mockjutsu_identity(utr)}# JMeter Function: __mockjutsu_identity# Parameter 1: utr# Parameter 2: (not required for this function)# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_identity(utr,mask)}
REST API
GET /generate/utr# → {"type":"utr","result":"...","status":"ok"}GET /bulk/utr?count=10POST /template {"types":["utr"],"count":1}# mask=true: regulation-compliant outputGET /generate/utr?mask=trueGET /bulk/utr?count=5&mask=true

Parameters

Parameter Values Description
--mask true | false Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…)

Other Languages