diff --git a/example/build.gradle b/example/build.gradle index 9a01645ed42fe56d95e5db6d29495bc745c6f1fe..642c86dd6b5fb1e4317202e0340f9f5fabce7c40 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -1,14 +1,28 @@ apply plugin: 'com.huawei.ohos.hap' +apply plugin: 'com.huawei.ohos.decctest' ohos { compileSdkVersion 5 defaultConfig { compatibleSdkVersion 5 } - + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) - testCompile 'junit:junit:4.12' - implementation(project(":pinview")) + implementation 'org.jetbrains:annotations:19.0.0' + testImplementation 'junit:junit:4.13' + implementation project(":pinview") + ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' } +decc { + supportType = ['html','xml'] +} \ No newline at end of file diff --git a/example/src/ohosTest/config.json b/example/src/ohosTest/config.json new file mode 100644 index 0000000000000000000000000000000000000000..5420f40e8c691f3926925acdae263f608b955c5c --- /dev/null +++ b/example/src/ohosTest/config.json @@ -0,0 +1,41 @@ +{ + "app": { + "bundleName": "com.goodiebag.pinview", + "vendor": "goodiebag", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Release" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.goodiebag.pinview", + "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": "Pinview", + "launchType": "standard", + "orientation": "landscape", + "visible": true, + "type": "page" + } + ] + } +} \ No newline at end of file diff --git a/example/src/ohosTest/java/com/goodiebag/pinview/ExampleOhosTest.java b/example/src/ohosTest/java/com/goodiebag/pinview/ExampleOhosTest.java new file mode 100644 index 0000000000000000000000000000000000000000..34786d0b115b36d549ba1e7a02a597d08fd6dfed --- /dev/null +++ b/example/src/ohosTest/java/com/goodiebag/pinview/ExampleOhosTest.java @@ -0,0 +1,17 @@ +package com.goodiebag.pinview; + +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.goodiebag.pinview", actualBundleName); + } +} \ No newline at end of file