The br_cnpj function within the mock-jutsu library is an essential tool for developers and QA engineers who require realistic Brazilian business identification numbers for their applications. A CNPJ, or Cadastro Nacional da Pessoa Jurídica, is the standard identifier for legal entities operating in Brazil. Generating accurate mock data for this specific field is critical when testing financial systems, ERP software, and e-commerce platforms that cater to the Brazilian market. By using mock-jutsu, development teams can ensure their applications handle these 14-digit identifiers correctly without the need to use sensitive or real-world corporate information.
Each identifier produced by the br_cnpj function follows the official regulatory format, often represented with masks such as 11.222.333/0001-81. The generation process strictly adheres to the MOD-11 algorithm to calculate the final two check digits. This level of precision is vital for high-quality test data because modern validation logic will immediately reject any number that fails the checksum verification. Whether you are performing unit tests in Python using jutsu.generate('br_cnpj') or conducting high-volume performance testing in JMeter with the ${__mockjutsu(br_cnpj,)} function, the output remains consistent, unique, and syntactically valid.
Beyond simple validation, the br_cnpj generator helps developers simulate complex business logic scenarios. For instance, testing tax calculation modules or supplier onboarding flows requires a steady stream of unique identifiers to prevent database constraint violations. Using mock-jutsu via the CLI with the command mockjutsu generate br_cnpj allows for rapid prototyping and local environment setup. This automation significantly reduces the manual effort involved in creating spreadsheets of valid numbers, allowing engineers to focus on core feature development and edge-case handling rather than data entry.
Implementing mock-jutsu for your Brazilian test data needs also ensures compliance with global data protection regulations and the local LGPD. Since the library generates synthetic but structurally sound identifiers, there is zero risk of exposing actual corporate data during the development or staging lifecycle. This makes the br_cnpj function a cornerstone for secure, efficient, and robust software testing. By integrating this tool into your CI/CD pipelines, you can maintain high code quality and ensure that your internationalised applications are fully prepared for the complexities of the Brazilian corporate landscape.
mockjutsu generate br_cnpjmockjutsu bulk br_cnpj --count 10mockjutsu export br_cnpj --count 10 --format jsonmockjutsu export br_cnpj --count 10 --format csvmockjutsu export br_cnpj --count 10 --format sql# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate br_cnpj --maskmockjutsu bulk br_cnpj --count 5 --maskfrom mockjutsu import jutsujutsu.generate('br_cnpj')jutsu.bulk('br_cnpj', count=10)jutsu.template(['br_cnpj'], count=5)# mask=True: regulation-compliant outputjutsu.generate('br_cnpj', mask=True)jutsu.bulk('br_cnpj', count=5, mask=True)${__mockjutsu_intl_ids(br_cnpj)}# JMeter Function: __mockjutsu_intl_ids# Parameter 1: br_cnpj# Parameter 2: (not required for this function)# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_intl_ids(br_cnpj,mask)}GET /generate/br_cnpj# → {"type":"br_cnpj","result":"...","status":"ok"}GET /bulk/br_cnpj?count=10POST /template {"types":["br_cnpj"],"count":1}# mask=true: regulation-compliant outputGET /generate/br_cnpj?mask=trueGET /bulk/br_cnpj?count=5&mask=true| Parameter | Values | Description |
|---|---|---|
| --mask | true | false | Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…) |