Once you’ve written a business rule, you generally want to test it before you apply it to your template and begin using it on all of your inventory. The best way to perform this testing will vary for inventory and marketplace business rules.

Inventory Rule Testing

For inventory business rules, the preview section at the bottom of the rule will not show accurate information. Therefore, you have two options for testing the rules:

  1. Preview the rule using a template preview
  2. Do an inventory upload with a small portion of your inventory, then check the result

Inventory Template Preview

To preview a rule in an inventory template, you will want to go to Inventory > Product Mapping > Templates, then open the template you have mapped the rule to. In the upper right corner, you should have the option to Upload Preview File, where you can select a file under 100 KB to upload and see the preview of the template like you can with a marketplace template preview.

Test Upload

The second option is to just perform a test upload using a small portion of your inventory.  If you decide to do this, first make sure the upload is not configured to use detect dropped products, so you do not accidentally zero out your inventory quantity.

Next, you’ll want to decide if the field is one you can test directly. Most importantly, consider whether or not uploading the wrong value would result in issues on your marketplaces. If direct testing is not the best choice, you may want to create a temporary attribute to output the rule test upload to, which you can delete after you complete testing. This is especially true if you are working with labels and could accidentally set items live on a marketplace.

Marketplace Rule Testing

Marketplace business rules have three ways to test rules:

  1. Preview the rule using the business rule preview
  2. Preview the rule using the marketplace template preview
  3. Preview the rule using a flex feed

Business Rule Preview

The easiest way to test a business rule is to simply use the preview built into the business rule editor. For this, you just select the SKU to preview in the “SKU to preview with” section and the output will show in the “Preview” section.

Marketplace Template Preview

To preview a rule on a marketplace template, you need to open the template, map the rule, then select the product from the “Product Preview” section.

Keep in mind, the business rule preview and marketplace preview may not return the same results on child SKUs. For some fields, we send the value from the parent SKU, not from each child. Child SKUs are known at the template level, but are not taken into consideration in the rule preview.

Flex Feed Preview

The business rule and template previews have the same drawback: you can only preview one item at a time. If you want to see the outcome for a bunch of items at once, you can create a custom flex feed to preview the rule.

  1. To create the feed, go to Digital Marketing > Marketing Management > Feeds, then click on Add New Feed in the upper right corner.
  2. Select the option to Add Site under Custom Destinations.
  3. Click the Create New option under Flex Feeds.
  4. Give the feed a name. Something descriptive and basic, like “Business Rule Test,” is normally best so you will remember the reason for it later. Save.
  5. Classify the site as “Other.” Set it for HTTP Pickup and select to not track performance.
  6. Click Next to advance to the Inventory Selection tab.
  7. Select the Label you want to use for the feed (you also will likely want to include child items).
  8. Click Next to advance to the Template tab.
  9. Create the fields you want to send. You will likely want to allow HTML in the field values and leave the header and footers as just the standard rows with a file type of text, tab-delimited, but this is up to you. We recommend including the SKU and parent SKU, then as many fields as you need for the business rules. You can add more later if you forget some, so don’t worry too much if you don’t include all of the fields you’ll need initially. You may also want to include fields the rules are based on. For example, if you are altering the title, you may want to include the old title in the feed as well. 
  10. Click Next to advance to the Merchandiser tab.
  11. Include mappings on your template.
  12. Click Save and Exit (you don’t need to worry about the settings).
  13. From Digital Marketing > Marketing Management > Feeds, you can select the feed you just created, and click the Preview button to send yourself the output of the feed. In general, we don’t recommend activating the feed since it is not necessary for the output and the client has a limited number of feeds they can have active at a given time.
  14. You can have the preview emailed to you or download it from the Feed History tab.

Once you’ve tested your business rules, you can be confident that they will work as you intended when you map them to your templates.