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 canvas apps with Test Engine requires the following steps:
Create a test plan
Test plans are defined using YAML format. You can author your own test plan or download recorded tests from Test Studio.
Author your own test plan
Create a yaml file using the test plan schema explained in Power Apps Test Engine YAML format (preview).
When choosing authoring your own test plan, you can take advantage of the following features:
- Additional Power Fx Functions: Use the extra registered Power Fx actions to interact with Power Apps component framework (PCF) components, enhancing the capabilities of your test plans.
- Define Custom Data Structures and Functions: Make use of User Defined Types (UDTs) and User Defined Functions (UDFs) to create reusable and maintainable test steps.
Tip
Review available sample plans in the GitHub repository.
Download recorded tests from Test Studio
Downloading recorded tests from Test Studio allows quick capture and replay of user interactions with your application. This method is useful for creating basic test cases without writing any code. However, it has limitations in terms of flexibility and the ability to handle complex scenarios.
If you have tests that you recorded in Test Studio, you can download them from Test Studio to reuse in Test Engine.
Use the Download suite button in Test Studio to download the test plan. Choose the test suite to download if you have multiple test suites.
Alternatively, use the Download button available under each test suite.
Make sure you update the config file and user configurations if you're using a different tenant or environment for this app.
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"
Note
The user password is no longer required in an environment variable. Review authentication for supported options.
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
Example command
Here's an example of running a test for a canvas application:
pac test run `
--provider canvas `
--test-plan-file your-testplan.te.yaml `
--tenant your-tenantid-guid-value `
--environment-id your-environmentid-guid-value
You can also use the shorter parameter aliases:
pac test run `
-p canvas `
-test your-testplan.te.yaml `
-t your-tenantid-guid-value `
-env your-environmentid-guid-value
Dataverse integration
To enable Dataverse integration with your canvas app tests, you can add the enableDataverseFunctions
parameter in your test settings:
testSettings:
extensionModules:
enable: true
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 az login command. 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.