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?
(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.
(more…)

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.
(more…)

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.
(more…)

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.

 

MS Connect Suggestion: Disable GUI in Test Functions

Since C/AL unit tests run in a client session GUIALLOWED will always be TRUE, if code behaves differently in case of GUIALLOWED = FALSE it’s not possible to actually test that code.

Especially when testing web services it would be great if you could just disable the UI in a test function.

Please vote here!

A bit off topic but in my opinion it should be possible to run unit tests without UI, how cool would it be if you can just call the Invoke-NAVCodeunit Cmdlet to test your code!?
Technically this is possible but a lot of standard NAV tests will fail because of unexecuted UI handlers…