Skip to content

Trigger a test task run in the Hydra Lab test service

HydraXMan edited this page Dec 27, 2022 · 7 revisions

Trigger a test task from ADO pipeline

Gradle Plugin

  1. Add the Gradle plugin to your build.gradle.
  1. Apply Gradle plugin in your project:
    plugins {
    
     id "com.microsoft.hydralab.client-util" version "$your_version"
    
    }
    apply plugin: "com.microsoft.hydralab.client-util"
    
    Or
    buildscript {
        repositories {
            maven {
                url "https://plugins.gradle.org/m2/"
            }
            google()
        }
        dependencies {
            classpath 'com.microsoft.hydralab:client_utils_gradle_plugin:$version'
        }
    }
    apply plugin: "com.microsoft.hydralab.client-util"
    
  2. Run Gradle task requestHydraLabTest implemented in the Gradle plugin for running test.
     - task: Gradle@2
       displayName: Trigger Hydra Lab UI test
       inputs:
         gradleWrapperFile: 'UIAutomation/gradlew'
         workingDirectory: 'UIAutomation'
         tasks: 'requestHydraLabTest -PappApkPath=$(build.artifactstagingdirectory) -PtestApkPath=$(build.artifactstagingdirectory)\testApk -PbuildFlavor=$(flavor)$(ltwFlavor) -PtestSuiteName=$(testSuiteName) -PqueueTimeOutSeconds=$(testQueueTimeOut) -PrunTimeOutSeconds=$(testRunTimeOut) -PdeviceIdentifier=$(Android.Device.Identifier) -PgroupTestType=$(groupTestType) -PextraArgs="type=$(Build.Reason),buildId=$(Build.BuildId)" -PreportAudience=TestLabOwner -PauthToken=$(authToken) -PpkgName=$(pkgName) -PtestPkgName=$(testPkgName)'
         publishJUnitResults: false
    
  3. PublishTestResults task for publishing test result to tests tab in pipeline result page.
     - task: PublishTestResults@2
       displayName: 'Publish Test Results build/outputs/androidTest-results/connected/flavors/$(flavor)$(ltwFlavor)/TEST-*.xml'
       inputs:
         testResultsFiles: 'UIAutomation/build/outputs/androidTest-results/connected/flavors/$(flavor)$(ltwFlavor)/TEST-*.xml'
         testRunTitle: 'YPC-Test-Result'
         failTaskOnFailedTests: true
    
    The "authToken" in the parameter list of pipeline can be found on the HydraLab Portal: image

Testing Result

  • Test result can be found in Tests tab of pipeline running result page:
    image
  • Click on error items on above image to see detailed stack traces:
    image
  • The link of related testing video will also show in pipeline log.

Trigger a test task from Web UI.

Upload Test Package

image image

Choose Device and Config Test Task

image image image

View Test Result

image image

Clone this wiki locally