Загрузка...

How to Run your Microsoft Dynamics 365 Business Central Tests in Power shell.

You can also run the tests via PowerShell, which you need in your build pipelines. In the NavContainerHelper, you can find the Cmdlet Get-TestsFromBCContainer and Run-TestsInBCContainer.

With the Get-TestsFromBCContainer, you get a list of all the available tests. Optionally you can specify the -testSuite option to set the required Test Suite. By default, the DEFAULT Test Suite is used.

Get-TestsFromBCContainer -containerName MyDevContainer -credential $credential

To specify the credentials if you are using NavUserPassword as your authentication type, you can create a PowerShell variable:

$credential = New-Object pscredential 'admin', (ConvertTo-SecureString -String 'P@ssword1' -AsPlainText -Force)

After that you can run the tests using the Run-TestsInBCContainer, which will give you a list of the failed or succeeded functions.

Run-TestsInBCContainer -containerName MyDevContainer -credential $credential -detailed

The -detailed option only shows extra information on the host, and will print information about every test, whether they succeeded or failed. If you omit this option, only failing tests will be displayed in the output.

You can optionally set options on the Cmdlet:

testSuite: you will always filter the tests to a specific test suite. By default, you filter to the DEFAULT test suite, which means that the remaining parameters will only filter tests in that test suite.

testGroup: name pattern of the test group to run -- or * to run all test groups in the test suite.

testCodeunit: name or ID pattern of test codeunits to run -- or * to run all test codeunits in the test group / suite.

testFunction: name pattern of the test functions to run -- or * to run all test functions in the test codeunit / group / suite.

The Run-TestsInBCContainer can also create an XUnit compatible output by specifying the -XUnitResultFileName option. This should be set to a file path which is shared with the container. XUnit is one of the formats that Azure DevOps supports to display information about the tests in the build pipeline.

Видео How to Run your Microsoft Dynamics 365 Business Central Tests in Power shell. канала Tek Na Msangi
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять