1 Star 0 Fork 173

dy / test_xdevice

forked from OpenHarmony / testfwk_xdevice 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

xdevice组件

简介

xdevice是OpenHarmony中为测试框架的核心组件,提供用例执行所依赖的相关服务。

xdevice主要包括以下几个主要模块:

  • command,用户与测试平台命令行交互模块,提供用户输入命令解析,命令处理。
  • config,测试框架配置模块,提供测试平台串口连接方式和USB连接方式的不同配置选项。
  • driver,测试用例执行器,提供测试用例分发,执行,结果收集等主要测试步骤定义。
  • report,测试报告模块,提供测试结果解析和测试报告生成。
  • scheduler,测试框架调度模块,提供不同类型的测试执行器调度的调度功能。
  • environment,测试框架的环境配置模块,提供设备发现,设备管理的功能。
  • testkit,测试框架工具模块,提供json解析,网络文件挂载等操作。
  • resource,测试框架资源模块,提供设备连接配置文件和报告模板定义。
  • adapter,测试框架适配开源软件的模块。

目录

xdevice
├── config                    # xdevice组件配置
│     ├── user_config.xml    # xdevice环境配置
├── resource                  # xdevice组件资源
│     ├── tools              # 版本烧录工具
├── src                       # 组件源码目录
│     ├── xdevice
├── extension                 # xdevice扩展模块
│     ├── src                # 扩展模块源码
│     └── setup.py           # xdevice扩展模块安装脚本

约束

运行环境要求:

  • python版本>=3.7.5
  • pyserial>=3.3
  • paramiko>=2.7.1
  • rsa>=4.0

使用

  • 安装xdevice

    1. 打开xdevice安装目录。

    2. 打开控制台,执行如下命令:

      python setup.py install
  • 安装extension

    1. 打开extension安装目录。

    2. 打开控制台,执行如下命令:

      python setup.py install
  • 修改user_config.xml

    user_config.xml是框架提供的用户配置文件,用户可以根据自身环境信息配置相关内容,具体介绍如下:

    1、environment环境相关配置:

    • 设备类型一

      说明: ip/port: 表示远程设备地址,默认情况为空,表示使用本地设备,ip地址为127.0.0.1,port为本机hdc启动端口号; ​sn: 过滤执行测试设备,若设置为SN1,则表示只有设备SN1能够支持后续run命令执行,其他设备分配状态设置为Ignored,不参与命令执行,可通过list devices命令中Allocation字段来查看sn设置,可配置多个sn,中间以;隔开;

    • 设备类型二

      说明: type: 设备连接方式,com表示连接方式是串口 label: 表示设备种类,如wifiiot serial: 表示一个串口定义 serial/com 表示本地连接的串口,如COM20 serial/type 表示串口类型,cmd是命令串口,deploy是刷机串口,社区版本cmd和deploy使用同一个串口,com值相同 serial/baud_rate、data_bits、stop_bits、timeout: 为串口波特率等串口参数 ,一般采用默认值即可。

    2、测试用例目录设置

    dir: 指定测试用例目录。

    3、nfs挂载

    说明: server: nfs挂载配置,label取值为NfsServer。 server/ip: 挂载环境IP地址。 server/port: 挂载环境端口。 server/username: 登录用户名。 server/password: 登录用户密码。 server/dir: 对应挂载的外部路径。 server/remote: nfs服务器与xDevice执行机不在同一台机器时,remote配置为true,否则为false。

  • 选定任务类型

  • 启动框架

  • 执行指令

    框架指令可以分为三组:help、list、run。在指令序列中,以run为最常用的执行指令。

    1、help

    输入help指令可以查询框架指令帮助信息。

    help:
         use help to get information.  
    usage:
         run:  Display a list of supported run command.
         list: Display a list of supported device and task record.  
    Examples:
         help run
         help list

    说明: help run:展示run指令相关说明 help list:展示 list指令相关说明

    2、list

    list指令用来展示设备和相关的任务信息

    list:
         This command is used to display device list and task record.  
    usage:
          list
          list history
          list <id>  
    Introduction:
         list:         display device list
         list history: display history record of a serial of tasks
         list <id>:    display history record about task what contains specific id  
    Examples:
         list
         list history
         list 6e****90

    说明: list: 展示设备信息 list history: 展示任务历史信息 list <id>: 展示特定id的任务其历史信息

    3、run

    run指令主要用于执行测试任务

    run:
         This command is used to execute the selected testcases.
         It includes a series of processes such as use case compilation, execution, and result collection.  
    usage: run [-l TESTLIST [TESTLIST ...] | -tf TESTFILE
                [TESTFILE ...]] [-tc TESTCASE] [-c CONFIG] [-sn DEVICE_SN]
                [-rp REPORT_PATH [REPORT_PATH ...]]
                [-respath RESOURCE_PATH [RESOURCE_PATH ...]]
                [-tcpath TESTCASES_PATH [TESTCASES_PATH ...]]
                [-ta TESTARGS [TESTARGS ...]] [-pt]
                [-env TEST_ENVIRONMENT [TEST_ENVIRONMENT ...]]
                [-e EXECTYPE] [-t [TESTTYPE [TESTTYPE ...]]]
                [-td TESTDRIVER] [-tl TESTLEVEL] [-bv BUILD_VARIANT]
                [-cov COVERAGE] [--retry RETRY] [--session SESSION]
                [--dryrun] [--reboot-per-module] [--check-device]
                [--repeat REPEAT]
                action task  
    Specify tests to run.
      positional arguments:
       action                Specify action
       task                  Specify task name,such as "ssts", "acts", "hits"

    说明: 一个基本的run指令结构如下:

    run [task name] -l module1;moudle2

    task name:任务类型。一般为ssts、acts、hits。非必选项 -l :指定执行测试用例,多个测试用例,中间用;隔开 module:被测试的模块。一般在testcases目录下存在对应的\.json文件 此外,其他参数可以作为约束条件,附加到这个基本指令之上使用。常用的如: -sn: 过滤执行测试设备,若设置为SN1,则表示只有设备SN1执行用例 -c: 重新指定user_config.xml。 -rp: 报告生成路径。默认为xxx/xdevice/reports目录。指定目录后,优先级:指定目录>xxx/xdevice/reports目录。 -tcpath:环境目录,默认为xxx/xdevice/testcases目录。指定目录后,优先级:指定目录>xxx/xdevice/testcases目录 -respath:测试套目录,默认为xxx/xdevice/resource目录。指定目录后,优先级:指定目录>xxx/xdevice/resource目录 --reboot-per-module: 执行前先重启设备

  • 查看执行结果

    框架执行run指令,控制台会输出对应的log打印,还会生成对应的执行结果报告。如果使用了-rp参数指定报告路径,那么报告就会生成在指定的路径下。否则报告会存放在默认目录。

    当前报告目录(默认目录/指定目录)
         ├── result(模块执行结果存放目录)
         │     ├── <模块名>.xml
         │     ├──  ... ... 
    
         ├── log (设备和任务运行log存放目录)
         │     ├── <设备1>.log
         │     ├── ... ...
         │     ├── <任务>.log
         ├── summary_report.html(测试任务可视化报告)
         ├── summary_report.html(测试任务数据化报告)
         └── ... ...

相关仓

测试子系统

test_xdevice

test_developertest

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS

简介

Development self-test and the base library of XTS certification testing | 开发自测试与XTS认证测试基础库 展开 收起
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/dy_study/test_xdevice.git
git@gitee.com:dy_study/test_xdevice.git
dy_study
test_xdevice
test_xdevice
master

搜索帮助