Breaking news from around the world
Get the Bing + MSN extension
Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, PowerApps, Microsoft Flow, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates to Dynamics 365Release overview guides and videos Release Plan | Early Access Availability
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
This is the first part of Automated testing with Permissions, in this post I’ll visualize and explain the way it’s described on msdn and in part two I’ll go for a more practical approach which will support permissions per test function and partial execution of code with a permission set.
As a developer you’re responsible for writing automated tests, and every manual test you can automate should be automated, same goes for testing with permission sets.
In NAV 2017 Microsoft has introduced a way to do this, you can find all about it on msdn.
To make things a bit more clear I’ve created the image below:
So assigning permission set(s) should be done in the CAL Test Runner codeunit (130400) or by creating your own Test Runner.
Since the standard Test Runner does it’s job perfectly this is a bit odd but okay..
Each Test Codeunit and Test Function has it’s own TestPermissions property, you can either set it to Restrictive or NonRestrictive on Test Codeunit level or set it for each individual function.
The magic OnBeforeTestRun function is triggered for each test function, so that’s the place where you have to assign the desired permission set(s).
Your code will then look something like this:
Notice the global PermissionTestHelper variable, it’s a new dll added in NAV 2017.
The most important function is called AddEffectivePermissionSet, you can call this function multiple times to add effective permission sets.
Note: the Microsoft.Dynamics.Nav.PermissionTestHelper.dll is located in the server add-ins folder.
Business Applications communities