Inferensys

Prompt

Decision Table Test Generation Prompt Template

A practical prompt playbook for using the Decision Table Test Generation Prompt Template in production QA workflows to produce combinatorial test matrices from business rule specifications.
Elegant overhead shot of a polished wooden communal table in a sun-drenched WeWork lounge, laptops and tablets displaying AI workflow dashboards, plants and pendant lights in background.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the ideal job-to-be-done, user, and context for the Decision Table Test Generation Prompt, and clarifies when not to use it.

This prompt is designed for test analysts and QA engineers who need to systematically convert a set of business rules into an exhaustive, combinatorial decision table. The core job-to-be-done is ensuring complete logical coverage: every possible permutation of conditions is mapped to its expected action, making implicit or missing rules visible. Use it when you have a formal or semi-formal specification—such as a requirements document, a user story's acceptance criteria, or a regulatory rule set—that defines conditions and their corresponding actions. The ideal input is a structured list of conditions (each with defined possible values) and actions, not a narrative paragraph.

The prompt's value is in exposing gaps. It forces the model to generate all combinations, flag contradictions where the same condition set maps to different actions, and highlight missing combinations where no action is defined. This is critical for high-stakes logic in finance, insurance, healthcare, or access control, where an unhandled condition permutation can lead to a compliance violation or a security flaw. For example, if a loan origination system has rules based on credit_score (high/low) and employment_status (employed/unemployed), the prompt will produce four test cases and flag if the low+unemployed combination has no defined action. Do not use this for simple input validation (e.g., checking a single field's format), API contract tests, or performance scenarios. It is specifically for logic-intensive, multi-condition business rules where interactions must be verified.

Before using this prompt, ensure your business rules are clearly defined and that you can articulate the conditions and their possible values. The prompt will not interpret vague prose; it requires discrete logical inputs. If your rules are embedded in long, unstructured documents, use a separate extraction prompt first to pull out the conditions and actions. The output is a structured test matrix, not executable code. Your next step after generation should be a human review of any flagged contradictions or missing rules, as these often indicate a defect in the specification itself, not just the test model.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Decision Table Test Generation prompt delivers value and where it introduces risk. Use this to decide before you prompt.

01

Good Fit: Explicit Business Rules

Use when: you have documented business rules with clear condition-action pairs, such as insurance underwriting, loan eligibility, or pricing tier logic. The prompt excels at systematically expanding these into a combinatorial test matrix.

Guardrail: Provide the rules as structured text or a table in the prompt input. Avoid feeding the model only narrative prose and expecting it to infer the rules.

02

Bad Fit: Subjective or Vague Policies

Avoid when: the specification contains ambiguous guidance like 'use best judgment' or 'escalate if suspicious.' The model will hallucinate concrete conditions for vague policies, producing test cases that don't reflect real decision logic.

Guardrail: If the policy is inherently subjective, use a human-in-the-loop review step. Flag any generated test case where the expected action cannot be deterministically traced back to the source text.

03

Required Inputs: Condition and Action Inventory

What you must provide: a complete list of conditions (inputs), their possible values, and the resulting actions (outputs). Missing a condition or value domain leads to incomplete combinatorial coverage.

Guardrail: Validate the input inventory against the source specification before generation. Use a pre-check prompt to extract and list all conditions and actions, then have a human confirm the list is exhaustive.

04

Operational Risk: Combinatorial Explosion

Risk: For N binary conditions, the full decision table has 2^N rows. The model may generate an unmanageably large test suite or, worse, silently truncate it, missing critical permutations.

Guardrail: Set an explicit [MAX_TEST_CASES] constraint in the prompt. If the full combinatorial space exceeds this, instruct the model to apply pairwise or risk-based reduction and flag omitted combinations.

05

Operational Risk: Contradictory Rules

Risk: The source specification may contain conflicting rules (e.g., same conditions leading to different actions). The model might reproduce the contradiction without flagging it, producing an untestable matrix.

Guardrail: Add an evaluation step that checks for rule conflicts. Prompt the model to output a 'Conflicts Detected' section alongside the test matrix, listing any condition combinations with ambiguous expected actions.

06

Integration: Test Management System Handoff

Risk: The generated test matrix is a raw table. Manually copying it into a test management tool introduces errors and breaks traceability.

Guardrail: Define a strict [OUTPUT_SCHEMA] in the prompt (e.g., CSV with specific columns for Test Case ID, Conditions, Expected Action, Rule Reference). This allows direct import or API-driven creation in tools like Xray or Zephyr.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for generating decision table test cases from business rule specifications, ready to copy and adapt with your own inputs.

This prompt template converts business rule specifications into structured decision table test cases. It is designed for test analysts who need to produce combinatorial test matrices with condition combinations, expected actions, and rule coverage. The template uses square-bracket placeholders that you must replace with your actual inputs before sending to the model. Each placeholder maps to a specific input type—business rules, constraints, output format requirements, and risk level—so the model has enough context to generate a complete, traceable decision table.

text
You are a test analyst specializing in decision table testing. Your task is to convert business rule specifications into a complete decision table test matrix.

## INPUT
Business Rules Specification:
[RULES_SPECIFICATION]

Additional Context (domain, system behavior, dependencies):
[CONTEXT]

## CONSTRAINTS
- Generate all condition combinations unless explicitly limited
- Flag contradictory rules and missing permutations
- Include rule coverage summary
- Risk level for this test effort: [RISK_LEVEL]

## OUTPUT SCHEMA
Return a JSON object with this structure:
{
  "decision_table_id": "string",
  "source_rules": ["rule_id", "rule_description"],
  "conditions": [
    {
      "condition_id": "string",
      "description": "string",
      "possible_values": ["value1", "value2"]
    }
  ],
  "test_cases": [
    {
      "test_case_id": "string",
      "condition_values": {"condition_id": "value"},
      "expected_action": "string",
      "expected_result": "string",
      "rule_reference": "rule_id",
      "notes": "string"
    }
  ],
  "coverage_summary": {
    "total_combinations": number,
    "combinations_tested": number,
    "untested_combinations": ["description"],
    "contradictory_rules_detected": [
      {
        "rule_pair": ["rule_id", "rule_id"],
        "conflict_description": "string"
      }
    ],
    "missing_permutations": ["description"]
  },
  "warnings": ["string"]
}

## EXAMPLES
Example business rule: "If customer is premium AND order total exceeds $500, apply 10% discount. If customer is premium AND order total does not exceed $500, apply 5% discount. If customer is not premium, no discount applies."

Example condition: {"condition_id": "C1", "description": "Customer is premium", "possible_values": ["true", "false"]}

Example test case: {"test_case_id": "TC-01", "condition_values": {"C1": "true", "C2": "true"}, "expected_action": "Apply 10% discount", "expected_result": "Discount applied to order total", "rule_reference": "R1", "notes": "Premium customer with high-value order"}

## INSTRUCTIONS
1. Extract all conditions from the business rules specification
2. Identify all possible values for each condition
3. Generate the full combinatorial matrix of condition values
4. Determine the expected action and result for each combination based on the rules
5. Flag any contradictory rules where the same condition combination maps to different actions
6. Identify any condition combinations not covered by the rules
7. If [RISK_LEVEL] is "high", include a human-review flag on any test case where the expected action is ambiguous
8. Return the complete JSON object following the output schema exactly

To adapt this template, replace each square-bracket placeholder with your actual content. [RULES_SPECIFICATION] should contain the full text of the business rules you are testing—include all conditions, actions, and any exception logic. [CONTEXT] should describe the system under test, relevant domain knowledge, and any dependencies that affect rule interpretation. [RISK_LEVEL] accepts values like "low", "medium", or "high" and controls whether ambiguous test cases receive a human-review flag. After replacing placeholders, validate that the output schema matches your test management system's expected format before integrating the prompt into your pipeline. For high-risk domains such as financial compliance or healthcare, always route the generated decision table through a human reviewer before committing it to your test suite.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Decision Table Test Generation Prompt Template. Each placeholder must be populated with concrete, structured data to produce reliable combinatorial test matrices.

PlaceholderPurposeExampleValidation Notes

[BUSINESS_RULES]

The complete set of business rules to be modeled as a decision table, including conditions and corresponding actions.

IF customer_type = 'premium' AND order_total > 500 THEN discount = 15%

Parse check: each rule must contain at least one condition clause and one action clause. Reject if rules are missing THEN statements or condition-action mapping is ambiguous.

[CONDITION_VARIABLES]

An enumerated list of all independent condition variables referenced in the business rules, with their possible values.

customer_type: ['standard', 'premium', 'enterprise']; order_total: ['<100', '100-500', '>500']

Schema check: must be a valid list of objects with 'name' and 'values' keys. Values must be exhaustive per the source rules. Reject if a condition in [BUSINESS_RULES] references a variable not defined here.

[ACTION_VARIABLES]

An enumerated list of all possible action outcomes referenced in the business rules, with their possible values.

discount: [0, 10, 15, 20]; free_shipping: [true, false]

Schema check: must be a valid list of objects with 'name' and 'values' keys. Reject if an action in [BUSINESS_RULES] references a variable not defined here. Null allowed only if action is optional per rules.

[COMBINATORIAL_STRATEGY]

Specifies whether to generate all permutations or a constrained subset using techniques like pairwise or orthogonal array testing.

all_permutations

Enum check: must be one of 'all_permutations', 'pairwise', 'orthogonal_array', or 'risk_based'. If 'risk_based', a [RISK_WEIGHTS] input is required.

[RISK_WEIGHTS]

Optional mapping of condition values to risk scores for prioritizing test combinations when using risk-based combinatorial strategy.

customer_type: {'enterprise': 0.9, 'premium': 0.7, 'standard': 0.3}

Null allowed if [COMBINATORIAL_STRATEGY] is not 'risk_based'. If provided, weights must be floats between 0.0 and 1.0. Reject if any condition value from [CONDITION_VARIABLES] is missing a weight.

[EXCLUSION_RULES]

Constraints specifying impossible or invalid condition combinations that should be excluded from the generated test matrix.

IF customer_type = 'standard' AND order_total > 500 THEN EXCLUDE

Parse check: each exclusion rule must reference only variables defined in [CONDITION_VARIABLES]. Reject if an exclusion contradicts a rule in [BUSINESS_RULES] or creates an empty valid combination set.

[OUTPUT_FORMAT]

Defines the structure of the generated decision table, including columns for condition combinations, expected actions, and traceability.

columns: ['rule_id', 'customer_type', 'order_total', 'expected_discount', 'expected_free_shipping', 'source_rule_ref']

Schema check: must include at minimum columns for each condition variable, each action variable, a unique row identifier, and a source rule reference. Reject if action columns are missing or condition columns are incomplete.

[COVERAGE_TARGET]

The minimum acceptable coverage metric for the generated test matrix, expressed as a percentage of rule combinations or condition values exercised.

100% rule coverage, 95% pairwise coverage

Parse check: must specify a numeric percentage and a coverage type. Coverage type must be one of 'rule_coverage', 'condition_coverage', or 'pairwise_coverage'. Reject if target exceeds 100% or is below 0%.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the decision table prompt into a test generation pipeline with validation, retries, and human review.

This prompt is designed to be called from a test management pipeline where business rule specifications are the primary input. The typical integration pattern is: retrieve the specification document, extract the relevant rule statements, inject them into the [RULE_SPECIFICATION] placeholder along with any [DOMAIN_CONSTRAINTS] and [OUTPUT_SCHEMA], then submit the assembled prompt to the model. The output should be parsed as structured JSON and validated before ingestion into your test case management system (e.g., TestRail, Zephyr, Xray). Do not treat the raw model output as final—always run it through a validation layer that checks for schema conformance, contradictory rules, and missing condition permutations.

Validation is the critical post-processing step. Implement a validator that checks: (1) every condition combination in the Cartesian product of input conditions appears in the output table, (2) no two rows have identical condition values but different expected actions, (3) all action values match the enumerated set defined in [OUTPUT_SCHEMA], and (4) any domain invariants specified in [DOMAIN_CONSTRAINTS] are not violated. If validation fails, construct a retry prompt that includes the original specification, the invalid output, and a structured error report describing exactly which rows or rules failed. Limit retries to a maximum of three attempts before escalating to a human reviewer. Log every attempt—including the prompt version, model, timestamp, and validation result—for auditability and regression testing.

For high-risk domains such as financial compliance or healthcare eligibility rules, insert a mandatory human approval gate after validation passes. Route the validated decision table to a review queue where a subject matter expert can confirm that the generated rule combinations match business intent. The approval step should be lightweight: present the original rule specification alongside the generated table, highlight any rows the validator flagged as borderline (e.g., ambiguous condition boundaries), and require explicit sign-off before the test cases are committed to the test repository. Avoid fully automated ingestion for regulated workflows unless you have a calibrated eval harness with historical accuracy data. For model selection, prefer models with strong structured output and logical reasoning performance; test across at least two model families to identify which produces the fewest contradictory rule errors for your domain's rule complexity.

IMPLEMENTATION TABLE

Expected Output Contract

Validation rules for the decision table test generation response. Use this contract to parse, validate, and integrate the model output into test management systems.

Field or ElementType or FormatRequiredValidation Rule

decision_table_id

string

Must match pattern DT-[SPEC_ID]-[TIMESTAMP]. Parse check: non-empty, no whitespace.

specification_ref

string

Must reference the input [SPEC_ID]. Parse check: exact match to provided specification identifier.

conditions

array of objects

Each condition object must contain name (string), values (array of strings, min 2). Schema check: array length >= 1.

actions

array of objects

Each action object must contain name (string), possible_outcomes (array of strings, min 1). Schema check: array length >= 1.

rule_matrix

array of objects

Each row must contain rule_id (string, pattern R[0-9]+), condition_values (object mapping condition names to values), expected_actions (object mapping action names to outcomes). Schema check: all condition and action keys must exist in conditions and actions arrays.

contradictory_rules

array of objects

Each entry must contain rule_a (string), rule_b (string), conflict_description (string). Null allowed if no contradictions found. Parse check: referenced rule IDs must exist in rule_matrix.

missing_permutations

array of arrays

Each inner array is a condition value combination not covered by any rule. Null allowed if coverage is complete. Parse check: each combination must use valid condition values from conditions array.

coverage_summary

object

Must contain total_permutations (integer), covered_permutations (integer), coverage_percentage (float 0-100). Validation: covered_permutations must equal length of rule_matrix minus contradictory or duplicate rules. Retry condition if coverage_percentage < 80 and no missing_permutations reported.

PRACTICAL GUARDRAILS

Common Failure Modes

Decision table test generation fails in predictable ways. These are the most common failure modes when converting business rules into combinatorial test matrices, along with practical guardrails to catch them before they reach your test management system.

01

Missing Condition Permutations

What to watch: The model generates only the happy-path combinations or obvious true/false pairs, skipping edge permutations like 'condition A true + condition B null + condition C boundary.' This leaves entire rule columns untested. Guardrail: Post-process the output against a combinatorial expectation: for N binary conditions, expect up to 2^N rows. Add an eval step that counts unique condition tuples and flags any missing combinations against the spec's stated condition space.

02

Contradictory Action Assignments

What to watch: Two rows with identical condition values produce different expected actions, or a single row assigns mutually exclusive actions. This usually happens when the model confuses 'OR' logic in the source rules or hallucinates an action not present in the spec. Guardrail: Run a contradiction check: group rows by condition tuple and verify action consistency. Flag any tuple with more than one distinct action set for human review. Add a constraint in the prompt requiring exactly one action column per row.

03

Rule Coverage Gaps

What to watch: The generated table covers 80% of the documented business rules but silently omits rules buried in footnotes, exception clauses, or cross-referenced documents. The table looks complete but misses critical regulatory or edge-case rules. Guardrail: Require the prompt to output a rule-to-row traceability mapping alongside the table. Compare the count of source rules extracted against the count of unique rule identifiers in the output. Flag any source rule without at least one covering row.

04

Implicit Condition Defaults

What to watch: The model assumes a default value for an unspecified condition (e.g., 'customer type = regular' when not stated) and generates rows that silently depend on that assumption. When the real system has a different default, the tests validate the wrong behavior. Guardrail: Add a prompt instruction: 'If a condition value is not explicitly specified for a rule, mark it as UNSPECIFIED rather than assuming a default. Generate separate rows for each possible value of UNSPECIFIED conditions where the spec is silent.' Validate that no row contains assumed values without an explicit trace to the source.

05

Action Granularity Mismatch

What to watch: The model produces actions at the wrong level of detail—either too coarse ('process order') to be testable or too fine-grained ('set field X to Y, then set field Z to W' as separate rows) creating an unmaintainable table. Guardrail: Define the expected action granularity in the prompt with an example: 'Each action should describe one verifiable system behavior, such as APPROVE_LOAN, REJECT_WITH_MESSAGE, or FLAG_FOR_REVIEW. Do not decompose internal steps.' Validate output actions against this schema and flag multi-step or vague actions.

06

Don't-Care Condition Explosion

What to watch: When the spec uses 'don't care' conditions (marked as '-' or 'N/A'), the model either expands every don't-care into all possible values—creating a combinatorially explosive table—or collapses them incorrectly, losing coverage. Guardrail: Instruct the prompt to use a compact notation for don't-care conditions and apply pairwise or orthogonal array reduction when the full combinatorial space exceeds a configurable threshold. Add a row-count limit in the prompt constraints and require the model to explain its reduction strategy in a preamble.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality of generated decision table test cases before integrating them into a test management system or automation suite.

CriterionPass StandardFailure SignalTest Method

Rule Completeness

Every business rule from [INPUT_SPEC] is represented by at least one condition column and one action column in the output.

A rule from the spec is missing entirely from the decision table or has no corresponding condition.

Manual diff: list all rules in [INPUT_SPEC] and check for a matching column in the output table.

Combinatorial Coverage

All unique combinations of condition values are present as distinct rows, including the 'N/A' or 'Don't Care' states.

A valid combination of condition values is missing, or two rows represent the same logical combination.

Automated check: generate all permutations of condition values and verify each has a corresponding row.

Contradiction Detection

No two rows with identical condition values produce different expected actions.

Two rows with the same condition combination map to different actions, indicating a contradictory rule.

Automated check: group rows by condition values and assert that all actions within a group are identical.

Action Verifiability

Each expected action is a discrete, testable assertion (e.g., 'Status set to Approved', 'Error message E101 displayed').

An action is vague (e.g., 'System handles it') or describes an internal state with no observable output.

Manual review: check each action cell for a concrete, observable outcome that can be asserted in a test.

Boundary Condition Handling

Boundary values for numeric or date conditions (e.g., min, max, min-1, max+1) are explicitly included as rows.

A boundary value is missing, or the table uses only range descriptions (e.g., 'Age > 18') without testing the exact boundary.

Automated check: parse numeric conditions and verify rows exist for boundary values specified in [CONSTRAINTS].

Output Schema Adherence

The output strictly conforms to [OUTPUT_SCHEMA], with all required fields present and correctly typed.

A required field is missing, an action is in the wrong format, or an extra field is hallucinated.

Schema validation: parse the output and validate against [OUTPUT_SCHEMA] using a JSON Schema validator.

Traceability

Each row includes a reference to the specific rule ID or requirement ID from [INPUT_SPEC] that it covers.

A row has no traceability tag, or the tag references a non-existent requirement ID.

Automated check: extract all traceability tags and verify each exists in the set of IDs from [INPUT_SPEC].

Default Rule Specification

An explicit 'Else' or default row is present to handle any condition combination not covered by specific rules.

The table has no default row, leaving unspecified condition combinations with undefined behavior.

Manual check: verify the presence of a row where all conditions are set to a catch-all value and an explicit default action is defined.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single business rule specification and lighter validation. Remove the eval criteria section and focus on getting a correct decision table structure with conditions, actions, and rules.

Simplify the output schema to only require conditions, actions, and rules arrays without coverage metadata.

Prompt modification

code
Generate a decision table from the following business rule specification:

[RULE_SPECIFICATION]

Output a JSON object with:
- "conditions": array of condition names
- "actions": array of action names
- "rules": array of objects with "condition_values" and "expected_actions"

Watch for

  • Missing condition combinations when rules use implicit defaults
  • Contradictory rules that produce different actions for the same condition set
  • Overly narrow rule interpretation that misses edge cases in the spec
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.