New Upload weather data from web services into TM1/Planning Analytics — Read the post →

Module 5: Test Collections, Code Coverage & Tips

Executing Test Collections

Test Collections allow you to run multiple unit tests in sequence for quicker feedback and easier integration into your development workflow.

Creating a Collection

  1. Click New Collection in the Test Hub toolbar.
  2. Enter a name (e.g., All Test Cases) and description.
  3. Click the Entries tab and add your unit tests using the arrow button.
  4. Click Save.

Running a Collection

  1. Click the Execute (lightning bolt) icon next to your collection.
  2. You'll be prompted: "Are you sure?" — optionally tick Measure Code Coverage.
  3. Click Yes to run.

Understanding Code Coverage

When you enable Measure Code Coverage, the Test Hub tracks which lines of TI code are actually executed during the test run.

ColourMeaning
🟢 GreenCode was executed during the test run
🔴 RedCode was missed or bypassed during the test

After the run, click the Coverage tab to see results per TI process. For example, Dim.Employee.AddNewEmployee shows 92% coverage — the line sDept=ATTRS('Department', pDept, 'Description'); was not hit, which could indicate:

  • Obsolete or dead code
  • Incorrect test data not triggering that branch
  • A conditional logic issue

Importing and Exporting Collections

Collections can be shared between developers or migrated across environments (e.g., DEV → QA → UAT).

ActionSteps
ExportGo to Test Collections → click the Export (upload arrow) icon → saves a JSON file
ImportGo to Test Collections → click the Import (download arrow) icon → select your JSON file → click Upload

A sample collection with all 5 test cases from this course is available at:
https://downloads.cubewise.com/Arc/Hands-on/test-hub-collection-export.zip

Best Practice Tips

  • Run processes with different values and parameters to ensure all code paths are tested.
  • Include invalid values in test cases to test error-handling branches.
  • Use Test Coverage regularly to identify untested conditional branches.
  • Use the Clean Up section to always leave your TM1 model in a clean state after testing.
  • Integrate test collection execution into your deployment workflow (DEV → QA → UAT).