tldWeb

Mock Jutsu HOW-TO | UK

The tld function within the mock-jutsu library is a specialised utility designed to generate realistic top-level domain extensions for diverse software development needs. Whether you are building a global web application or a local service, having access to authentic mock data is essential for simulating real-world internet addresses. This function provides a wide array of extensions, ranging from traditional choices like .com and .net to modern industry-specific variants such as .dev, .io, and .tech. By integrating this tool into your workflow, you can ensure that your application handles various domain suffixes with precision and reliability.

To maintain high standards of accuracy, mock-jutsu sources its tld data from updated lists of generic top-level domains (gTLDs) and country-code top-level domains (ccTLDs). The generation process follows the naming conventions established by global internet authorities, ensuring that the test data produced is both syntactically correct and contextually relevant. This adherence to industry standards allows developers to simulate complex networking environments without manually curating lists of extensions, significantly reducing the overhead associated with test environment setup and data maintenance.

Testing scenarios for the tld function are extensive, particularly in the realms of form validation and data sanitisation. Developers can use this function to verify that email parsers correctly identify valid suffixes or to test how a URL shortener behaves when confronted with non-traditional domain extensions. Furthermore, it is invaluable for internationalisation testing, where verifying the handling of various regional ccTLDs is crucial for a seamless global user experience. By automating the generation of these extensions, mock-jutsu helps identify edge cases that might otherwise be overlooked during manual testing phases.

The versatility of mock-jutsu is evident in its multi-platform support, offering seamless integration via Python scripts, command-line interfaces, and JMeter performance tests. Developers can invoke the function using jutsu.generate('tld') in their Python code or quickly produce results through the CLI with mockjutsu generate tld. For those conducting load testing, the JMeter syntax ${__mockjutsu(tld,)} provides a powerful way to inject dynamic data into HTTP requests. This flexibility empowers teams to maintain consistent test data quality across the entire development lifecycle, from initial unit tests to large-scale performance evaluations.

CLI Usage
mockjutsu generate tldmockjutsu bulk tld --count 10mockjutsu export tld --count 10 --format jsonmockjutsu export tld --count 10 --format csvmockjutsu export tld --count 10 --format sql
Python API
from mockjutsu import jutsujutsu.generate('tld')jutsu.bulk('tld', count=10)jutsu.template(['tld'], count=5)
JMeter
${__mockjutsu_web(tld)}# JMeter Function: __mockjutsu_web# Parameter 1: tld# Parameter 2: (not required for this function)
REST API
GET /generate/tld# → {"type":"tld","result":"...","status":"ok"}GET /bulk/tld?count=10POST /template {"types":["tld"],"count":1}

Other Languages