From 05745d8ec26754e352d42986fc8314924fcb8b5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E5=85=B5=E5=85=B5?= Date: Tue, 1 Jun 2021 16:33:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exampleapp/build.gradle | 1 + exampleapp/src/ohosTest/config.json | 41 +++++++++++++++++++ .../com/org/matomo/demo/ExampleOhosTest.java | 17 ++++++++ 3 files changed, 59 insertions(+) create mode 100644 exampleapp/src/ohosTest/config.json create mode 100644 exampleapp/src/ohosTest/java/com/org/matomo/demo/ExampleOhosTest.java diff --git a/exampleapp/build.gradle b/exampleapp/build.gradle index 9685208..e83affd 100644 --- a/exampleapp/build.gradle +++ b/exampleapp/build.gradle @@ -10,5 +10,6 @@ ohos { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) testCompile'junit:junit:4.12' + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' implementation project(':tracker') } diff --git a/exampleapp/src/ohosTest/config.json b/exampleapp/src/ohosTest/config.json new file mode 100644 index 0000000..ff3c1cf --- /dev/null +++ b/exampleapp/src/ohosTest/config.json @@ -0,0 +1,41 @@ +{ + "app": { + "bundleName": "com.org.matomo.demo", + "vendor": "org", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Release" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.org.matomo.demo", + "name": "testModule", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry_test", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "name": "decc.testkit.runner.EntryAbility", + "description": "Test Entry Ability", + "icon": "$media:icon", + "label": "Matomo Example App", + "launchType": "standard", + "orientation": "landscape", + "visible": true, + "type": "page" + } + ] + } +} \ No newline at end of file diff --git a/exampleapp/src/ohosTest/java/com/org/matomo/demo/ExampleOhosTest.java b/exampleapp/src/ohosTest/java/com/org/matomo/demo/ExampleOhosTest.java new file mode 100644 index 0000000..ca3927f --- /dev/null +++ b/exampleapp/src/ohosTest/java/com/org/matomo/demo/ExampleOhosTest.java @@ -0,0 +1,17 @@ +package com.org.matomo.demo; + +import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ExampleOhosTest { + /** + * 全UI应用、不支持Context,不支持单元测试 + */ + @Test + public void testBundleName() { + final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); + assertEquals("com.org.matomo.demo", actualBundleName); + } +} \ No newline at end of file -- Gitee