Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
Preview features aren’t meant for production use and may have restricted functionality. These features are available before an official release so that customers can get early access and provide feedback.
Testing your model-driven application with Test Engine requires the following steps:
Create a test plan
Create a yaml file using the test plan schema explained in Power Apps Test Engine YAML format (preview).
Tip
Review available sample plans in the GitHub repository.
Enable preview
Currently, all model-driven app extension testing capabilities require using Preview functions. To enable these, add Preview
to the allowPowerFxNamespaces
list in extensionModules of your testSettings.
This example shows you how to add this:
testSettings:
extensionModules:
enable: true
allowPowerFxNamespaces:
- Preview
Set up your user
Test Engine currently has these authentication methods:
Method | Description |
---|---|
Storage State | Store authenticated user state locally in the user profile using Microsoft Windows Data Protection API |
Dataverse | Store authenticated user state inside Dataverse using your own customer managed key encrypted with an X.509 certificate using ASP.NET Core Data Protection |
You can't store test credentials in test plan files. You must select Storagestate
or Dataverse
as the secure ___location to store credentials. The test plan file contains references to which environment variables are used for user persona. For example, the following YAML snippet indicates that the user1Email
environment variables are used:
environmentVariables:
users:
- personaName: User1
emailKey: user1Email
View Users for more information.
Use the following PowerShell script to store the username in your environment variables.
$env:user1Email = "someone@example.com"
Run the test
Use the PAC CLI pac test run command to run your test plan.
Required Parameters
You need to provide the following information:
--test-plan-file
: Path to your test plan file--tenant
: Your tenant ID--environment-id
: Your environment ID--___domain
: Domain URL of the model-driven app page to test
URL Formats for Model-Driven Apps
For model-driven apps, the --___domain
parameter varies based on the type of page you're testing. The URL format should specify the correct pagetype
based on your testing scenario:
# For custom pages
pac test run `
--provider mda `
--test-plan-file your-testplan.te.yaml `
--tenant your-tenantid-guid-value `
--environment-id your-environmentid-guid-value `
--___domain "https://contoso.crm.dynamics.com/main.aspx?appid=00001111-aaaa-2222-bbbb-3333cccc4444&pagetype=custom&name=dev_home_c8017"
# For entity lists (views)
pac test run `
--provider mda `
--test-plan-file your-testplan.te.yaml `
--tenant your-tenantid-guid-value `
--environment-id your-environmentid-guid-value `
--___domain "https://contoso.crm.dynamics.com/main.aspx?appid=00001111-aaaa-2222-bbbb-3333cccc4444&pagetype=entitylist&etn=account&viewid=5a84c584-df1c-ed11-9db0-000d3a991110"
# For entity records (forms)
pac test run `
--provider mda `
--test-plan-file your-testplan.te.yaml `
--tenant your-tenantid-guid-value `
--environment-id your-environmentid-guid-value `
--___domain "https://contoso.crm.dynamics.com/main.aspx?appid=00001111-aaaa-2222-bbbb-3333cccc4444&pagetype=entityrecord&etn=account&id=72e0e163-df1c-ed11-9db0-000d3a991110"
Dataverse Integration
To enable Dataverse integration with your model-driven app tests, add the enableDataverseFunctions
parameter in your testSettings:
testSettings:
extensionModules:
enable: true
allowPowerFxNamespaces:
- Preview
parameters:
enableDataverseFunctions: true
When you enable Dataverse integration, you're required to open Azure CLI with a user or service principal that has rights to the Dataverse environment. You can use the command: az login More information: Sign in with Azure CLI.
The Dataverse API URL used for integration is obtained either from the host ___domain name of the pac test run --___domain
parameter or by defining an PowerShell environment variable named DATAVERSE_URL
.
View the results
When the tests complete, you can view the results of your test in the .trx
file located in the output directory. This folder contains any screenshots or videos captured by your tests when recordVideo
is set to true
in the test plan yaml.