Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for Microsoft-Format unittests to be run by the unit testing framework #14

Closed
metamoof opened this issue Aug 31, 2018 · 2 comments
Labels

Comments

@metamoof
Copy link

Hi,

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

@sio
Copy link
Owner

sio commented Aug 31, 2018

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 and 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 (LibPQ.TestSuite="Facts")!

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.

PS: Execute LibPQ("UnitTest.Discover")(false) and Facts.Summarize(LibPQ("Tests.MicrosoftUnitTestDemo.pq")) to see new tests in action. Sample test code is included into Modules/Tests.MicrosoftUnitTestDemo.pq

@sio sio added the feature label Aug 31, 2018
@sio sio closed this as completed in 0c969ea Sep 2, 2018
@sio
Copy link
Owner

sio commented Sep 2, 2018

Support for fact based tests has been merged into master. See this article for documentation.

Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants