Prerequisites
Before adding a test app, ensure you have:- A working AL-Go for GitHub repository
- Appropriate permissions to create pull requests in your organization
- Basic understanding of AL test codeunits
Create a Test App
Run the Create Test App workflow
Navigate to Actions in your GitHub repository, locate and select Create a new test app, then click Run workflow.Enter the required information:
- Name: The name of your test app
- Publisher: Your publisher name
- ID Range: The ID range for your test objects
Handle permission issues (if applicable)
If GitHub Actions are not allowed to create pull requests in your organization, you’ll receive an error message.To enable pull request creation by workflows:
- Go to Organization → Settings → Actions → General
- Under Workflow permissions, check Allow GitHub Actions to create and approve pull requests
Review and merge the pull request
Once the workflow completes, navigate to Pull Requests in your repository.Review the changes made by the workflow, which include:
- New test app folder structure
- Sample test codeunit
- Updated project configuration
Fix Failing Tests
The initial test app includes a sample test that may fail deliberately to demonstrate the testing workflow.Identify the test failure
If the CI/CD workflow fails, click on the failed workflow run to inspect the build details.The error log will show which test failed and why (typically a message mismatch in the sample test).
Fix the test in VS Code
- Open your project in VS Code
- Click the sync button to pull changes from the server
- Locate and open the HelloWorld.Test.al file (or your test file)
- Fix the test assertion to match the expected message
Commit and push your changes
- Stage your changes
- Commit with a descriptive message
- Push to the remote repository
Understanding Test App Behavior
Automatic Test Execution
Test apps are automatically run during CI/CD workflows. Failed tests block the pipeline, preventing broken code from being deployed.
Build Artifacts
Successful builds create test app artifacts alongside your main apps, available for download from the workflow run.
Environment Deployment
Test apps are deployed to configured environments along with your main apps, enabling testing in real environments.
Pull Request Testing
Pull requests automatically run tests, providing immediate feedback on code changes before they’re merged.
Best Practices
Test-Driven Development: Consider writing tests before implementing features. This ensures your code meets requirements and remains testable.
Organize Your Tests
- Keep test apps in separate folders from production apps
- Use meaningful test names that describe what they verify
- Group related tests in the same test codeunit
- Follow AL test framework conventions
Test Coverage
Continuous Integration
- Ensure all tests pass before merging pull requests
- Monitor test execution times to keep builds fast
- Fix failing tests immediately to maintain pipeline health
- Use test results to drive code improvements
Next Steps
Add Performance Tests
Learn how to add BCPT performance test apps to measure app performance
Configure Dependencies
Set up app dependencies from external repositories