With these two tests you get 100% test coverage for the variable model, as the code tests all possible variations of the variable. So when you write tests, you need to know how the model works and you need to be able to fully cover the different scenarios that imaginative users can use when working with their model code. The purpose of the test is to validate the model code so that it sends an expected output back to a given and tested input. This method executes the model code, mocks the APIs it replaces, and uses the data object it passes through as an argument. Testing in this context specifically refers to testing the components you write to make sure that the code in your model works predictably. Component testing is also used to promote development and ensure that unforeseen events are added for all the different scenarios the model can introduce, along with user feedback. Your only goal is to test the code you write, but the tests are done with. The unit tests include the code that runs into the actual functions and variables of your model code. Finally, the result of runCode is passed to confirm that, a statement method that checks whether the result of the code dissolves into a predicted value. Google Tag Manager custom templates provide fictitious data in two ways: the content of the data object and the result of running the API model. However, I recommend that the number of claims per test is kept to a minimum, as granular test cases make it easier to identify the link between the test error and the erroneous code that caused the error. Why? Why? Because we decided to manage this in the user interface, we added a validation rule that prevents the implementation of the model code if no input in the field is done. This way you can run the test as if the model called the API, and treat the returned value as if the API returned it.