52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
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%')
|
|
}
|
|
}
|
|
|