Run Manual Tests

Introduction

Configure a Unit Test

You create and set the configurations for your tests in the FPP Unit Tests configuration page. From the Toolbar, click Tests. The Unit Tests configuration page opens in a new window.

Fig. 40: FPP Unit tests configuration.

Fig. 40: FPP Unit tests configuration.

Details about the Execution configuration tab are explained in the Execution configuration section.

By default, the execution configuration and the location of your library, tests, documents and pricing data is given.

You can also refine your test executions with the following options (numbers refer to fig. 40):

  1. Whitelist tests – tests configured for execution.
  2. Blacklist tests – tests excluded from the execution.

You can select multiple tests using the Whitelist and Blacklist options.

Some options available in the FPP Unit tests configuration are the following (numbers refer to fig. 40):

  1. Check results – When selected, the test execution is going to compare expected and obtained results.
  2. Significant figures – The tolerance for the differences between expected and obtained results if any.
  3. Override results – The test execution is going to populate the expected results with the obtained results.

The FPP Unit Tests Configuration Files

To run a test configurations you use the following three types of files:

File type Description Extension
Documents JSON files that store the deal attributes. Stored in /src/test/resources/documents/ .json
Pricing data JSON files that store the required data to run computations in parallel. Stored in /src/test/resources/pricingData/ .scn
Tests Files with the input reference and expected output of the test. Stored in /src/test/resources/tests/ .json

Template - Your First Test

You are provided with two tests files called tutorial_EUadvanced_test and tutorial_IRS_test.

To run your first test
  1. On the toolbar, click Test and select Open unit tests configuration to open the unit tests window.
  2. Click Run, with the default values. The tests run and the confirmation message is displayed at the end.
Fig. 41: Run first tests.

Fig. 41: Run first tests.

Because there is no tests restricted or selected, all tests located in the tests folder are executed.

To view your results, go to:

  • Unit Tests Explorer: Here you see the tests by name and input document. In the previous example the color for all is green meaning that all tests were successful.

  • Unit Tests Logs: You see the details of the errors and the logs for the selected tests.

Create the Test File

To create a test file

  1. In Explorer, browse to: fpp-library-fmb/src/test/resources/tests
  2. Create a new test file and name it EUadvanced_test.
  3. Open the file and enter the following code:
{
  "associatedScript" : "tutorial_EUadvanced",
  "marketDataSetName" : "tutorial_EUadvanced.scn",
  "testName" : "EUadvanced_test",
  "documents" : {
   "tutorial_EUadvanced.json" : {
      "expectedResults" : { }
  }
 }
}

Leave the expectedResults field empty and select the Override results check-box to have it automatically filled.

Run the Test

To run a test and overriding results
  1. Go to the FPP Unit tests configuration, and select the Override results check box.
  2. Whitelist your test EUadvanced_test and click Run.
Fig. 42: FPP Unit Tests configuration.

Fig. 42: FPP Unit Tests configuration.

You get the following results:

Fig. 43: Result overriding results.

Fig. 43: Result overriding results.

The expectedResults field in the test document was filled with values computed during the script execution.

Results visualization:

  • Unit Tests Explorer: The color of the test is red for overriding results.

  • Unit Tests Logs: In the errors section you received the message Results overridden.

When the Override results check-box is selected, the test execution is checking any result and it turns red. This is to remind you that all results will be overridden.

To run a test without overriding results
  1. Go to the FPP Unit tests configuration, and unselect the Override results check-box.
  2. Whitelist your test EUadvanced_test and click Run to get the following results:
Fig. 44: Result test configuration.

Fig. 44: Result test configuration.