Bulk IMEI Testing: Batches, Luhn Checks & QA Automation

Bulk IMEI Testing: Batches, Luhn Checks & QA Automation

Generate batches of up to 50 Luhn-valid test values with RandomIMEI.com, or build a local deduplicated generator for larger QA datasets.

Random IMEI Editorial Team · 2026-03-18 · Updated 2026-08-05 · Internal editorial review (2026-08-05)
#bulk IMEI generator #IMEI batch generation #QA automation #testing database #IMEI testing #mobile device testing

One test IMEI can validate a form field, while load and migration tests may need much larger fixture sets. RandomIMEI.com creates 1–50 values per web batch; for hundreds or thousands, use a local generator with explicit deduplication and keep the results inside an isolated test environment.

This guide defines a reproducible fixture contract: 15 digits, a Luhn-valid check digit, documented TAC inputs, explicit collision handling and mocked status responses.


Why You Cannot Just Use Random 15-Digit Numbers

Random 15-digit strings usually miss one or more test contracts:

  1. Luhn validation fails: A standard 15-digit IMEI carries a Luhn check digit. A uniformly random final digit has a one-in-ten chance of matching the checksum, so roughly 90% of arbitrary strings fail a Luhn-only validator.

  2. Prefix-aware branches are missed: Systems may map the first eight digits through a TAC dataset. An arbitrary prefix will not exercise a known mapping and may be treated as unknown by software that performs an authoritative lookup.

  3. Uncontrolled duplicates: When a schema or scenario requires unique identifiers, random serials can collide and trigger a constraint for the wrong reason.

  4. No declared distribution: An arbitrary prefix mix does not tell reviewers which product branches the fixture is meant to cover. Derive categories and weights from your own requirements, not an unsourced market-share claim.

A useful bulk fixture generator should calculate valid Luhn checksums, use deliberately chosen TAC inputs, reject duplicates in the current dataset, and document how device-family labels were sourced.


Use Cases for Bulk IMEI Generation

1. Database Seeding and Schema Testing

When building or migrating a database that stores device identifiers, choose a fixture count that exercises the query plan and constraints you intend to measure. Empty databases and single-record tests do not reveal:

  • Index performance at the planned cardinality
  • Query plan behavior when filtering by manufacturer TAC prefix
  • Partition pruning when the schema uses TAC-based partitions
  • Constraint validation timing under insert load

Record the database version, row count, TAC categories and query set with the benchmark. Synthetic results predict production only to the extent that those inputs match the production workload.

2. Load Testing and Performance Benchmarking

Repeating one identifier can measure the cache rather than the lookup path. Build a pool sized for the cache behavior, request mix and concurrency in your own performance plan.

Feed the controlled pool to k6, JMeter, Locust or Gatling, and keep status responses behind a local mock. A different IMEI string does not create a real device record.

3. MDM Platform Development

MDM test plans may cover enrollment workflows, policy assignment, inventory queries and compliance reporting at several inventory sizes. Use the sizes in your capacity target rather than a generic industry range.

Bulk-generated values can populate a mock or staging inventory without copying customer identifiers. Vendor enrollment and eligibility responses must remain mocked or use an approved vendor test facility.

4. QA Automation Pipelines

Automated test suites that validate IMEI-related functionality need unique test data for each test run. Hardcoding a small set of test IMEIs into your test fixtures creates test pollution: tests start interfering with each other because they share state around the same identifiers.

A better pattern is to generate fresh IMEIs on demand at the start of each test run, or to maintain a large pre-generated pool and draw from it with a counter or random offset. Bulk generation supports both approaches.

5. Telecom Network Simulation

Telecom engineers testing HLR, VLR or EIR integrations can model IMSI and IMEI-shaped fields in synthetic records. Define the relationship and expected registry state in the fixture; generation alone supplies neither subscriber identity nor equipment status.

6. Second-Hand Device Marketplace Testing

Platforms that verify IMEI status (blacklist checks, carrier lock status, warranty lookup) need to test their lookup pipeline with varied input. You want to test:

  • Controlled response: mock returns a clear or blocked state
  • Timeout/error response: mock returns the contract's failure shape
  • Invalid format: malformed input
  • Mapping edge case: valid Luhn with a TAC unknown to the test catalog

Generated values do not have a known blacklist, carrier-lock or warranty status. Test those branches with fixtures whose expected responses are controlled by your mock service; do not infer a "clean" status from generation alone.


Technical Requirements for Valid Bulk IMEI Generation

Generating valid IMEIs at scale requires getting several things right simultaneously:

Luhn Algorithm at Scale

Every generated IMEI needs a valid Luhn check digit. Here is the algorithm implemented in Python, suitable for bulk generation:

import random

def luhn_checksum(digits_14: str) -> int:
    """Calculate the Luhn check digit for a 14-digit string."""
    digits = [int(d) for d in digits_14]
    # For a 14-digit base, double positions 2, 4, ... 14 from the left.
    for i in range(13, -1, -2):
        digits[i] *= 2
        if digits[i] > 9:
            digits[i] -= 9
    total = sum(digits)
    return (10 - (total % 10)) % 10

def generate_imei(tac: str) -> str:
    """Generate a valid IMEI with the given 8-digit TAC."""
    if len(tac) != 8 or any(ch not in "0123456789" for ch in tac):
        raise ValueError("tac must contain exactly 8 digits")
    serial = str(random.randint(0, 999999)).zfill(6)
    base = tac + serial
    check = luhn_checksum(base)
    return base + str(check)

def generate_bulk(tac: str, count: int) -> list[str]:
    """Generate a list of unique valid IMEIs for a given TAC."""
    if not 1 <= count <= 1_000_000:
        raise ValueError("count must be between 1 and 1,000,000")
    seen = set()
    results = []
    while len(results) < count:
        imei = generate_imei(tac)
        if imei not in seen:
            seen.add(imei)
            results.append(imei)
    return results

# Example: generate 1000 fixtures from an explicitly non-authoritative
# prefix chosen for this isolated test. Supply your own documented input.
imeis = generate_bulk("12345678", 1000)
print(f"Generated {len(imeis)} unique IMEIs")
print(f"Sample: {imeis[:5]}")

Choose a Distribution from Your Test Plan

Do not copy an unsourced market-share table into fixtures. Define the categories and weights that your own product supports, document where those requirements came from, and keep an explicit fallback for an unknown TAC.

Test category Example purpose
Known local mapping Exercise a device-label branch
Unknown prefix Verify graceful fallback behavior
Several configured families Exercise filtering and aggregation
Repeated and malformed input Verify constraints and error handling

Ensuring Uniqueness

If the schema or scenario requires uniqueness, use one of two approaches:

  1. Set-based deduplication (shown in the Python example above): Track generated IMEIs in a set and regenerate on collision.
  2. Sequential serial numbers: Increment the serial field (digits 9–14). This guarantees distinct values within the generated fixture for one TAC. The six-digit input has 1,000,000 possible serial combinations, but Random IMEI cannot determine which combinations may already be assigned in the real world.

Collision Math and Deterministic Alternatives

One TAC has 1,000,000 six-digit serial inputs. With random sampling, the expected number of duplicate pairs is approximately n(n-1) / (2 x 1,000,000). At 1,000 draws from one TAC, that value is about 0.5, which corresponds to roughly a 39% chance of at least one collision under an ideal uniform generator.

Set-based rejection removes duplicates from the output but becomes less efficient as the pool fills. Sequential serials make a fixture reproducible and avoid within-fixture collisions. Use more than one TAC only when the test plan requires multiple mapping categories or more than one million distinct serial inputs.

QA vector matrix

Input Expected result Purpose
490154203237518 Luhn pass Positive checksum control
490154203237519 Luhn fail Changed check digit
000000000000000 Luhn pass, identity unknown Proves Luhn is not assignment
49015420323751 Length fail Missing check digit
Two identical rows Duplicate according to fixture rule Constraint branch

Integrating Bulk IMEIs with QA Tools

With k6 (JavaScript load testing)

import http from 'k6/http';
import { check } from 'k6';
import { SharedArray } from 'k6/data';

// Pre-load 50,000 generated IMEIs from a file
const imeis = new SharedArray('imeis', function () {
  return open('./test_imeis.txt').split('\n').filter(l => l.length === 15);
});

export default function () {
  // Pick a random IMEI from the pool
  const imei = imeis[Math.floor(Math.random() * imeis.length)];

  // Use a local mock whose response is controlled by the test.
  const res = http.post('http://localhost:8080/mock/devices/lookup', {
    imei: imei,
  });

  check(res, {
    'status is 200': (r) => r.status === 200,
    'returns device info': (r) => r.json('manufacturer') !== undefined,
  });
}

With pytest (Python test suite)

import pytest
import random

# Fixture that provides unique IMEIs per test
@pytest.fixture
def unique_imei(imei_pool):
    """Provide a unique IMEI from a pre-generated pool."""
    return imei_pool.pop()

@pytest.fixture(scope="session")
def imei_pool():
    """Load pre-generated IMEI pool at session start."""
    with open("test_data/bulk_imeis.txt") as f:
        imeis = [line.strip() for line in f if len(line.strip()) == 15]
    random.shuffle(imeis)
    return imeis

def test_device_lookup(unique_imei, api_client):
    response = api_client.lookup_device(unique_imei)
    assert response.status_code == 200
    assert response.json()["format_valid"] is True

With SQL (Database seeding)

-- PostgreSQL: bulk insert from CSV
CREATE TEMP TABLE temp_imeis (imei CHAR(15));

COPY temp_imeis FROM '/path/to/bulk_imeis.csv' CSV;

-- Insert into devices table with additional metadata
INSERT INTO test_devices (imei, created_at, status)
SELECT
    imei,
    NOW() - (random() * INTERVAL '365 days'),  -- Random creation date
    CASE WHEN random() < 0.95 THEN 'active' ELSE 'inactive' END
FROM temp_imeis
ON CONFLICT (imei) DO NOTHING;

SELECT COUNT(*) FROM test_devices;  -- Verify count

Using RandomIMEI.com for Bulk Generation

RandomIMEI.com supports small web batches. You can:

  • Generate 1–50 values in a request
  • Select a manufacturer and device profile from the dated local snapshot
  • Copy the results or download a CSV file

The site does not expose a public generation API. For automated or larger datasets, adapt the local Luhn example in this guide and add your own deterministic inputs, deduplication and test-only safeguards.

Each generated IMEI:

  • Has a valid Luhn check digit
  • Uses a prefix from Random IMEI's versioned, non-authoritative local snapshot
  • Is deduplicated within the current web batch

Random IMEI performs no GSMA, carrier, activation, warranty or blacklist lookup. It therefore cannot determine whether an output is assigned, registered, blocked or accepted by another system. Treat every output as synthetic fixture data and never submit it to a live identity system.


Output Format Options for Bulk IMEIs

RandomIMEI.com itself offers clipboard copy and CSV. A local generator you control can additionally emit the formats your test harness requires:

Format Use Case Example
Plain text Shell scripting, simple imports One IMEI per line
CSV Spreadsheets, MDM portal imports imei,manufacturer,model
JSON array API integrations, JavaScript tools ["490154203237518", ...]
JSON objects Rich metadata for each IMEI [{"imei": "...", "tac": "35299906", "brand": "Apple"}]
SQL INSERT Direct database seeding INSERT INTO devices VALUES (...)

What Bulk-Generated IMEIs Are NOT For

In some jurisdictions and organizations, bulk IMEI generation can be appropriate for isolated software fixtures when policy and applicable law allow it. It is not a tool for:

  • IMEI spoofing: Reprogramming or misrepresenting a real device identifier may be illegal and is outside this site's purpose. Generated values are plain data and must remain in controlled tests.
  • Bypass lists: A generated value has no verified registry status. Never submit it to a carrier, blacklist, activation or other production identity service.
  • Fraud: Insurance fraud, device finance fraud, or any other scheme that involves misrepresenting device identity. Generated test data exists for development environments, not for submission to real-world systems.

Laws differ by jurisdiction. Using a false identifier to access services, impersonate a device or commit fraud may be illegal; keep fixtures in controlled development environments and obtain legal advice for regulated workflows.


Frequently Asked Questions

How many unique IMEIs can I generate from a single TAC code?

The six-digit serial field has 1,000,000 possible inputs for one TAC. Sequential enumeration can create that many distinct fixture values, but Random IMEI cannot tell whether any value collides with an assigned device. Use multiple TACs when your test contract requires more values or more mapping categories.

What is the fastest way to generate 1 million test IMEIs?

A deterministic approach is to enumerate the serial range for a documented test prefix and calculate Luhn for each row. It avoids random collisions; benchmark the implementation and dataset size in your own environment rather than assuming a fixed completion time.

Can I use bulk-generated IMEIs in a CI/CD pipeline?

Yes. Generate values in a local pre-test script or maintain a clearly labelled fixture pool. RandomIMEI.com has no public generation API, so CI jobs should use code that you own, review and can seed reproducibly.

Do bulk-generated IMEIs work with real IMEI checker tools?

They pass checks that enforce the 15-digit format and Luhn checksum. Other checkers may also query proprietary TAC, carrier, blacklist or warranty data. Random IMEI does not know or predict those results, so do not submit generated values to live lookup services.

How do I ensure no duplicates in a bulk-generated dataset?

Use set-based rejection for random serials, or enumerate the six-digit serial field deterministically. The second method avoids within-fixture collisions and makes reruns reproducible. Enforce uniqueness only when it is part of the schema or scenario contract.

Is there a risk that a generated IMEI matches a real device's IMEI?

Yes. Random serial generation within a TAC can coincide with an assigned device identifier, and Random IMEI has no authoritative assignment database with which to exclude it. Keep outputs isolated from live carrier, activation, warranty, financing, insurance and blacklist systems.

Sources and further reading

Try our tools

Create Luhn-valid test fixtures or check the 15-digit format and checksum of an existing value.