This guide provides instructions for building the open source version of the Test Engine from source. The open source version includes the latest features, supports, and an open source pull request approach for new changes to be reviewed and merged if they align with the product direction. The main branch is synchronized with the internal build process to distribute release builds as part of the pac CLI. The open source version is a great way to understand and extend the Test Engine and contribute to the wider testing community.
Depending on your options available you have a have a range of different hosting options to carry out a build from source strategy
If you are Windows and have Hyper-V enabled as a service you could take advantage of building Virtual Machines to create isolated machines. You can use the Create a virtual machine in Hyper-V.
NOTE: You will need to expand the disk size required for Ubuntu Hyper-V machine, for example selecting 20GB should provide enough disk space.
You can select from a range of cloud hosted machines like Quickstart: Create a Windows virtual machine in the Azure portal
You can also take advantage of Power Platform Hosted Machines for integrated solution with the Power Platform to have a Domain Joined Windows 11 Cloud PC.
Using Windows 11 as an example you can use the following steps to build from source
Download PAC CLI https://learn.microsoft.com/power-platform/developer/howto/install-cli-msi
Get Git so we can clone the samples
winget install --id Git.Git -e --source winget
winget install -e --id Microsoft.VisualStudioCode
Winget install -e --id Microsoft.AzureCLI
winget install --id Microsoft.PowerShell --source winget
winget install Microsoft.DotNet.SDK.8
Using Ubuntu 22.0.4 LTS as an example you can use the following steps to build from source
sudo apt update
sudo apt upgrade
sudo apt install git
snap install code --classic
NOTE: The classic flag is required as Visual Studio Code needs full access to the system similar to a traditionally installed application
snap install powershell --classic
snap install dotnet-sdk --classic
snap install curl
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
dotnet tool install --global Microsoft.PowerApps.CLI.Tool
export PATH="$PATH:~/.dotnet/tools"
export DOTNET_ROOT=/snap/dotnet-sdk/current
# Add .dotnet/tools to the PATH environment variable
$env:PATH += ":$HOME/.dotnet/tools"
# Set the DOTNET_ROOT environment variable
$env:DOTNET_ROOT = "/snap/dotnet-sdk/current"
To verify your selected environment has all the prerequisite tools required
pac auth help
git --version
code
az --version
pwsh --version
dotnet --list-sdks
The following steps give an example of running sample from Microsoft Windows.
git clone https://github.com/microsoft/PowerApps-TestEngine.git
cd PowerApps-TestEngine
git checkout integration
pwsh
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
$Params = @{
DnsName = @("localhost", "localhost")
CertStoreLocation = "Cert:\CurrentUser\My"
NotAfter = (Get-Date).AddMonths(6)
KeyAlgorithm = "RSA"
KeyLength = 2048
}
New-SelfSignedCertificate @Params
NOTE: For Ubuntu the following could be used to create local certificate
openssl req -x509 -nodes -days 180 -newkey rsa:2048 -keyout mycert.key -out mycert.crt -subj “/CN=localhost”
pac auth create --name Dev --environment https://contoso.crm.dynamics.com
pac auth create --name Hosting --environment https://contoso-host.crm.dynamics.com
az login –allow-no-subscriptions
Import the WeatherSample_*.zip from samples\weather into the environment you want to test
Import the TestEngine_*.zip (Will be used to store authentication state)
Add the config to the “samples/weather” folder using Visual Studio Code
{
"tenantId": "d1234567-1111-2222-3333-4444555666",
"environmentId": "a000000-1824-e982-98d9-190558c8750f",
"customPage": "te_snapshots_24d69",
"appDescription": "Weather Sample",
"user1Email": "user1@contoso.onmicrosoft.com",
"runInstall": true,
"installPlaywright": true,
"DataProtectionUrl": "https://contoso-host.crm.dynamics.com/",
"DataProtectionCertificateName": "CN=localhost",
"pac": "optional/pac.exe",
"auth": "certstore",
"authstate": "dataverse"
}
NOTE:
- The pac parameter is optional and only needed if needing to use a specific version of pac cli
- Can use auth value of certenv for based64 version of X.509 certificate to encrypt/decrypt
- If using auth value of certenv the DataProtectionCertificateName is not required
- You can use an authstate of storagestate on windows for local Data Protection API encrypted login details
- The export.ps1 can be sued to export the local certificate for use on another machine
Open pwsh session
Change to samples/weather
cd samples/weather
pwsh -File RunTests.ps1