Best practice for inserting mock data for you unit tests

  • 26 July 2022
  • 1 reply

At this moment we are trying to implement unit testing in our process. However, we encounter several problems.

The biggest problem we encounter is preparing the mock data, because it’s very time consuming. Is there anyone who could explain me what would be best practice for inserting mock data in the Software Factory. What we experience is that it is difficult and not user friendly to insert data values into a data row. It costs us a lot of time to insert this data, and it is not very clear what foreign keys are of the table and the domains  of the values. So, all tips and best practices would be very helpful. 


1 reply

Userlevel 6
Badge +4

Data entry and maintenance of large amounts of mock data can indeed be quite time consuming. The mock data screens are not designed with intensive data entry in mind. Generally, a few mocked records are enough to allow most unit tests to be built.

When it comes to data entry with foreign keys and domains - when inserting the mock data you do indeed not have the option to refer to other mock data as foreign keys ore to refer to domain elements to pick a database value. It could be technically feasible to allow selection of foreign keys or domain elements when entering mock data. Please submit an idea for this in the ideation section. 

In some scenarios, a large amount of mock data may be required. When working with such large mock data sets, it may be more efficient to set up a test database that contains the desired data and forgo setting up the mock data in the Software Factory. The test data can be entered and maintained by simply starting the application on the test database and will be included in data migration scripts when upgrading this test database to a new version.