2048-f
This commit is contained in:
		
							
								
								
									
										11
									
								
								MyApplication2/entry/src/ohosTest/ets/default/app.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								MyApplication2/entry/src/ohosTest/ets/default/app.ets
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| export default { | ||||
|   onCreate() { | ||||
|     console.info('Application onCreate') | ||||
|   }, | ||||
|   onShow() { | ||||
|     console.info('Application onShow') | ||||
|   }, | ||||
|   onDestroy() { | ||||
|     console.info('Application onDestroy') | ||||
|   }, | ||||
| } | ||||
| @@ -0,0 +1,8 @@ | ||||
| { | ||||
|   "strings": { | ||||
|     "hello": "Hello", | ||||
|     "world": "World" | ||||
|   }, | ||||
|   "Files": { | ||||
|   } | ||||
| } | ||||
| @@ -0,0 +1,8 @@ | ||||
| { | ||||
|   "strings": { | ||||
|     "hello": "您好", | ||||
|     "world": "世界" | ||||
|   }, | ||||
|   "Files": { | ||||
|   } | ||||
| } | ||||
| @@ -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%') | ||||
|   } | ||||
| } | ||||
|  | ||||
| @@ -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') | ||||
|     }) | ||||
|   }) | ||||
| } | ||||
							
								
								
									
										5
									
								
								MyApplication2/entry/src/ohosTest/ets/test/List.test.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								MyApplication2/entry/src/ohosTest/ets/test/List.test.ets
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| import exampleJsunit from "../test/ExampleJsunit.test.ets" | ||||
|  | ||||
| export default function testsuite() { | ||||
|   exampleJsunit() | ||||
| } | ||||
| @@ -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); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,12 @@ | ||||
| { | ||||
|   "string": [ | ||||
|     { | ||||
|       "name": "app_name", | ||||
|       "value": "MyApplication" | ||||
|     }, | ||||
|     { | ||||
|       "name": "mainability_description", | ||||
|       "value": "hap sample empty page" | ||||
|     } | ||||
|   ] | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								MyApplication2/entry/src/ohosTest/resources/base/media/icon.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								MyApplication2/entry/src/ohosTest/resources/base/media/icon.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 6.6 KiB | 
		Reference in New Issue
	
	Block a user