How do I: test code that calls external web services

With the current test framework and it’s limitations it can sometimes be hard to find a way to test your code, this gets even worse when external web services are called.
I’ve seen a number of (bad) workarounds in the last few months varying from calling a nonexistent endpoint to a self-hosted web service to test against.
Of course those workarounds do their job but we can do better than that, and let’s not forget tests must be independent of external components!

Ideally we would simply mock this web service call and return some data we can test against, but not in (C/)AL right?

NAV2018: xRec in OnModify

Every now and then a developer takes the xRec bait and they’re wondering why their code doesn’t work and it usually ends up with a lot of lost time combined with a good amount of frustration.
I hope most of you do know that if you trigger the OnModify through code and xRec is used in the OnModify trigger, Rec and xRec will be the same, however it works fine when it’s triggered through the UI. (more…)

Test libraries available for extension development soon!

With AL you can already create test codeunits, write test functions but you have to use your own libraries because all functions in the standard libraries are not marked as external..
After reporting an issue on GitHub Microsoft confirmed they’ll be marked as external in the January update!

In my next blog post I’ll show you how to get your docker development environment up and running with the test toolkit.

Moving your old dusty c/side dev environment to docker

The time has come, we can finally run multiple NAV versions, cu’s and localization’s side by side with Docker, but how do we actually move our old and dusty c/side development environment to a modern place? (more…)

Running automated tests for modified/selected objects

In the ideal world you have a nightly build, creating your entire solution from scratch, running all the automated tests that come with standard NAV and so on.
During business hours you basically want the same thing but a lot faster, you want to have feedback about your modifications as quickly as possible and running all the tests might be unnecessary and it’s very much time consuming.

Running Automated Tests From PowerShell

Automating your automated tests is just as important as creating and maintaining them, you want to be able to run your tests at least once a day and ideally multiple times a day or even after every check-in.

All we have to invoke these automated tests is PowerShell but there’s another challenge because the automated tests require a user interface and the Invoke-NAVCodeunit cmdlet does not support this.

Automated Testing with Permissions

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.

MS Connect Suggestion: Select multiple records on a TestPage object

Here’s another suggestion for the automated testing framework: a select function on a TestPage object.

In some cases you might face a (runmodal) page where a user has to select one or more records and based on that selection an action is performed, right now it’s not possible (correct me if I’m wrong) to actually simulate this with a TestPage object.

Please vote here or leave a comment.