积分1636 / 贡献20

提问18答案被采纳66文章40

[行业动态] OH4.0的应用UT开发原理 原创 精华

深开鸿_王石 显示全部楼层 发表于 2024-2-1 10:02:51

背景

新建工程

  1. 新建工程自带的UT:使用步骤就是点开Ability.test.ets然后点击abilityTest下的那个绿色箭头就可以看到下面的输出,默认工程会建立一个用例,所以执行结果就是Tests passed: 1

image.png

  1. 运行日志可通过hilog查看

    image.png

  2. 命令行执行

    aa test -b com.example.myapplication -m entry_test -s unittest /ets/testrunner/OpenHarmonyTestRunner -s class ActsAbilityTest -s timeout 15000
    
    OHOS_REPORT_SUM: 1
    OHOS_REPORT_STATUS: class=ActsAbilityTest
    
    OHOS_REPORT_STATUS: class=ActsAbilityTest
    OHOS_REPORT_STATUS: current=1
    OHOS_REPORT_STATUS: id=JS
    OHOS_REPORT_STATUS: numtests=1
    OHOS_REPORT_STATUS: stream=
    OHOS_REPORT_STATUS: test=assertContain
    OHOS_REPORT_STATUS_CODE: 1
    
    OHOS_REPORT_STATUS: class=ActsAbilityTest
    OHOS_REPORT_STATUS: current=1
    OHOS_REPORT_STATUS: id=JS
    OHOS_REPORT_STATUS: numtests=1
    OHOS_REPORT_STATUS: stream=
    OHOS_REPORT_STATUS: test=assertContain
    OHOS_REPORT_STATUS_CODE: 0
    OHOS_REPORT_STATUS: consuming=6
    
    OHOS_REPORT_STATUS: class=ActsAbilityTest
    OHOS_REPORT_STATUS: suiteconsuming=6
    
    OHOS_REPORT_RESULT: stream=Tests run: 1, Failure: 0, Error: 0, Pass: 1, Ignore: 0
    OHOS_REPORT_CODE: 0
    OHOS_REPORT_STATUS: taskconsuming=6
    
    TestFinished-ResultCode: 0
    TestFinished-ResultMsg: your test finished!!!
    user test finished.

以上内容就是入门级使用说明,后面讲点理论


ArtTS单元测试框架

OpenHarmony自动化测试框架代码部件仓arkXtest,包含单元测试框架(JsUnit)和Ui测试框架(UiTest)。单元测试框架(JsUnit)提供单元测试用例执行能力,提供用例编写基础接口,生成对应报告,用于测试系统或应用接口。Ui测试框架(UiTest)通过简洁易用的API提供查找和操作界面控件能力,支持用户开发基于界面操作的自动化测试脚本。


目录
arkXtest 
  |-----jsunit  单元测试框架
  |-----uitest  Ui测试框架
单元测试框架功能特性(jsunit)
No. 特性 功能说明
1 基础流程 支持编写及异步执行基础用例。
2 断言库 判断用例实际期望值与预期值是否相符。
3 Mock能力 支持函数级mock能力,对定义的函数进行mock后修改函数的行为,使其返回指定的值或者执行某种动作。
4 数据驱动 提供数据驱动能力,支持复用同一个测试脚本,使用不同输入数据驱动执行。
5 专项能力 支持测试套与用例筛选、随机执行、压力测试、超时设置、遇错即停模式等。
使用说明
  1. 基础流程(jsunit) 测试用例采用业内通用语法,**describe代表一个测试套, it代表一条用例。| No. | API | 功能说明 | | ------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | 1 | describe | 定义一个测试套,支持两个参数:测试套名称和测试套函数。 | | 2 | beforeAll | 在测试套内定义一个预置条件,在所有测试用例开始前执行且仅执行一次,支持一个参数:预置动作函数。 | | 3 | beforeEach | 在测试套内定义一个单元预置条件,在每条测试用例开始前执行,执行次数与it定义的测试用例数一致,支持一个参数:预置动作函数。 | | 4 | afterEach | 在测试套内定义一个单元清理条件,在每条测试用例结束后执行,执行次数与it定义的测试用例数一致,支持一个参数:清理动作函数。 | | 5 | afterAll | 在测试套内定义一个清理条件,在所有测试用例结束后执行且仅执行一次,支持一个参数:清理动作函数。 | | 6 | beforeItSpecified | 在测试套内定义一个单元预置条件,仅在指定测试用例开始前执行,支持两个参数:单个用例名称或用例名称数组、预置动作函数。 | | 7 | afterItSpecified | 在测试套内定义一个单元清理条件,仅在指定测试用例结束后执行,支持两个参数:单个用例名称或用例名称数组、清理动作函数 | | 8 | it | 定义一条测试用例,支持三个参数:用例名称,过滤参数和用例函数。 | | 9 | expect | 支持bool类型判断等多种断言方法。 | | 10 | getDescribeName | 获取当前正在执行测试套的名称 | | 11 | getItName | 获取当前正在执行测试用例的名称 | | 12 | getItAttribute | 获取当前正在执行测试用例的级别、粒度、测试类型** |

  2. 示例代码(jsunit) 以下就是默认工程里的测试用例:**describe就是定义一个测试套;it就是一个测试用例; 什么是测试套?:简单理解就是一组测试用例我们可以定为测试套,比如我要测一个页面的功能,播放,暂停,等等,就可以定义为一个测试套。当然测试套可以可以理解是个大范围,比如完整的一系列功能,比如,所有的arkui的控件测试套这种; 什么是测试用例?**:可以理解为一个测试项目,比如说我点了“保存”按钮,会存手机名称这样;再简单点就是点了spinbutton,就会选中;很多测试用例组成一个测试套;

    import hilog from '@ohos.hilog';
    import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
    
    export default function abilityTest() {
      describe('ActsAbilityTest', () => {
        // Defines a test suite. Two parameters are supported: test suite name and test suite function.
        beforeAll(() => {
          // Presets an action, which is performed only once before all test cases of the test suite start.
          // This API supports only one parameter: preset action function.
        })
        beforeEach(() => {
          // Presets an action, which is performed before each unit test case starts.
          // The number of execution times is the same as the number of test cases defined by **it**.
          // This API supports only one parameter: preset action function.
        })
        afterEach(() => {
          // Presets a clear action, which is performed after each unit test case ends.
          // The number of execution times is the same as the number of test cases defined by **it**.
          // This API supports only one parameter: clear action function.
        })
        afterAll(() => {
          // Presets a clear action, which is performed after all test cases of the test suite end.
          // This API supports only one parameter: clear action function.
        })
        it('assertContain', 0, () => {
          // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
          hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
          let a = 'abc';
          let b = 'b';
          // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
          expect(a).assertContain(b);
          expect(a).assertEqual(a);
        })
      })
    }
  3. 断言 断言功能列表:

No. API 功能说明
1 assertClose 检验actualvalue和expectvalue(0)的接近程度是否是expectValue(1)。
2 assertContain 检验actualvalue中是否包含expectvalue。
3 assertEqual 检验actualvalue是否等于expectvalue[0]。
4 assertFail 抛出一个错误。
5 assertFalse 检验actualvalue是否是false。
6 assertTrue 检验actualvalue是否是true。
7 assertInstanceOf 检验actualvalue是否是expectvalue类型,支持基础类型。
8 assertLarger 检验actualvalue是否大于expectvalue。
9 assertLess 检验actualvalue是否小于expectvalue。
10 assertNull 检验actualvalue是否是null。
11 assertThrowError 检验actualvalue抛出Error内容是否是expectValue。
12 assertUndefined 检验actualvalue是否是undefined。
13 assertNaN @since1.0.4 检验actualvalue是否是一个NAN
14 assertNegUnlimited @since1.0.4 检验actualvalue是否等于Number.NEGATIVE_INFINITY
15 assertPosUnlimited @since1.0.4 检验actualvalue是否等于Number.POSITIVE_INFINITY
16 assertDeepEquals @since1.0.4 检验actualvalue和expectvalue是否完全相等
17 assertPromiseIsPending @since1.0.4 判断promise是否处于Pending状态。
18 assertPromiseIsRejected @since1.0.4 判断promise是否处于Rejected状态。
19 assertPromiseIsRejectedWith @since1.0.4 判断promise是否处于Rejected状态,并且比较执行的结果值。
20 assertPromiseIsRejectedWithError @since1.0.4 判断promise是否处于Rejected状态并有异常,同时比较异常的类型和message值。
21 assertPromiseIsResolved @since1.0.4 判断promise是否处于Resolved状态。
22 assertPromiseIsResolvedWith @since1.0.4 判断promise是否处于Resolved状态,并且比较执行的结果值。
23 not @since1.0.4 断言取反,支持上面所有的断言功能

以上都是jsunit的断言


单元测试框架功能特性(uitest)
No. 特性 功能说明
1 Driver Ui测试的入口,提供查找控件,检查控件存在性以及注入按键能力。
2 On 用于描述目标控件特征(文本、id、类型等),Driver根据 On描述的控件特征信息来查找控件。
3 Component Driver查找返回的控件对象,提供查询控件属性,滑动查找等触控和检视能力。
4 UiWindow Driver查找返回的窗口对象,提供获取窗口属性、操作窗口的能力。
使用说明
  1. 引入uitest框架

    import {Driver,ON,Component,Uiwindow,MatchPattern} from '@ohos.UiTest'
  2. 引入ability

    import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
  3. 添加启动应用准备

    beforeAll(async (done: Function) => {
      // Presets an action, which is performed only once before all test cases of the test suite start.
      // This API supports only one parameter: preset action function.
      let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
      try {
        await abilityDelegator.startAbility({
          bundleName: 'com.example.myapplication',
          abilityName: 'EntryAbility'
        });
      } catch (exception) {
        console.info(TAG, `StartAbility_001 exception = ${JSON.stringify(exception)}`);
        expect().assertFail();
      }
      done();
    })
  4. 添加测试用例

    it('StartAbility_001', 0, async (done: Function) => {
      console.info(TAG, 'StartAbility_001 begin');
      let driver = Driver.create();
    
      await driver.delayMs(100);
      await driver.assertComponentExist(ON.text('Hello World'));
      // find component by text
      let button: Component = await driver.findComponent(ON.text('Hello World').enabled(true))
      // click component
      await button.click()
      // get and assert component text
      let content: string = await button.getText()
      expect(content).assertEqual('Hello World')
      done();
    })

须知

  1. On类提供的接口全部是同步接口,使用者可以使用 builder模式链式调用其接口构造控件筛选条件。
  2. DriverComponent类提供的接口全部是异步接口(Promise形式),需使用 await语法
  3. Ui测试用例均需使用**异步**语法编写用例,需遵循单元测试框架异步用例编写规范。

  1. 测试运行

    image.png

  2. 手动测试

    hdc_std.exe -t 7001005458323933328a017ce1c43800 shell aa test -b com.example.myapplication -m entry_test -s unittest /ets/testrunner/OpenHarmonyTestRunner -s class ActsAbilityTest -s timeout 15000 -s coverage true
    
    OHOS_REPORT_SUM: 2
    OHOS_REPORT_STATUS: class=ActsAbilityTest
    
    OHOS_REPORT_STATUS: class=ActsAbilityTest
    OHOS_REPORT_STATUS: current=1
    OHOS_REPORT_STATUS: id=JS
    OHOS_REPORT_STATUS: numtests=2
    OHOS_REPORT_STATUS: stream=
    OHOS_REPORT_STATUS: test=assertContain
    OHOS_REPORT_STATUS_CODE: 1
    
    OHOS_REPORT_STATUS: class=ActsAbilityTest
    OHOS_REPORT_STATUS: current=1
    OHOS_REPORT_STATUS: id=JS
    OHOS_REPORT_STATUS: numtests=2
    OHOS_REPORT_STATUS: stream=
    OHOS_REPORT_STATUS: test=assertContain
    OHOS_REPORT_STATUS_CODE: 0
    OHOS_REPORT_STATUS: consuming=8
    
    OHOS_REPORT_STATUS: class=ActsAbilityTest
    OHOS_REPORT_STATUS: current=2
    OHOS_REPORT_STATUS: id=JS
    OHOS_REPORT_STATUS: numtests=2
    OHOS_REPORT_STATUS: stream=
    OHOS_REPORT_STATUS: test=StartAbility_001
    OHOS_REPORT_STATUS_CODE: 1
    
    OHOS_REPORT_STATUS: class=ActsAbilityTest
    OHOS_REPORT_STATUS: current=2
    OHOS_REPORT_STATUS: id=JS
    OHOS_REPORT_STATUS: numtests=2
    OHOS_REPORT_STATUS: stream=
    OHOS_REPORT_STATUS: test=StartAbility_001
    OHOS_REPORT_STATUS_CODE: 0
    OHOS_REPORT_STATUS: consuming=2397
    
    OHOS_REPORT_STATUS: class=ActsAbilityTest
    OHOS_REPORT_STATUS: suiteconsuming=2405
    
    OHOS_REPORT_COVERAGE_DATA: {"C:\\Users\\Administrator\\DevEcoStudioProjects\\MyApplication12\\entry\\.test\\default\\intermediates\\source\\entry\\src\\main\\ets\\entryability\\EntryAbility.js":{"path":"C:\\Users\\Administrator\\DevEcoStudioProjects\\MyApplication12\\entry\\.test\\default\\intermediates\\source\\entry\\src\\main\\ets\\entryability\\EntryAbility.js","statementMap":{"0":{"start":{"line":5,"column":8},"end":{"line":5,"column":72}},"1":{"start":{"line":8,"column":8},"end":{"line":8,"column":73}},"2":{"start":
    OHOS_REPORT_COVERAGE_DATA: {"line":12,"column":8},"end":{"line":12,"column":83}},"3":{"start":{"line":13,"column":8},"end":{"line":20,"column":11}},"4":{"start":{"line":15,"column":12},"end":{"line":18,"column":13}},"5":{"start":{"line":16,"column":16},"end":{"line":16,"column":160}},"6":{"start":{"line":17,"column":16},"end":{"line":17,"column":23}},"7":{"start":{"line":19,"column":12},"end":{"line":19,"column":161}},"8":{"start":{"line":24,"column":8},"end":{"line":24,"column":84}},"9":{"start":{"line":28,"column":8},"e
    OHOS_REPORT_COVERAGE_DATA: nd":{"line":28,"column":76}},"10":{"start":{"line":32,"column":8},"end":{"line":32,"column":76}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":4,"column":4},"end":{"line":4,"column":5}},"loc":{"start":{"line":4,"column":32},"end":{"line":6,"column":5}},"line":4},"1":{"name":"(anonymous_1)","decl":{"start":{"line":7,"column":4},"end":{"line":7,"column":5}},"loc":{"start":{"line":7,"column":16},"end":{"line":9,"column":5}},"line":7},"2":{"name":"(anonymous_2)","decl":{"start":{"lin
    OHOS_REPORT_COVERAGE_DATA: e":10,"column":4},"end":{"line":10,"column":5}},"loc":{"start":{"line":10,"column":37},"end":{"line":21,"column":5}},"line":10},"3":{"name":"(anonymous_3)","decl":{"start":{"line":13,"column":47},"end":{"line":13,"column":48}},"loc":{"start":{"line":13,"column":62},"end":{"line":20,"column":9}},"line":13},"4":{"name":"(anonymous_4)","decl":{"start":{"line":22,"column":4},"end":{"line":22,"column":5}},"loc":{"start":{"line":22,"column":27},"end":{"line":25,"column":5}},"line":22},"5":{"name":"(an
    OHOS_REPORT_COVERAGE_DATA: onymous_5)","decl":{"start":{"line":26,"column":4},"end":{"line":26,"column":5}},"loc":{"start":{"line":26,"column":19},"end":{"line":29,"column":5}},"line":26},"6":{"name":"(anonymous_6)","decl":{"start":{"line":30,"column":4},"end":{"line":30,"column":5}},"loc":{"start":{"line":30,"column":19},"end":{"line":33,"column":5}},"line":30}},"branchMap":{"0":{"loc":{"start":{"line":15,"column":12},"end":{"line":18,"column":13}},"type":"if","locations":[{"start":{"line":15,"column":12},"end":{"line":1
    OHOS_REPORT_COVERAGE_DATA: 8,"column":13}},{"start":{"line":15,"column":12},"end":{"line":18,"column":13}}],"line":15},"1":{"loc":{"start":{"line":16,"column":96},"end":{"line":16,"column":158}},"type":"cond-expr","locations":[{"start":{"line":16,"column":151},"end":{"line":16,"column":153}},{"start":{"line":16,"column":156},"end":{"line":16,"column":158}}],"line":16},"2":{"loc":{"start":{"line":16,"column":96},"end":{"line":16,"column":148}},"type":"binary-expr","locations":[{"start":{"line":16,"column":96},"end":{"line"
    OHOS_REPORT_COVERAGE_DATA: :16,"column":131}},{"start":{"line":16,"column":135},"end":{"line":16,"column":148}}],"line":16},"3":{"loc":{"start":{"line":19,"column":96},"end":{"line":19,"column":159}},"type":"cond-expr","locations":[{"start":{"line":19,"column":152},"end":{"line":19,"column":154}},{"start":{"line":19,"column":157},"end":{"line":19,"column":159}}],"line":19},"4":{"loc":{"start":{"line":19,"column":96},"end":{"line":19,"column":149}},"type":"binary-expr","locations":[{"start":{"line":19,"column":96},"end":{"
    OHOS_REPORT_COVERAGE_DATA: line":19,"column":132}},{"start":{"line":19,"column":136},"end":{"line":19,"column":149}}],"line":19}},"s":{"0":1,"1":0,"2":1,"3":1,"4":1,"5":0,"6":0,"7":1,"8":0,"9":1,"10":0},"f":{"0":1,"1":0,"2":1,"3":1,"4":0,"5":1,"6":0},"b":{"0":[0,1],"1":[0,0],"2":[0,0],"3":[0,1],"4":[1,1]},"inputSourceMap":{"version":3,"file":null,"sources":["C:\\Users\\Administrator\\DevEcoStudioProjects\\MyApplication12\\entry\\src\\main\\ets\\entryability\\EntryAbility.ets"],"sourcesContent":["import AbilityConstant fro
    OHOS_REPORT_COVERAGE_DATA: m '@ohos.app.ability.AbilityConstant';\r\nimport hilog from '@ohos.hilog';\r\nimport UIAbility from '@ohos.app.ability.UIAbility';\r\nimport Want from '@ohos.app.ability.Want';\r\nimport window from '@ohos.window';\r\n\r\nexport default class EntryAbility extends UIAbility {\r\n  onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {\r\n    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');\r\n  }\r\n\r\n  onDestroy(): void {\r\n    hilog.info(0x0000, 'testTag', '%{
    OHOS_REPORT_COVERAGE_DATA: public}s', 'Ability onDestroy');\r\n  }\r\n\r\n  onWindowStageCreate(windowStage: window.WindowStage): void {\r\n    // Main window is created, set main page for this ability\r\n    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');\r\n\r\n    windowStage.loadContent('pages/Index', (err, data) => {\r\n      if (err.code) {\r\n        hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');\r\n        return;\r\n      }\r
    OHOS_REPORT_COVERAGE_DATA: \n      hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');\r\n    });\r\n  }\r\n\r\n  onWindowStageDestroy(): void {\r\n    // Main window is destroyed, release UI related resources\r\n    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');\r\n  }\r\n\r\n  onForeground(): void {\r\n    // Ability has brought to foreground\r\n    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');\r\n  }\r\n\r\
    OHOS_REPORT_COVERAGE_DATA: n  onBackground(): void {\r\n    // Ability has back to background\r\n    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');\r\n  }\r\n}\r\n"],"names":[],"mappings":"AACA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAC,CAAA;AAChC,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,
    OHOS_REPORT_COVERAGE_DATA: CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B,CAAC,CAAA;AAIpD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAsB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,CAAC,CAAA;IACtE,CAAC,CAAA;AACF,CAAA,CAAA;"},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"1fa5972a360e03ca6510e055e7ab75413393cf52"},"C:\\Users\\Administrator\\DevEcoStudioProjects\\MyApplica
    OHOS_REPORT_COVERAGE_DATA: tion12\\entry\\.test\\default\\intermediates\\source\\entry\\src\\main\\ets\\pages\\Index.js":{"path":"C:\\Users\\Administrator\\DevEcoStudioProjects\\MyApplication12\\entry\\.test\\default\\intermediates\\source\\entry\\src\\main\\ets\\pages\\Index.js","statementMap":{"0":{"start":{"line":4,"column":8},"end":{"line":4,"column":46}},"1":{"start":{"line":5,"column":8},"end":{"line":7,"column":9}},"2":{"start":{"line":6,"column":12},"end":{"line":6,"column":49}},"3":{"start":{"line":8,"column":8},
    OHOS_REPORT_COVERAGE_DATA: "end":{"line":8,"column":86}},"4":{"start":{"line":9,"column":8},"end":{"line":9,"column":61}},"5":{"start":{"line":10,"column":8},"end":{"line":10,"column":26}},"6":{"start":{"line":11,"column":8},"end":{"line":11,"column":47}},"7":{"start":{"line":14,"column":8},"end":{"line":16,"column":9}},"8":{"start":{"line":15,"column":12},"end":{"line":15,"column":42}},"9":{"start":{"line":17,"column":8},"end":{"line":19,"column":9}},"10":{"start":{"line":18,"column":12},"end":{"line":18,"column":32}},"1
    OHOS_REPORT_COVERAGE_DATA: 1":{"start":{"line":20,"column":8},"end":{"line":22,"column":9}},"12":{"start":{"line":21,"column":12},"end":{"line":21,"column":42}},"13":{"start":{"line":27,"column":8},"end":{"line":27,"column":57}},"14":{"start":{"line":30,"column":8},"end":{"line":30,"column":42}},"15":{"start":{"line":31,"column":8},"end":{"line":31,"column":52}},"16":{"start":{"line":32,"column":8},"end":{"line":32,"column":40}},"17":{"start":{"line":35,"column":8},"end":{"line":35,"column":36}},"18":{"start":{"line":38,"
    OHOS_REPORT_COVERAGE_DATA: column":8},"end":{"line":38,"column":37}},"19":{"start":{"line":41,"column":8},"end":{"line":41,"column":36}},"20":{"start":{"line":42,"column":8},"end":{"line":47,"column":11}},"21":{"start":{"line":43,"column":12},"end":{"line":43,"column":33}},"22":{"start":{"line":44,"column":12},"end":{"line":44,"column":49}},"23":{"start":{"line":46,"column":12},"end":{"line":46,"column":97}},"24":{"start":{"line":50,"column":8},"end":{"line":50,"column":34}},"25":{"start":{"line":51,"column":8},"end":{"li
    OHOS_REPORT_COVERAGE_DATA: ne":56,"column":11}},"26":{"start":{"line":52,"column":12},"end":{"line":52,"column":33}},"27":{"start":{"line":53,"column":12},"end":{"line":53,"column":47}},"28":{"start":{"line":55,"column":12},"end":{"line":55,"column":95}},"29":{"start":{"line":59,"column":8},"end":{"line":62,"column":16}},"30":{"start":{"line":60,"column":12},"end":{"line":60,"column":25}},"31":{"start":{"line":61,"column":12},"end":{"line":61,"column":31}},"32":{"start":{"line":63,"column":8},"end":{"line":66,"column":19}
    OHOS_REPORT_COVERAGE_DATA: },"33":{"start":{"line":64,"column":12},"end":{"line":64,"column":28}},"34":{"start":{"line":65,"column":12},"end":{"line":65,"column":33}},"35":{"start":{"line":67,"column":8},"end":{"line":71,"column":17}},"36":{"start":{"line":68,"column":12},"end":{"line":68,"column":38}},"37":{"start":{"line":69,"column":12},"end":{"line":69,"column":30}},"38":{"start":{"line":70,"column":12},"end":{"line":70,"column":45}},"39":{"start":{"line":72,"column":8},"end":{"line":72,"column":19}},"40":{"start":{"l
    OHOS_REPORT_COVERAGE_DATA: ine":73,"column":8},"end":{"line":73,"column":21}},"41":{"start":{"line":74,"column":8},"end":{"line":74,"column":18}},"42":{"start":{"line":77,"column":8},"end":{"line":77,"column":35}},"43":{"start":{"line":80,"column":0},"end":{"line":80,"column":103}},"44":{"start":{"line":81,"column":0},"end":{"line":81,"column":39}},"45":{"start":{"line":82,"column":0},"end":{"line":82,"column":44}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":3,"column":4},"end":{"line":3,"column":5}},"lo
    OHOS_REPORT_COVERAGE_DATA: c":{"start":{"line":3,"column":87},"end":{"line":12,"column":5}},"line":3},"1":{"name":"(anonymous_1)","decl":{"start":{"line":13,"column":4},"end":{"line":13,"column":5}},"loc":{"start":{"line":13,"column":38},"end":{"line":23,"column":5}},"line":13},"2":{"name":"(anonymous_2)","decl":{"start":{"line":24,"column":4},"end":{"line":24,"column":5}},"loc":{"start":{"line":24,"column":28},"end":{"line":25,"column":5}},"line":24},"3":{"name":"(anonymous_3)","decl":{"start":{"line":26,"column":4},"end
    OHOS_REPORT_COVERAGE_DATA: ":{"line":26,"column":5}},"loc":{"start":{"line":26,"column":48},"end":{"line":28,"column":5}},"line":26},"4":{"name":"(anonymous_4)","decl":{"start":{"line":29,"column":4},"end":{"line":29,"column":5}},"loc":{"start":{"line":29,"column":23},"end":{"line":33,"column":5}},"line":29},"5":{"name":"(anonymous_5)","decl":{"start":{"line":34,"column":4},"end":{"line":34,"column":5}},"loc":{"start":{"line":34,"column":18},"end":{"line":36,"column":5}},"line":34},"6":{"name":"(anonymous_6)","decl":{"sta
    OHOS_REPORT_COVERAGE_DATA: rt":{"line":37,"column":4},"end":{"line":37,"column":5}},"loc":{"start":{"line":37,"column":26},"end":{"line":39,"column":5}},"line":37},"7":{"name":"(anonymous_7)","decl":{"start":{"line":40,"column":4},"end":{"line":40,"column":5}},"loc":{"start":{"line":40,"column":20},"end":{"line":48,"column":5}},"line":40},"8":{"name":"(anonymous_8)","decl":{"start":{"line":42,"column":152},"end":{"line":42,"column":153}},"loc":{"start":{"line":42,"column":163},"end":{"line":45,"column":9}},"line":42},"9":
    OHOS_REPORT_COVERAGE_DATA: {"name":"(anonymous_9)","decl":{"start":{"line":45,"column":17},"end":{"line":45,"column":18}},"loc":{"start":{"line":45,"column":28},"end":{"line":47,"column":9}},"line":45},"10":{"name":"(anonymous_10)","decl":{"start":{"line":49,"column":4},"end":{"line":49,"column":5}},"loc":{"start":{"line":49,"column":17},"end":{"line":57,"column":5}},"line":49},"11":{"name":"(anonymous_11)","decl":{"start":{"line":51,"column":152},"end":{"line":51,"column":153}},"loc":{"start":{"line":51,"column":163},"en
    OHOS_REPORT_COVERAGE_DATA: d":{"line":54,"column":9}},"line":51},"12":{"name":"(anonymous_12)","decl":{"start":{"line":54,"column":17},"end":{"line":54,"column":18}},"loc":{"start":{"line":54,"column":28},"end":{"line":56,"column":9}},"line":54},"13":{"name":"(anonymous_13)","decl":{"start":{"line":58,"column":4},"end":{"line":58,"column":5}},"loc":{"start":{"line":58,"column":20},"end":{"line":75,"column":5}},"line":58},"14":{"name":"(anonymous_14)","decl":{"start":{"line":59,"column":39},"end":{"line":59,"column":40}},"
    OHOS_REPORT_COVERAGE_DATA: loc":{"start":{"line":59,"column":68},"end":{"line":62,"column":9}},"line":59},"15":{"name":"(anonymous_15)","decl":{"start":{"line":63,"column":39},"end":{"line":63,"column":40}},"loc":{"start":{"line":63,"column":68},"end":{"line":66,"column":9}},"line":63},"16":{"name":"(anonymous_16)","decl":{"start":{"line":67,"column":39},"end":{"line":67,"column":40}},"loc":{"start":{"line":67,"column":68},"end":{"line":71,"column":9}},"line":67},"17":{"name":"(anonymous_17)","decl":{"start":{"line":76,"c
    OHOS_REPORT_COVERAGE_DATA: olumn":4},"end":{"line":76,"column":5}},"loc":{"start":{"line":76,"column":15},"end":{"line":78,"column":5}},"line":76}},"branchMap":{"0":{"loc":{"start":{"line":3,"column":48},"end":{"line":3,"column":59}},"type":"default-arg","locations":[{"start":{"line":3,"column":57},"end":{"line":3,"column":59}}],"line":3},"1":{"loc":{"start":{"line":3,"column":61},"end":{"line":3,"column":85}},"type":"default-arg","locations":[{"start":{"line":3,"column":76},"end":{"line":3,"column":85}}],"line":3},"2":{"
    OHOS_REPORT_COVERAGE_DATA: loc":{"start":{"line":5,"column":8},"end":{"line":7,"column":9}},"type":"if","locations":[{"start":{"line":5,"column":8},"end":{"line":7,"column":9}},{"start":{"line":5,"column":8},"end":{"line":7,"column":9}}],"line":5},"3":{"loc":{"start":{"line":14,"column":8},"end":{"line":16,"column":9}},"type":"if","locations":[{"start":{"line":14,"column":8},"end":{"line":16,"column":9}},{"start":{"line":14,"column":8},"end":{"line":16,"column":9}}],"line":14},"4":{"loc":{"start":{"line":17,"column":8},"e
    OHOS_REPORT_COVERAGE_DATA: nd":{"line":19,"column":9}},"type":"if","locations":[{"start":{"line":17,"column":8},"end":{"line":19,"column":9}},{"start":{"line":17,"column":8},"end":{"line":19,"column":9}}],"line":17},"5":{"loc":{"start":{"line":20,"column":8},"end":{"line":22,"column":9}},"type":"if","locations":[{"start":{"line":20,"column":8},"end":{"line":22,"column":9}},{"start":{"line":20,"column":8},"end":{"line":22,"column":9}}],"line":20}},"s":{"0":1,"1":1,"2":0,"3":1,"4":1,"5":1,"6":1,"7":1,"8":0,"9":1,"10":0,"11"
    OHOS_REPORT_COVERAGE_DATA: :1,"12":0,"13":0,"14":0,"15":0,"16":0,"17":1,"18":0,"19":1,"20":1,"21":0,"22":0,"23":1,"24":1,"25":1,"26":0,"27":0,"28":1,"29":1,"30":1,"31":1,"32":1,"33":1,"34":1,"35":1,"36":1,"37":1,"38":1,"39":1,"40":1,"41":1,"42":0,"43":1,"44":1,"45":1},"f":{"0":1,"1":1,"2":0,"3":0,"4":0,"5":1,"6":0,"7":1,"8":0,"9":1,"10":1,"11":0,"12":1,"13":1,"14":1,"15":1,"16":1,"17":0},"b":{"0":[1],"1":[1],"2":[0,1],"3":[0,1],"4":[0,1],"5":[0,1]},"inputSourceMap":{"version":3,"file":null,"sources":["C:\\Users\\Administr
    OHOS_REPORT_COVERAGE_DATA: ator\\DevEcoStudioProjects\\MyApplication12\\entry\\src\\main\\ets\\pages\\Index.ets"],"sourcesContent":["import resourceManager from '@ohos.resourceManager';\nimport { BusinessError } from '@ohos.base';\n@Entry\n@Component\nstruct Index {\n  @State message: string = 'Hello World';\n  sm = resourceManager.getSystemResourceManager();\n  teststr = ''\n\n  aboutToAppear() {\n    console.log('abouttoapper')\n    this.sm.getStringValue($r('app.string.EntryAbility_label').id).then((value:string) => {\
    OHOS_REPORT_COVERAGE_DATA: n      this.teststr = value\n      console.log('abouttoapper: ', value)\n    }).catch((error : BusinessError) => {\n      console.log(\"abouttoapper getStringValue promise error is \" + JSON.stringify(error));\n    });\n  }\n  onPageShow() {\n    console.log('onPageShow')\n    this.sm.getStringValue($r('app.string.EntryAbility_label').id).then((value:string) => {\n      this.teststr = value\n      console.log('onPageShow: ', value)\n    }).catch((error : BusinessError) => {\n      console.log(\"
    OHOS_REPORT_COVERAGE_DATA: onPageShow getStringValue promise error is \" + JSON.stringify(error));\n    });\n  }\n\n  build() {\n    Row() {\n      Column() {\n        Text(this.message)\n          .fontSize(50)\n          .fontWeight(FontWeight.Bold)\n      }\n      .width('100%')\n    }\n    .height('100%')\n  }\n}"],"names":[],"mappings":"AAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA
    OHOS_REPORT_COVERAGE_DATA: A,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB,CAAC,CAAA;MAI7C,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAFZ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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I,CAAA,CAAA,CAAA,CAAC,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;YAAjB,CAAI,CAAA,CAAA,CAAA,CACD,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,CAAE,CAAA,CAAA,CAAA,CAAA;AADd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAED,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,
    OHOS_REPORT_COVERAGE_DATA: CAAA,CAAA,CAAU,CAAC,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;QAF7B,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;QADN,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;QADR,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AASJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;;;"},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"d26361759c1c5175ca20706fb24dd56ad5f9d277"}}
    
    OHOS_REPORT_RESULT: stream=Tests run: 2, Failure: 0, Error: 0, Pass: 2, Ignore: 0
    OHOS_REPORT_CODE: 0
    OHOS_REPORT_STATUS: taskconsuming=2405
    
    TestFinished-ResultCode: 0
    TestFinished-ResultMsg: your test finished!!!
    user test finished.
  3. 覆盖率结果 覆盖率

  4. 为啥没覆盖到,可以点击具体部分查看 覆盖差缺 红色部分就是没覆盖部分,其实就是生命周期没覆盖,只测试了启动(也就是前台Foreground,没有后台Background,也没有load失败)所以生命周期的测试不完整。

专项能力

- **筛选能力**

  1. 按测试用例属性筛选

可以利用hypium提供的Level、Size、TestType 对象,对测试用例进行标记,以区分测试用例的级别、粒度、测试类型,各字段含义及代码如下:

Key 含义说明 Value取值说明
level 用例级别 "0","1","2","3","4", 例如:-s level 1
size 用例粒度 "small","medium","large", 例如:-s size small "small","medium","large", 例如:-s size small
testType 用例测试类型 "function","performance","power","reliability","security","global","compatibility","user","standard","safety","resilience", 例如:-s testType function

示例代码:

import { describe, it, expect, TestType, Size, Level } from '@ohos/hypium';
 export default function attributeTest() {
 describe('attributeTest', () => {
  it("testAttributeIt", TestType.FUNCTION | Size.SMALLTEST | Level.LEVEL0, () => {
   console.info('Hello Test');
  })
 })
}

示例命令:

hdc shell aa test -b xxx -m xxx -s unittest OpenHarmonyTestRunner -s testType function -s size small -s level 0
  1. 按测试套/测试用例名称筛选 hypium可以通过指定测试套与测试用例名称,来指定特定用例的执行,测试套与用例名称用“#”号连接,多个用“,”英文逗号分隔

    Key 含义说明 Value取值范围
    class 指定要执行的测试套&用例 \${describeName}#\${itName},\${describeName} , 例如:-s class attributeTest#testAttributeIt
    notClass 指定不执行的测试套&用例 \${describeName}#\${itName},\${describeName} , 例如:-s notClass attributeTest#testAttribu

    示例代码:

      import { describe, it, expect, TestType, Size, Level } from '@ohos/hypium';
    
      export default function attributeTest() {
      describe('describeTest_000',  () => {
        it("testIt_00", TestType.FUNCTION | Size.SMALLTEST | Level.LEVEL0,  () => {
          console.info('Hello Test');
        })
    
        it("testIt_01", TestType.FUNCTION | Size.SMALLTEST | Level.LEVEL0, () => {
          console.info('Hello Test');
        })
      })
    
      describe('describeTest_001',  () => {
        it("testIt_02", TestType.FUNCTION | Size.SMALLTEST | Level.LEVEL0, () => {
          console.info('Hello Test');
        })
      })
    }

    示例命令1:

    hdc shell aa test -b xxx -m xxx -s unittest OpenHarmonyTestRunner -s class describeTest_000#testIt_00,describeTest_001

    该命令作用是执行“describeTest_001”测试套中所用用例,以及“describeTest_000”测试套中的“testIt_00”用例。

    示例命令2:

    hdc shell aa test -b xxx -m xxx -s unittest OpenHarmonyTestRunner -s notClass describeTest_000#testIt_01

    该命令作用是不执行“describeTest_000”测试套中的“testIt_01”用例。

  2. 随机执行 使测试套与测试用例随机执行,用于稳定性测试。

    Key 含义说明 Value取值范围
    random @since1.0.3 测试套、测试用例随机执行 true, 不传参默认为false, 例如:-s random true

    示例命令:

     hdc shell aa test -b xxx -m xxx -s unittest OpenHarmonyTestRunner -s stress 1000

UT有用的命令

  • 用例超时时间设置 指定测试用例执行的超时时间,用例实际耗时如果大于超时时间,用例会抛出"timeout"异常,用例结果会显示“excute timeout XXX”

    Key 含义说明 Value取值范围
    timeout 指定测试用例执行的超时时间 正整数(单位ms),默认为 5000,例如: -s timeout 15000

    示例命令:

    hdc shell aa test -b xxx -m xxx -s unittest OpenHarmonyTestRunner -s timeout 15000
  • 遇错即停模式

    Key 含义说明 Value取值范围
    breakOnError @since1.0.6 遇错即停模式,当执行用例断言失败或者发生错误时,退出测试执行流程 true, 不传参默认为false, 例如:-s breakOnError true

    示例命令:

    hdc shell aa test -b xxx -m xxx -s unittest OpenHarmonyTestRunner -s breakOnError true
  • 测试套中用例信息输出 输出测试应用中待执行的测试用例信息

    Key 含义说明 Value取值范围
    dryRun 显示待执行的测试用例信息全集 true, 不传参默认为false, 例如:-s dryRun true

    示例命令:

    hdc shell aa test -b xxx -m xxx -s unittest OpenHarmonyTestRunner -s dryRun true

总结

©著作权归作者所有,转载或内容合作请联系作者

您尚未登录,无法参与评论,登录后可以:
参与开源共建问题交流
认同或收藏高质量问答
获取积分成为开源共建先驱

Copyright   ©2023  OpenHarmony开发者论坛  京ICP备2020036654号-3 |技术支持 Discuz!

返回顶部