AutoPTSClientBot has been added to automate running test cases on various configurations and reporting the results.
Key features
- Fetching recent project sources
- Applying changes to project configuration files via "iut_config" with "overlay" that need to be applied for "test_cases"
- setting test-specific retry count via "retry_config"
- Building ZephyrOS/MynewtOS image
- Flashing board
- Running all the test cases
- Archiving test execution logs
- Storing the results in Excel spreadsheet file
- test case statuses
- pie chart
- Sending the files to the Google Drive
- Sending e-mail
Configuration
The Bot configuration file is located in bot . Sample files bot/config.py.zephyr.sample
and bot/config.py.mynewt.sample are provided. The file contains setup and project-specific configuration.
This may contain few sections:
name- AutoPTS project name
auto_pts- AutoPTS configurationiut_mode- Specifies the mode of the IUT (e.g. native, qemu, tty)workspace- Path to PTS workspace .pqw6 file to use for testing. THe file should be located where automation server is running.project_path- path to project source directorytester_app_dir- path to tester application directory relative to project_path. Only works for Zephyr based projects.cli_port- AutoPTSClient port(s). If running with multiple servers(PTS dongles), specify the ports in config_project.py as follows: 'srv_port': [65001, 65003, 65005]srv_port- AutoPTSServer port(s). If running with multiple servers(PTS dongles), specify the ports in config_project.py as follows: 'srv_port': [65000, 65002, 65004]ip_addr- IP address of the PTS automation servers.client_ip- AutoPTSClient IP address/esserver_ip- AutoPTSServer IP address/esstore- set True to save run results in a database .db file (default False)rtt_log- collect IUT logs via RTT J-Link buffer named "Logger"btmon- collect IUT btsnoops with btmondevice_core- Specify the device core for JLink related features, e.g. BTMON or RTT loggingqemu_bin- The path to the QEMU executable, e.g. /usr/bin/qemu-system-armqemu_options- Additional options for the qemu, e.g. -cpu cortex-m3 -machine lm3s6965evbbtattach_bin- The path to the btattach executable, e.g. /usr/bin/btattachbtattach_at_every_test_case- Use btattach at every test casebtproxy_bin- The path to the btproxy executable, e.g. /usr/bin/btproxybtmgmt_bin- The path to the btmgmt executable, e.g. /usr/bin/btmgmthid_vid- Specify the VID of the USB device used as a HCI controller (hexadecimal string, e.g. '2fe3')hid_pid- Specify the PID of the USB device used as a HCI controller (hexadecimal string, e.g. '000b')hid_serial- Specify the serial number of the USB device used as a HCI controllerkernel_cpu- The type of CPU that will be used for building an image, e.g. qemu_cortex_m3setcap_cmd- Command to set HCI access permissions for zephyr.exe in native mode, e.g. sudo /usr/sbin/setcap cap_net_raw,cap_net_admin,cap_sys_admin+ep /path/to/zephyr.exe. To allow sudo setcap without password, add to visudo a line like this: youruser ALL=(ALL) NOPASSWD: /usr/sbin/setcaphci- Specify the number of the HCI controllerdatabase_file- custom path to database .db file (default path: /TestCase.db)board- IUT used. Currently nrf52 is supported onlyenable_max_logs- enable debug logsretry- maximum repeat count per testno_retry_on_regression- When skip_retry is used, failed test cases are handled as follows: if test failure is not a regression, test case will not be retried (i.e. retry is ignored). If the failure is regression, test case will be retried for retry number of times. If you set retry to zero, no failed test cases will be retried.stress test- repeat every testretrynumber of times, even if result was PASSbd_addr- IUT Bluetooth Address (optional)recovery- enable recovery after non-valid result (optional)superguard- force recovery when server has been idle for the given time (optional)ykush- reconnect board/PTS dongle during recovery, if YKUSH Switchable Hub is used (optional)ykush_replug_delay- delay ykush replugrepeat_until_fail- keep repeating test case until fail verdicttest_case_limit- limits number of test cases to be run. Useful when passing test group as an argument- `pylink_reset' - Use pylink reset
no_build- Skip build and flash in bot modedongle_init_retry- number of times autoptsserver will try to launchbuild_env_cmd- path to virtual environment needed for build and flash stepcopy- Create a copy of workspace filewid_usage- Create a report of wid usage
git- Git repositories configuration (optional)path- path to project reporemote- git remote repo namebranch- branch selected at git checkoutstash_changes- stash changes if local repo is dirtyupdate_repo- if False, prevents bot from updating the repo
mail- Mail configuration (optional)sender- sender e-mail addresssmtp_host,smtp_port- sender SMTP configurationsubject- overrides default email titlename- to be used in message footerpasswd- sender mailbox password. When Google account is used allow less secure apps to access accountrecipients- list of e-mail addressesstart_tls- put SMTP server into TLS mode
gdrive- GDrive configuration (optional)root_directory_id- Root Directory ID, can be obtained from URL,https://drive.google.com/drive/u/0/folders/<GoogleDriveDirID>credentials_file- path to credentials file to access Google Account. Read more here.
iut_config- IUT configuration overlay. This is used to apply test case specific changes in IUT configuration. It consists of dict of configuration names and related key: value pairs:overlay- changes in config to be appliedtest_cases- test cases to be ran with this configexcluded- Names of test cases to exclude. Groups of test cases can be specified by profile names.
retry_config- allows to set test-specific retry count. This value overrides default settingretry, allowing to both increase and decrease it. This setting is in form of dictionary of testcase names and retry counts (asint)
scheduler- Scheduler configuration (optional)weekday: "time" dictionary.
Installation
Install required Python modules with:
pip3 install --user -r bot/requirements.txt
Usage
./autoptsclient_bot.py