vestergaardj's avatar
vestergaardj
Most Valuable Professional
4 months ago

Unit Testing DAX w/ Semantic Link

Semantic Model Test Harness: Unit & Regression Testing for DAX

No one likes finding out a DAX measure broke because someone renamed a column last Tuesday. This notebook brings unit testing to semantic models in Microsoft Fabric.

You define test cases as rows in a DataFrame: the measure name, a filter context, and the expected value. The harness builds EVALUATE ROW(...) queries, sends them to your model via Semantic Link Labs' evaluate_dax_impersonation, and reports pass/fail with full traceability (actual vs. expected, the exact DAX query used).

What it does:
- Runs parameterized DAX tests against any Fabric semantic model
- Handles filter context quoting (single vs. double quotes) automatically
- Supports both boolean filters and table function expressions in CALCULATE
- Catches and logs errors instead of failing silently
- Produces a results DataFrame suitable for CI/CD pipeline integration

Built for BI developers and data engineers who want to validate business logic after model changes without opening a browser and eyeballing report pages. Drop the notebook into your workspace, define your tests, run it before or after deployments.

Requires: Microsoft Fabric workspace, a published semantic model, and the sempy_labs (Semantic Link Labs) package.

 

Author: Jens Vestergaard · Head of Product, CatMan @ Redslim
Repository: [github.com/vestergaardj/](https://github.com/vestergaardj/Semantic-Link-TestHarness)
Built on: Semantic Link Labs by Michael Kovalsky

 

No RepliesBe the first to reply