expiryFinancial

Mock Jutsu HOW-TO | UK

In the realm of financial software development, ensuring that payment workflows function seamlessly is a critical requirement. The mock-jutsu library provides a robust solution for generating realistic financial test data through its dedicated expiry function. This utility is specifically designed to produce card expiry dates in the standardised MM/YY format, which is the industry norm for credit, debit, and prepaid cards. By automating the creation of these dates, developers can bypass the tedious manual entry of card details while maintaining the integrity of their testing environments.

The algorithm behind the expiry function ensures that every generated value is logically sound and future-dated relative to the current system time. This is vital for testing payment gateways and checkout processes where an expired date would trigger an immediate validation error. By providing a plausible future month and year, mock-jutsu allows teams to simulate successful transaction flows and verify that their systems correctly handle valid card credentials. This level of precision in mock data generation is essential for achieving high test coverage in financial applications and ensuring that validation logic adheres to ISO/IEC 7813 standards.

Beyond simple form filling, the expiry function is indispensable for complex testing scenarios such as automated regression suites and load testing. For instance, when simulating thousands of concurrent users on an e-commerce platform, the ability to inject dynamic test data prevents caching issues and ensures that the application logic is thoroughly exercised. Developers can use mock-jutsu to validate front-end masks, back-end API validation logic, and database storage procedures, ensuring that the two-digit month and two-digit year are processed correctly across the entire technical stack.

Integrating the expiry function into your existing workflow is straightforward, whether you are working within a local development environment or a continuous integration pipeline. For quick checks, the CLI command "mockjutsu generate expiry" provides instant results, while the Python implementation via jutsu.generate('expiry') allows for programmatic data generation within test scripts. Additionally, the library supports JMeter through the ${__mockjutsu(expiry,)} syntax, making it a versatile tool for performance engineers. By leveraging mock-jutsu, development teams can significantly reduce the time spent on manual data preparation and focus on delivering high-quality, secure financial software.

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

Parameters

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

Other Languages