1
0
This commit is contained in:
2021-11-18 10:22:47 +08:00
parent 9b000db778
commit 3f2060c8b2
109 changed files with 1047 additions and 714 deletions

View File

@@ -0,0 +1,11 @@
export default {
onCreate() {
console.info('Application onCreate')
},
onShow() {
console.info('Application onShow')
},
onDestroy() {
console.info('Application onDestroy')
},
}

View File

@@ -0,0 +1,8 @@
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}

View File

@@ -0,0 +1,8 @@
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}

View File

@@ -0,0 +1,51 @@
import {Core, ExpectExtend, InstrumentLog} from "deccjsunit/index"
import testsuite from "../../../test/List.test.ets"
import app from '@system.app'
import featureAbility from "@ohos.ability.featureAbility"
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance()
const instrumentLog = new InstrumentLog({
'id': 'report', 'unity': 'true'
})
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.addService('report', instrumentLog)
core.init()
core.subscribeEvent('spec', instrumentLog)
core.subscribeEvent('suite', instrumentLog)
core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(Want.parameters)
testsuite()
core.execute()
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}

View File

@@ -0,0 +1,12 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import app from '@system.app'
export default function exampleJsunit() {
describe('appInfoTest', function () {
it('app_info_test_001', 0, function () {
var info = app.getInfo()
expect("1.0").assertEqual('1.0')
expect(info.versionCode).assertEqual('3')
})
})
}

View File

@@ -0,0 +1,5 @@
import exampleJsunit from "../test/ExampleJsunit.test.ets"
export default function testsuite() {
exampleJsunit()
}

View File

@@ -0,0 +1,14 @@
package com.xclexample.myapplication;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ExampleOhosTest {
@Test
public void testBundleName() {
final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
assertEquals("com.xclexample.myapplication", actualBundleName);
}
}

View File

@@ -0,0 +1,12 @@
{
"string": [
{
"name": "app_name",
"value": "MyApplication"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB