The es_nie function is a specialized utility within the mock-jutsu library designed to generate realistic Spanish Foreigner Identity Numbers, commonly known as the Número de Identidad de Extranjero. For developers building international applications, generating high-quality mock data is essential for validating user input fields and maintaining database integrity during the early stages of development. This function ensures that every generated identifier adheres to the strict formatting rules required by Spanish administrative systems, allowing development teams to simulate real-world user profiles without compromising privacy or relying on sensitive production information.
Technically, the es_nie generator produces a string that follows a precise structural format: a starting letter of X, Y, or Z, followed by seven numeric digits and a final MOD-23 control character. The algorithm employed by mock-jutsu correctly maps the initial prefix to a numeric value—assigning 0 to X, 1 to Y, and 2 to Z—before performing the mathematical division required to determine the valid check letter. By automating this complex checksum calculation, the library provides reliable test data that will pass through rigorous front-end validation scripts and back-end verification logic without any manual intervention from the engineer.
This function is highly effective for testing scenarios involving financial services, residency applications, or e-commerce platforms targeting the Iberian market. Quality assurance engineers can leverage these identifiers to verify that registration forms correctly handle foreign identity formats and that data processing pipelines accurately store these unique strings. Whether you are performing high-concurrency load testing in JMeter using the ${__mockjutsu(es_nie,)} expression or integrating the library into a Python-based automation suite with jutsu.generate('es_nie'), the function provides the consistency needed for comprehensive software verification across the entire stack.
The primary benefit of the es_nie function is its seamless integration across various development environments, from the Python console to the terminal. Developers can instantly produce a single valid ID via the command line using mockjutsu generate es_nie or generate thousands of records to populate staging databases for stress testing. This flexibility eliminates the tedious manual effort of calculating check digits and reduces the risk of using malformed data during the development lifecycle. By incorporating mock-jutsu into your toolchain, you ensure your application is fully prepared for the nuances of Spanish identity documentation, resulting in a more robust and professional end product.
mockjutsu generate es_niemockjutsu bulk es_nie --count 10mockjutsu export es_nie --count 10 --format jsonmockjutsu export es_nie --count 10 --format csvmockjutsu export es_nie --count 10 --format sql# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate es_nie --maskmockjutsu bulk es_nie --count 5 --maskfrom mockjutsu import jutsujutsu.generate('es_nie')jutsu.bulk('es_nie', count=10)jutsu.template(['es_nie'], count=5)# mask=True: regulation-compliant outputjutsu.generate('es_nie', mask=True)jutsu.bulk('es_nie', count=5, mask=True)${__mockjutsu_intl_ids(es_nie)}# JMeter Function: __mockjutsu_intl_ids# Parameter 1: es_nie# Parameter 2: (not required for this function)# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_intl_ids(es_nie,mask)}GET /generate/es_nie# → {"type":"es_nie","result":"...","status":"ok"}GET /bulk/es_nie?count=10POST /template {"types":["es_nie"],"count":1}# mask=true: regulation-compliant outputGET /generate/es_nie?mask=trueGET /bulk/es_nie?count=5&mask=true| Parameter | Values | Description |
|---|---|---|
| --mask | true | false | Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…) |