Capgemini.PowerApps.SpecFlowBindings
0.7.0-alpha
See the version list below for details.
dotnet add package Capgemini.PowerApps.SpecFlowBindings --version 0.7.0-alpha
NuGet\Install-Package Capgemini.PowerApps.SpecFlowBindings -Version 0.7.0-alpha
<PackageReference Include="Capgemini.PowerApps.SpecFlowBindings" Version="0.7.0-alpha" />
paket add Capgemini.PowerApps.SpecFlowBindings --version 0.7.0-alpha
#r "nuget: Capgemini.PowerApps.SpecFlowBindings, 0.7.0-alpha"
// Install Capgemini.PowerApps.SpecFlowBindings as a Cake Addin #addin nuget:?package=Capgemini.PowerApps.SpecFlowBindings&version=0.7.0-alpha&prerelease // Install Capgemini.PowerApps.SpecFlowBindings as a Cake Tool #tool nuget:?package=Capgemini.PowerApps.SpecFlowBindings&version=0.7.0-alpha&prerelease
Power Apps SpecFlow Bindings
A SpecFlow bindings library for Power Apps.
The aim of this project is to make Power Apps test automation easier, faster and more accessible. It does this by providing a library of generic SpecFlow step bindings that adhere to test automation best practices. This allows effective automated tests to be written without the dependency on developers who are both proficient with Power Apps and test automation.
Table of Contents
Installation
Follow the guidance in the Installation and Setup section in https://specflow.org/getting-started/. After installing the IDE integration and setting up your project, install the NuGet package.
PM> Install-Package Capgemini.PowerApps.SpecFlowBindings
Once the NuGet package is installed, follow the SpecFlow documentation on referencing an external binding library. At the time of writing - for SpecFlow 3.x - you should update a specflow.json file in your project root as follows -
{
"stepAssemblies": [
{ "assembly": "Capgemini.PowerApps.SpecFlowBindings" }
]
}
WebDrivers
We do not have a dependency on any specific WebDrivers. You will need to ensure that the correct WebDrivers are available in your project based on the browser that you are targetting. For example - if your configuration file is targetting Chrome - you can install the Chrome WebDriver via NuGet -
PM> Install-Package Selenium.Chrome.WebDriver
Usage
Configuration
Installing the NuGet package creates a power-apps-bindings.yml file in your project's root. This is used to configure the URL, browser, and users that will be used for your tests.
url: SPECFLOW_POWERAPPS_URL
browserOptions:
browserType: Chrome
headless: true
width: 1920
height: 1080
startMaximized: false
users:
- username: SPECFLOW_POWERAPPS_USERNAME_SALESPERSON
password: SPECFLOW_POWERAPPS_PASSWORD_SALESPERSON
alias: a salesperson
The URL, usernames, and passwords will be set from environment variable (if found). Otherwise, the value from the config file will be used. The browserOptions node supports anything in the EasyRepro BrowserOptions
class.
Writing feature files
You can use the predefined step bindings to write your tests.
Scenario: User can create a new account
Given I am logged in to the 'Sales Team Member' app as 'an admin'
When I open the 'Accounts' sub area of the 'Customers' group
Then I can see the 'New' command
Alternatively, write your own step bindings (see below).
Writing step bindings
You can write your own step bindings that have thread-safe access to EasyRepro and the Selenium WebDriver. This ensures that your tests can be ran safely in parallel. You can do this by creating a class decorated with the SpecFlow BindingAttribute
and inheriting from the PowerAppsStepDefiner
base class. You can then create your SpecFlow step bindings by interacting with the XrmApp
and Driver
properties.
[Binding]
public class MyCustomSteps : PowerAppsStepDefiner
{
[Given(@"I have a custom step")]
public void GivenIHaveACustomStep()
{
// Interact with the inherited EasyRepro 'Browser' object.
// Interact with the inherited Selenium 'Driver' object.
}
}
Test setup
We are avoiding performing test setup via the UI. This speeds up test execution and makes the tests more robust (as UI automation is more fragile than using supported APIs). Given steps should therefore be carried out using the Client API, WebAPI or Organization Service.
You can create test data by using the following Given step -
Given I have created "a record"
It will look for a JSON file in the data folder. You must ensure that these files are copying to the build output directory. You do not need to include the .json extension when writing the step (the example above would look for 'a record.json').
The JSON is the same as expected by WebAPI when creating records via a deep insert. The example below will create the following -
- An account
- An primary contact related to the account
- An opportunity related to the account
- A task related to the opportunity
{
"@logicalName": "account",
"@alias": "sample account",
"name": "Sample Account",
"primarycontactid": {
"firstname": "John",
"lastname": "Smith"
},
"opportunity_customer_accounts": [
{
"name": "Opportunity associated to Sample Account",
"Opportunity_Tasks": [{ "subject": "Task associated to opportunity" }]
}
]
}
The @logicalName
property is required for the root record.
@alias
property can optionally be added to any record and allows the record to be referenced in certain bindings including the json for subsequent data creation steps per the example below:
Step 1 Given I have created "a contact"
{
"@logicalName": "contact",
"@alias": "sample contact",
"firstname": "John",
"lastname": "Smith"
}
Step 2 Given I have created "a account"
{
"@logicalName": "account",
"@alias": "sample account",
"name": "Sample Account",
"primarycontactid@alias.bind": "sample contact"
}
Contributing
Ensure that your changes are thoroughly tested before creating a pull request. If applicable, update the UI test project within the tests folder to ensure coverage for your changes.
Licence
Power Apps SpecFlow Bindings is released under the MIT licence.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- Dynamics365.UIAutomation.Api (>= 9.1.0.17139)
- FluentAssertions (>= 5.10.3)
- Microsoft.CrmSdk.CoreAssemblies (>= 9.0.2.26)
- SpecFlow (>= 3.1.97)
- System.IO (>= 4.3.0)
- System.Runtime (>= 4.3.0)
- YamlDotNet (>= 8.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.14.16 | 145 | 12/10/2024 |
0.14.16-bugfix-185-error0006 | 74 | 12/9/2024 |
0.14.15 | 1,112 | 7/1/2024 |
0.14.14 | 109 | 7/1/2024 |
0.14.14-bugfix-get-curre0002 | 293 | 5/29/2024 |
0.14.13 | 817 | 4/17/2024 |
0.14.12 | 108 | 4/17/2024 |
0.14.12-bugfix-webdriver0005 | 390 | 4/16/2024 |
0.14.10 | 9,314 | 9/28/2022 |
0.14.7 | 410 | 9/20/2022 |
0.14.6 | 5,563 | 8/5/2022 |
0.14.5 | 387 | 8/4/2022 |
0.14.4-feat-2021-relea-0006 | 495 | 3/29/2022 |
0.14.4-feat-2021-relea-0005 | 203 | 3/23/2022 |
0.14.4-feat-2021-relea-0004 | 690 | 1/7/2022 |
0.14.4-feat-2021-relea-0003 | 1,541 | 10/20/2021 |
0.14.3 | 11,235 | 6/29/2021 |
0.14.2 | 353 | 6/25/2021 |
0.14.0 | 352 | 6/24/2021 |
0.13.5 | 340 | 6/8/2021 |
0.13.2 | 7,441 | 3/11/2021 |
0.13.1 | 640 | 2/24/2021 |
0.12.1 | 630 | 1/26/2021 |
0.12.0 | 361 | 1/16/2021 |
0.12.0-extend-data-file0009 | 261 | 1/15/2021 |
0.11.0 | 343 | 1/13/2021 |
0.10.6-test-data-setup-0008 | 257 | 1/12/2021 |
0.10.5 | 1,513 | 1/4/2021 |
0.10.3 | 605 | 11/19/2020 |
0.10.2 | 431 | 11/19/2020 |
0.10.1 | 509 | 11/18/2020 |
0.10.0 | 835 | 10/28/2020 |
0.9.15 | 593 | 10/25/2020 |
0.9.14 | 497 | 10/20/2020 |
0.9.13 | 478 | 10/20/2020 |
0.9.12 | 456 | 10/18/2020 |
0.9.7 | 631 | 10/11/2020 |
0.9.5 | 476 | 10/11/2020 |
0.9.1 | 418 | 10/9/2020 |
0.9.0 | 424 | 10/9/2020 |
0.7.1-alpha | 504 | 9/16/2020 |
0.7.0-alpha | 578 | 9/16/2020 |