-
Notifications
You must be signed in to change notification settings - Fork 101
Test Task Customization
On the Runner page, you can add attachments in a package set.
Name | Desc |
---|---|
Windows App | Will be installed by the command like Add-AppxPackage -ForceApplicationShutdown -forceupdatefromanyversion before testing. |
Common file | Will be loaded to the Load Dir by the chosen Load Type |
T2C Json | Only work for T2C test. |
Only work when the File Type is Common file. Copy or unzip the attachment to Load Dir.
Only work when the File Type is Common file and can't be empty. The format should be like firstLevelFolder/secondLevelFolder, and the firstLevelFolder will be generate under AgentInstallFolder.
Put the packages of app to AgentInstallFolder/storage/preApp. When the devices plugin in, the packages would be installed. If install failed, the agent main process will be shutdown.
When trigger a test task, you can set up the permissions needed to be grant before testing.
["android.permission.FOREGROUND_SERVICE", "android.permission.FOREGROUND_SERVICE"]
Hydra Lab now allows for 2 levels of test lifecycle action customization: task-level customization through RESTful API JSON, and agent-level customization through an agent configuration file (change requires agent service restart to take effect). The task level has limited capabilities according to the current design.
In the RESTful API, a test task is described as the TestTaskSpec object, where you can specify the device actions for each test run in the following structure:
When triggering a test task, you can customize some actions to set up the devices at different lifecycle stages. For Example:
{
"setUp": [{
"method": "setProperty",
"args": ["log.tag.WelcomeScreen", "Verbose"]
}, {
"method": "setProperty",
"args": ["log.tag.ConsentDialog", "Verbose"]
}, {
"method": "backToHome",
"args": []
}
],
"tearDown": [{
"method": "setProperty",
"args": ["log.tag.WelcomeScreen", " "]
}, {
"method": "setProperty",
"args": ["log.tag.ConsentDialog", " "]
}
]
}
{
"method": "pushFileToDevice",
"args": ["filePathOnAgent","filePathOnDevice"]
}
- filePathOnAgent: It can be an absolute path like D:\file\Copy.ps1, also be a relative path under AgentInstallFolder like temp/111.txt
- filePathOnDevice: The file path on device. For example, /sdcard/Movies/testfile/
{
"method": "pullFileFromDevice",
"args": ["filePathOnDevice"]
}
- filePathOnDevice: It can be the path of folder like /sdcard/Movies/testfile/, also can be the path of file like /sdcard/Movies/testfile/aa.log
The commands can be configured in application.yml.
- type: command type.
- ADBShell: Running ADB shell command on the Android test device.
- AgentShell: Running Powershell command on Windows agent and sh command on the Mac agent (not implemented yet).
- when: setUp or tearDown. Used to specify the execute timing.
- suite-class-matcher: Regular expression. Used to match the suite class of test task.
- inline: Command script. Will be executed line-by-line on target device.
For example,
# Available Hydra Lab Variables In Script:
# $HydraLab_TestResultFolderPath: The full path of the test result folder
# $HydraLab_deviceUdid: The UDID of mobile device. (For Android, it will be equal to the serial number)
app:
device-script:
commands:
- type: ADBShell
when: setUp
suite-class-matcher: '.*'
inline: |
rm -rf /sdcard/Movies/testfile2
mkdir /sdcard/Movies/testfile2
cp /sdcard/Movies/testfile/* /sdcard/Movies/testfile2
- type: ADBShell
when: tearDown
suite-class-matcher: '.*'
inline: |
rm -rf /sdcard/Movies/testfile2
- type: AgentShell
when: setUp
suite-class-matcher: '.*test.*'
inline: |
python save_data_to_file.py "$HydraLab_TestResultFolderPath/$HydraLab_deviceUdid"
- type: AgentShell
when: tearDown
suite-class-matcher: 'com.microsoft.test'
inline: |
rm -rf "$HydraLab_TestResultFolderPath/$HydraLab_deviceUdid"
Introduction:
User manual:
- Deploy Center Docker Container
- Deploy Agent Docker Container
- Test agent setup
- One-Line-Installer Agent Setup
- [DEPRECATED]Deploy a test agent service
- Trigger a test task run in the Hydra Lab test service
- Create an Appium UI Test Automation Project
- Create test build and run XCTest
- Test Task Customization
- FAQ
Developer guideline:
- Start Services with Default Configuration
- Dev Environment Setup
- Technical Design
- Integrate Hydra Lab test center with Microsoft AAD authentication service
- Upgrade the test agent service from center service
News: