Getting Started With Testing

This is an extension of the basic getting started. This Tutorial will show you how to set up some basic tests for your model. To demonstrate the concepts we will set up two test suites:

  • one for testing the parameter table selection logic
  • another one for testing the calculation.

Create the Scoring Table Test Suite

The basic concept in testing within Formulative is a test suite. It essentially defines which parts of your model will be visible for the tests within.

Navigate to the Project Testing area using the left menu (Tests).

Click New Test Suite:

  • Test suite name: Scoring Table
  • Modules to include: Interest from Scoring

Click New Test Plan:

  • Test Plan name: Lookup APR
  • Select Score as input variable and apr as the output variable.

A Test Plan is a collection of tests run against the same input and output variables. We will use this now to check if the lookup provides the right APR values for different Scores.

Click New Test Case:

  • set Score to 760
  • open down Expectations and set the expectation to apr = 4.17
  • click Run

You should see the green Succeeded displayed:

../_images/test-result-apr-1.png

Test result

Note

You can add as many expectations as you want for each test case.

Add another Test Case to test if the model returns 5.759 when the Score is 620.

Create the PMT From Scoring Suite

Create a new Test Suite, this time for the payment calculation based on the client’s score:

  • Test suite name: PMT from score
  • Modules to include: PMT, Interest from Scoring

Create a new Test Plan:

  • Test Plan name: Monthly Payment tests
  • Select P, Score, T as input variable and c r as the output variable.

Create a new Test Case

  • Set input variables:
  • P : 200000
  • Score : 720
  • T : 30
  • Add a new expectation c_'r = 1000.58

You should see that your expectation succeeded.

Note

You can practice adding more output variables, like the monthly rate and specify expectations for those intermediate variables too within the same test case.

../_images/test-result-pmt-1.png