---
title: "Automate Test Creation when Posting a Purchase Receipt with Warehouse Handling"
app: "Quality Inspector"
section: "Set up"
last_updated: "2025-09-22"
url: "https://insight-works.com/kb/quality-inspector/automate-test-creation-when-posting-a-purchase-receipt-with-warehouse-handling/"
---

# Automate Test Creation when Posting a Purchase Receipt with Warehouse Handling

This walkthrough goes through a scenario of having a quality inspection test created automatically when posting a purchase receipt in a location with warehouse handling.

This walkthrough uses the standard Contoso data available in a demo Business Central 25 install.

### Prerequisites

- Use a “Contoso” company as a baseline with the “WHITE” location and the “WRB-1002” item, and vendor “40000”.
- Prerequisite: Ensure the Assisted Setup Wizard was run.
- Prerequisite: If any previous test cases were followed then set the Activation Trigger to “Disabled” on all existing test generation rules.
- Prerequisite: On the Quality Inspection Setup have “Show Test ” set to “Automatic and Manually Created Tests”.

 Note: You must complete all sections in order in this article.

### 1. Add a new field to the Quality Inspection Template

1. Navigate to _Quality Inspection Templates_ in Business Central.
2. Select **+New**.
3. Input a unique, unused code in the _Code_ field (e.g., “MYEXAMPLE”).
4. Input a description for the template in the _Description_ field (e.g., “MYEXAMPLE WHSE REC”).
5. Select **Add Field(s) To This Template**in the action bar section (Quality Inspection Field Wizard start).
6. Select **New Field**and select **Next**.
7. Input a unique, unused description (e.g., “MYFIELD1”) and tab off the field (_short name (Field Code)_ and _What type of data is it_ fields appear).
8. Leave the _Short name (Field Code)_ field unchanged.
9. Select “A number” in the _What type of data is it _field.
10. Select **Next** (the next page describes _Number Field Details_ field and fields that allow defining the default value, allowed values, and pass values).
11. Locate the _Set the range of allowed values_ field and set the following fields:

   - Minimum: 5 (the minimum allowed value to be entered, not the pass value).
   - Maximum: 50 (the maximum allowed value to be entered, not the pass value).
12. Locate the _Field Conditions_ section and set the following fields:

   - Pass Min: 10 (minimum allowed value to be considered a Pass).
   - Pass Max: 20 (maximum allowed value to be considered a Pass).
13. Select **Finish**.

The Quality Inspection Field Wizard closes, and the new field is added to the Quality Inspection Template.

### 2. Create a test generation rule

1. Select **Test Generation Rules** (opens the _Quality Inspection Test Generation Rules_ page and filters to the above template).
2. Select **Create Receiving Rule**.
3. Select the template you created in the _Select Template_
4. Enable “Purchase Line” in the _What kind of receiving rule are you making_
5. Select **Next**.
6. Select “WHITE” in the _Location_ field and select **Next**.
7. Select “WRB-1002” in the _Specific Item_ field and select **Next**.

 Note: Do not modify any values on the summary page.

1. Select **Finish**.

After the wizard closes a test generation rule will have been made.

### 3. Modify the Test Generation Rule and create a Purchase Order

Locate the newly created Test Generation Rule record on the _Quality Inspection Test Generation Rules page_.

1. Select “Manual or Automatic” in the _Activation Trigger_ field.
2. Select “When Purchase Order is Received” in the _Purchase Trigger_field.
3. Close the following pages:

   1. Test Generation Rules
   2. Quality Inspection Template
   3. Quality Inspection Templates
4. Navigate to _Purchase Orders_ and select **+New**.
5. Select “40000” In the _Vendor No._ field and tab off the field.
6. Navigate to the first row in the _Lines_ subpage and ensure the _Type_ column is showing “Item”.
7. Input “WRB-1002” into the field and tab off the field.
8. Select “WHITE” in the _Location Code _field.
9. Input “123” into the _Quantity_ field, ensure the Unit of Measure Code is set to the item’s base unit of measure, and tab off the field.
10. Select “Release” in the action bar area.
11. Select “Create Whse. Receipt” in the action bar area.
12. Navigate to the _Lines_ section and select the line for the WRB-1002 item.
13. Select “Item Tracking Lines” in the _Line_ menu (opens the _Item Tracking Lines_ page).
14. Input a unique unused lot number such as “WRB1002-2025-07-24-001” into the _Lot No._ column and tab off the column.

 Note: If repeating this test case, use a different lot number.

1. Input “123” into the _Quantity (base)_ column and tab off the column.
2. Select any future date in the _Expiration Date _field.
3. Select **Close**.
4. Select **Post Receipt**in the action bar.
5. Select **Yes**if asked “Do you want to post the receipt?”

 Note: If a Business Central message similar to “Number of source documents posted: 1 out of a total of 1” displays, Select **OK**.

### 4. Quality Inspection Test/Order

After completing the above sections, a Quality Inspection Test/Order displays the following fields:

- Quantity (base): Set to “123”
- Status: Set to “Open”
- Item No.: Set to “WRB-1002”
- Lot No.: Set to “WRB1002-2025-07-24-001”
- Template Code: Set to the template configured in the earlier steps.
