Edit

Share via


Power Apps Test Engine samples

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.

This page provides an overview of the sample projects available in the Power Apps Test Engine repository. These samples demonstrate various testing capabilities and scenarios to help you understand how to create effective tests for your Power Platform solutions.

Available samples

The following samples are available in the PowerApps-TestEngine GitHub repository:

Sample Description
Basic Gallery Demonstrates how to test interactions with controls within a basic gallery in a canvas app. Sample shows how to assert label text values and navigate between gallery items.
Button Clicker Simple test that verifies a counter increments when a button is clicked. Shows how to use test lifecycle hooks (OnTestCaseStart, OnTestCaseComplete) and basic control interactions.
Calculator Tests a calculator component with multiple operations (Add, Subtract, Multiply, Divide). Demonstrates how to test components with input and output controls.
Copilot Studio Kit Advanced sample demonstrating tests for the Power CAT Copilot Studio Kit. Features testing of multiple custom pages, report generation, and entity-based testing.
Containers Shows how to interact with controls inside container components, verifying property changes and event handling.
Dataverse Demonstrates testing Dataverse operations using Power Fx actions. Shows how to create, read, update, and delete records directly with Dataverse.
Different Variable Types Showcases testing with multiple data types (String, Number, Boolean, Date, Record, Table) using various controls like TextInput, Rating, Toggle, DatePicker, Dropdown, and ComboBox.
Many Screens Tests navigation between multiple screens in a canvas app, verifying correct screen transitions and content.
MDA Header Control Tests the header control interactions in a model-driven app, demonstrating testing of model-driven app UI elements.
Nested Gallery Demonstrates testing nested galleries with both row and column galleries. Shows how to select items in nested galleries and validate selection state.
PCF Component Shows how to test Power Apps Component Framework (PCF) components, specifically an increment control component.
Permissions Demonstrates testing with different user permission scenarios. Tests how applications behave with various security roles and access levels.
Screen Navigation Focuses on testing screen navigation capabilities, verifying correct transitions between screens.
Weather Shows how to mock connector responses for the MSN Weather connector. Demonstrates testing with simulated external service calls.

Sample structure

Most samples follow a common structure:

  • README.md: Explains the sample's purpose, prerequisites, and usage instructions
  • RunTests.ps1: PowerShell script to execute the tests
  • config.json: Configuration settings for the test environment
  • Test YAML files: Test definitions (.fx.yaml or .te.yaml)
  • Solution package: A .zip file containing the sample app (for some samples)

Common features demonstrated

These samples demonstrate several key testing capabilities:

Basic test operations

Basic test operations include:

  • Setting and getting control properties
  • Verifying control values and visibility
  • Clicking buttons and interacting with controls
  • Waiting for conditions before proceeding

Advanced testing features

Advanced testing features include:

  • Navigation between screens and forms
  • Working with galleries and collections
  • Testing with different data types
  • Mocking external services and connectors
  • Testing with different user contexts

Test lifecycle management

These are examples of test lifecycle management:

  • Using OnTestCaseStart and OnTestCaseComplete hooks
  • Configuration for different environments
  • Error handling and test diagnostics
  • Video recording and screenshot capabilities

Getting started with samples

To use a sample, follow these general steps:

  1. Clone the PowerApps-TestEngine repository
  2. Install prerequisites as described in the sample's README
  3. Configure your environment in the config.json file
  4. Import the sample solution if provided
  5. Run the tests using the RunTests.ps1 script

For detailed instructions, refer to each sample's README.md file and the Test Engine documentation.

Using samples for learning

The samples provide excellent learning resources:

  1. Start simple: Begin with the Button Clicker or Basic Gallery samples for fundamental concepts
  2. Progress gradually: Move to more complex samples as you gain confidence
  3. Customize tests: Modify the samples to match your own application's requirements
  4. Learn by example: Use the sample code patterns as templates for your own tests

Test Engine Overview
Power Fx Functions for Testing
YAML Test Format
Authentication Guide
AI-assisted Test Authoring