Skip to content


BHoM has several ways to cover developed functionality with Tests.

Storing unit test data for Engine Methods

Engine methods can be tested against regression via "Unit tests" that can be run automatically via CI/CD. Unit tests in this context consists in running Engine methods with pre-stored input data and comparing their results with pre-stored output data. This way, it is possible to check that Engine methods keep behaving reliably.

To store data for tests, you can use the Test_Toolkit and the Unit Test component.



  1. Compile the Test_Toolkit - it contains some useful methods that are not shipped in the BHoM installer.
  2. Drop a Unit Test component in a script.
  3. Right click the component and use the search field to find the method you want to store test data for.
  4. Produce the test data for the method. The test data should be any input object that you may want to feed to the Engine method. The test data should be representative of the general usage of the method.
  5. Connect the test data to the Unit Test component. The compnent will execute the target method in the backend with the provided data, and it will return one or more Unit Test objects, which contain the input and outputs related to the method execution.
  6. The Unit Test objects should now be stored in the .ci folder of the repository that defines the method being tested. We store the objects as json. In order to do this reliably, you can use the Test_Toolkit's StoreUnitTests function, like so:


The StoreUnitTests function will save the test data in the .ci folder of the repository. Make sure to commit and push the data in your PR.

Last update: March 17, 2023