Microsoft have also release a unit testing framework for powerquery, though it requires the framework to be in the same file, by the looks of things.
It would be good if the unittest module could also cope with unit tests expressed as Facts, to make it easy for people who started in that framework to port it to the LibPQ way of doing things
Thank you for pointing that out! It's great that they have finally offered an unit testing solution. It is unfortunate though that it is not included into the standard library. Copy-pasting functions into each project makes updating and maintaining them very difficult. I suspect the framework will be significantly reworked when (and if) it'll get widely adopted, and only then (maybe) it will become part of the language.
Even though I see no benefits to their approach, adding support for it was an interesting challenge :) I've added my own implementation of
Facts.Summarize functions to the
ms-tests branch. They are fully compatible input-wise with Microsoft's implementation but produce output that can be integrated into existing LibPQ UnitTest framework. More than that,
UnitTest.Discover now supports test discovery for fact based tests if they are marked with proper metadata (
The code will remain in the feature branch for a while, but please test it and report any problems. Sometime later I'll write the required documentation and will merge
ms-tests into master.
Facts.Summarize(LibPQ("Tests.MicrosoftUnitTestDemo.pq")) to see new tests in action. Sample test code is included into