Installing the Test Toolkit

Photo by Sigmund on Unsplash

Installing the Test Toolkit

Automated Tests in Dynamics 365 Business Central

There are several options for installing the Test Toolkit in a Microsoft Dynamics 365 Business Central container. Which option is available to you depends on whether you are creating a new container or you already have one up and running.

Include Test Toolkit on container creation

The Test Toolkit can be included upon creation of your container through the BcContainerHelper PowerShell Module.

There are three switches that you can set in order to control which parts of the Test Toolkit will be installed:

  • -includeTestToolkit is the main switch and is required to enable the installation of the Test Toolkit. If specified alone it will cause a full install of the Test Toolkit which also includes Microsofts test suites.

  • -includeTestFrameworkOnly will only install the Test Framework. The Test Framework contains the required dependencies for developing automated tests.

  • -includeTestLibrariesOnly will install the Test Framework including a wide selection of libraries created by Microsoft.

Here is an example of how to create a container with the Test Toolkit included:

$username = "admin"
$password = ConvertTo-SecureString "#LetMeIn123" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $password)
$artifactUrl = Get-BCArtifactUrl
New-BcContainer "AUTOMATEDTESTS" -artifactUrl $artifactUrl -Credential $credential -updateHosts -accept_eula -includeTestToolkit -includeTestFrameworkOnly

Install the Test Toolkit on an existing container

When you already have a container running but want to start using the Test Toolkit you can install it with the BcContainerHelper PowerShell Module.

Running the command Import-TestToolkitToBcContainer command will install the Test Toolkit in the specified container.

It is also possible to specify the -includeTestFrameworkOnly and -includeTestLibrariesOnly switches as mentioned above.

Here is an example of how to install the Test Toolkit in an existing container:

Import-TestToolkitToBcContainer "AUTOMATEDTESTS" -includeTestLibrariesOnly