{"title":"Run AL tests from Visual Studio Code with Test Explorer","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-test-explorer-vscode/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-test-explorer-vscode, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-test-explorer-vscode","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Learn how to use the Test Explorer in Visual Studio Code to discover and run AL tests for Business Central directly from the IDE.","date":"2026-03-05","meta":{"topic":"how-to"},"outline":[{"level":1,"title":"Run AL tests from Visual Studio Code with Test Explorer","slug":"run-al-tests-from-visual-studio-code-with-test-explorer","at":0,"chars":3510},{"level":2,"title":"Prerequisites","slug":"prerequisites","at":359,"chars":237},{"level":2,"title":"Discover and run tests","slug":"discover-and-run-tests","at":596,"chars":747},{"level":2,"title":"Test run profiles","slug":"test-run-profiles","at":1343,"chars":540},{"level":2,"title":"View code coverage information","slug":"view-code-coverage-information","at":1883,"chars":490},{"level":2,"title":"Test execution","slug":"test-execution","at":2373,"chars":490},{"level":2,"title":"Supported environments","slug":"supported-environments","at":2863,"chars":401},{"level":2,"title":"Related information","slug":"related-information","at":3264,"chars":246}],"text":"# Run AL tests from Visual Studio Code with Test Explorer\n> APPLIES TO: Business Central 2026 release wave 1 and later\nYou can use the built-in Test Explorer in Visual Studio Code to discover and run AL tests in your workspace. This feature lets you run tests directly from the IDE instead of using an external test runner or the Business Central web client.\n## Prerequisites\nBefore you run tests from Visual Studio Code, make sure you meet the following requirements:\n Business Central version 28.0 or newer (2026 release wave 1).\n The AL Language extension for Visual Studio Code is installed.\n## Discover and run tests\nThe Test Explorer automatically detects test codeunits and test methods in the active workspace.\n1. Open the Test Explorer view in Visual Studio Code. Learn more about the Test Explorer in Testing in Visual Studio Code<https://code.visualstudio.com/docs/debugtest/testing>.\n1. Verify that your test codeunits appear in the test list. Only tests in the active workspace are added to the Test Explorer. Tests are sorted first by their owning app, then by the codeunit that declares them, and finally the test procedures themselves.\n1. Select the test you want to run, and then choose the Run button. Learn more in the #test-run-profiles section.\n1. Review the test execution progress and results in the Test Results panel.\n## Test run profiles\nWe support the following run profiles:\nProfile name|Description\nPublish & Run|Publishes the test project and any of its dependencies (if they have changed) before running the selected tests. This is the default run profile.\nRun|Runs the selected tests without prepublishing the project.\nRun & Debug|Publishes the test project and starts a run with the debugger attached.\nCoverage (Procedure)|Runs the selected tests and collects procedure-level code coverage. Learn more in the #view-code-coverage-information section.\n## View code coverage information\nWhen the Coverage (Procedure) run profile is selected, the test run keeps track of the procedures and triggers that are invoked by each test. This information is then surfaced as a new CodeLens on the relevant procedures and triggers.\n![Test run CodeLens showing coverage information]\nClicking on this new CodeLens will execute the tests that had covered the procedure or trigger. This is useful when making changes to quickly run the most relevant tests.\n## Test execution\nTests run from Visual Studio Code don't execute under an AL test runner codeunit<devenv-testrunner-codeunits>. This has a few implications.\n1. Running AI tests isn't supported.\n2. Any tests that rely on events published in a test runner for test setup or teardown might not work.\n3. Isolation level is determined by the properties/devenv-requiredtestisolation-property property set on the test codeunit. If this property isn't set, we default to Codeunit level isolation.\n## Supported environments\nRunning tests from Visual Studio Code is supported on Business Central version 28.0 and newer on the following environments:\n Online sandbox environments.\n Local (on-premises) server installations.\n> NOTE\n> Running tests on production environments isn't supported because it might affect business operations. See Testing the application overview<devenv-testing-application>.\n## Related information\nTesting the application overview<devenv-testing-application>\nCreate test codeunits and test methods<devenv-test-codeunits-and-test-methods>\nTesting in Visual Studio Code<https://code.visualstudio.com/docs/debugtest/testing>"}