How to Design a Test Object

Why Would you Want to Design a Test Object?

Test objects help you to know if you configured your project correctly.

You might already use real documents from your production data, but they rarely cover everything you want to test for. Extreme or rare occurrences are hard to find in your data, or not there at all, if you try to build a future-proof project.

To cover those bases, one or more specifically designed test objects can help a lot. The results of working with test objects can be notably improved if you design them following certain principles.

This article describes how to design a test object like that.

What is a Test Object

A test object is a Document that is usable in the Composer as a basis for the previews. Every element in the Write and Transform tabs will render a preview of its evaluations for that test object.

Test objects can either be selected from your uploaded Documents or you can design one for testing something specific. The latter can be helpful if you want to check for rare behavior, want to cover fringe combinations of data, need to quickly mock up a test case, or simply want a small test dataset without irrelevant overhead.


For the types of errors you can prevent or trace with a test object, see our article on How Debugging Worksopen in new window.

What do you Want to Know?

Make sure you know the purpose of a test object.

Analyse what you want to test first. Do you want to...

  • Test for a correct trigger?
  • Test for a correct replacement?
  • Test for a correct calculation?
  • Test for a correct sorting of a list of objects?

Ask yourself the question of your desired result first. If it is more complex, don't be afraid to write it down somewhere. A good picture of what you want to achieve is key.

How can you Test it?

Find out how you would test the desired behavior.

If you need to test cases that you know are in your production data, pick some common cases from your dataset that you need to work. Next, find out if there are rare cases or outliers in your dataset that you also want to work, and pick them all.

If you are preparing your project for cases you anticipate to encounter in the future, start by writing down some cases that you would like to work.

Pick or design test cases for all your desired outcomes. If you are testing a trigger, for example, create a test object that should make it true and another that should make it false. If you are testing the replacement of a word, test for the exact word, a longer version, a shorter version and something completely different.

These are the cases that you need to design test objects for. Depending on the nature of the data and test cases, each of these cases may become a separate test object.

Stay Close to Your Production Data

The configuration in your project is built very specifically for the structure and content of your data. Stick to it in test objects as well!

Build test objects that have the same data structure as your production data, so that you can test your project's configuration without modifying data paths, data types or filters in your project.

In the same manner, write your test object's data values the same way as they are found in your production data. A deviation in that regard may result in wrong test results. An expression or rule may do what you want in the test object, but fail for production data.

Simplicity is Key!

Custom test objects are routinely built to check for very specific circumstances. Build your test object for a specific purpose only, and don't be afraid to make a new one to test something else.

Verify Your Test Data

Be vigilant to check your test data if it is consistent.

An error that is made in a test object will result in a wrong configuration in the project.

Put the Test Objects to use

After you designed or picked an appropriate number of test objects, start implementing the desired configuration in your project.

Now test with your test objects and observe if the behavior is as expected. If so, great! If not, locate the mistake and check again.

Repeat this cycle until all of your selected test objects produce adequate results.