Search code examples
uwpazure-devopsazure-pipelinesappium-desktop

Run UWP appium tests in azure pipeline


Just wondering if it is possible to run Appium based UI tests for a UWP app in azure pipeline?

The first challenge is, how to deploy the UWP to test within the pipeline.


Solution

  • I managed to figure it out.

    1. We need to install the app after the build, which can be done using running the powershell script included in the build artifacts. But the important things is the installation of the certificate, which needed to be forced.
    - task: PowerShell@2
      displayName: 'Install app'
      inputs:
        filePath: '$(build.artifactstagingdirectory)\\AppxPackages\\MyApp_1.0.0.0_Test\\Add-AppDevPackage.ps1'
        arguments: '-Force'
    
    1. To run the test cases it is required that WinAppDriver is installed. See WinAppDriver in CI with Azure Pipelines

    2.1 You would also need to start and stop the win app driver before and after the tests

    - task: Windows Application Driver@0
      displayName: Starting WinAppDriver
      inputs:
        OperationType: 'Start'
        AgentResolution: '1080p'
    
    - task: VSTest@2
      inputs:
        testSelector: 'testAssemblies'
        testAssemblyVer2: |
          **\*Test*.dll
          !**\*TestAdapter.dll
          !**\obj\**
        searchFolder: '$(System.DefaultWorkingDirectory)'
        uiTests: true
    
    - task: Windows Application Driver@0
      displayName: Stopping WinAppDriver
      inputs:
        OperationType: 'Stop'