Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f6686aa5
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f6686aa5
编写于
9月 22, 2022
作者:
L
lihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update case
Signed-off-by:
N
lihao
<
lihao334@huawei.com
>
上级
615f81b7
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
228 addition
and
63 deletion
+228
-63
telephony/telephonyjstest/observer/BUILD.gn
telephony/telephonyjstest/observer/BUILD.gn
+6
-2
telephony/telephonyjstest/observer/Test.json
telephony/telephonyjstest/observer/Test.json
+5
-4
telephony/telephonyjstest/observer/entry/src/main/config.json
...phony/telephonyjstest/observer/entry/src/main/config.json
+28
-1
telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/index.ets
...t/observer/entry/src/main/ets/MainAbility/pages/index.ets
+0
-28
telephony/telephonyjstest/observer/entry/src/main/ets/TestAbility/app.ets
...onyjstest/observer/entry/src/main/ets/TestAbility/app.ets
+32
-0
telephony/telephonyjstest/observer/entry/src/main/ets/TestAbility/pages/index.ets
...t/observer/entry/src/main/ets/TestAbility/pages/index.ets
+49
-0
telephony/telephonyjstest/observer/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...er/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+77
-0
telephony/telephonyjstest/observer/entry/src/main/ets/test/List.test.ets
...honyjstest/observer/entry/src/main/ets/test/List.test.ets
+0
-0
telephony/telephonyjstest/observer/entry/src/main/ets/test/ObserverJsunit.test.ets
.../observer/entry/src/main/ets/test/ObserverJsunit.test.ets
+23
-28
telephony/telephonyjstest/observer/entry/src/main/ets/test/Utils.ets
...elephonyjstest/observer/entry/src/main/ets/test/Utils.ets
+0
-0
telephony/telephonyjstest/observer/entry/src/main/ets/test/lib/Const.js
...phonyjstest/observer/entry/src/main/ets/test/lib/Const.js
+0
-0
telephony/telephonyjstest/observer/entry/src/main/resources/base/element/string.json
...bserver/entry/src/main/resources/base/element/string.json
+8
-0
未找到文件。
telephony/telephonyjstest/observer/BUILD.gn
浏览文件 @
f6686aa5
...
...
@@ -18,16 +18,20 @@ ohos_js_hap_suite("ActsObserverEtsTest") {
deps = [
":ace_demo_ets_assets",
":ace_demo_ets_resources",
":ace_demo_ets_test_assets",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsObserverEtsTest"
part_name = "
netstack
"
subsystem_name = "
communication
"
part_name = "
ril_adapter
"
subsystem_name = "
telephony
"
}
ohos_js_assets("ace_demo_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_js_assets("ace_demo_ets_test_assets") {
source_dir = "./entry/src/main/ets/TestAbility"
}
ohos_resources("ace_demo_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
...
...
telephony/telephonyjstest/observer/Test.json
浏览文件 @
f6686aa5
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"1500000"
,
"package"
:
"com.ohos.observer"
,
"shell-timeout"
:
"60000"
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"2000000"
,
"bundle-name"
:
"com.ohos.observer"
,
"package-name"
:
"com.ohos.observer"
,
"shell-timeout"
:
"2000000"
},
"kits"
:
[
{
...
...
telephony/telephonyjstest/observer/entry/src/main/config.json
浏览文件 @
f6686aa5
...
...
@@ -17,7 +17,7 @@
"package"
:
"com.ohos.observer"
,
"name"
:
".MyApplication"
,
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
"
MainAbility
"
,
"srcPath"
:
""
,
"deviceType"
:
[
"phone"
],
...
...
@@ -50,6 +50,19 @@
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"TestAbility"
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:TestAbility_desc"
,
"formsEnabled"
:
false
,
"label"
:
"$string:TestAbility_label"
,
"type"
:
"page"
,
"launchType"
:
"standard"
}
],
"reqPermissions"
:
[
...
...
@@ -130,6 +143,20 @@
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
...
...
telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/index.ets
浏览文件 @
f6686aa5
...
...
@@ -13,39 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import testsuite from "../test/List.test.ets";
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 expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
Want.parameters['timeout'] = 100000
console.info('parameters---->' + JSON.stringify(Want.parameters));
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() {
...
...
telephony/telephonyjstest/observer/entry/src/main/ets/TestAbility/app.ets
0 → 100644
浏览文件 @
f6686aa5
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
telephony/telephonyjstest/observer/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
f6686aa5
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
telephony/telephonyjstest/observer/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
f6686aa5
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s itName
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s package
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
'
onAbilityCreateCallback
'
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
'
addAbilityMonitorCallback :
'
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
}
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext
'
)
var
context
=
abilityDelegator
.
getAppContext
()
console
.
info
(
'
getAppContext :
'
+
JSON
.
stringify
(
context
))
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
telephony/telephonyjstest/observer/entry/src/main/ets/
MainAbility/
test/List.test.ets
→
telephony/telephonyjstest/observer/entry/src/main/ets/test/List.test.ets
浏览文件 @
f6686aa5
文件已移动
telephony/telephonyjstest/observer/entry/src/main/ets/
MainAbility/
test/ObserverJsunit.test.ets
→
telephony/telephonyjstest/observer/entry/src/main/ets/test/ObserverJsunit.test.ets
浏览文件 @
f6686aa5
...
...
@@ -67,12 +67,10 @@ export default function observerJsunit() {
*/
it('Telephony_observer_observer_DataConnectState_0200', 0, function (done) {
console.log("************* Telephony_observer_observer_DataConnectState_0200 Test start *************")
if (utils.notCheck) {
expect(true).assertTrue()
done()
}
// console.log(observer.DataConnectState)
console.log("Telephony_observer_observer_DataConnectState_0200" + observer.DataConnectState)
expect(observer.DataConnectState == undefined).assertTrue();
console.log("************* Telephony_observer_observer_DataConnectState_0200 Test end *************")
done();
})
/*
...
...
@@ -82,11 +80,8 @@ export default function observerJsunit() {
*/
it('Telephony_observer_observer_RatType_0100', 0, async function (done) {
console.log("************* Telephony_observer_observer_RatType_0100 Test start *************")
if (utils.notCheck) {
expect(true).assertTrue()
done()
}
// console.log(observer.RatType)
console.log("Telephony_observer_observer_RatType_0100" +observer.RatType)
expect(observer.RatType == undefined).assertTrue();
console.log("************* Telephony_observer_observer_RatType_0100 Test end *************")
done()
})
...
...
@@ -103,7 +98,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_networkStateChange_0100 Test end *************")
done()
})
...
...
@@ -122,7 +117,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_networkStateChange_0200 Test end *************")
done()
})
...
...
@@ -139,7 +134,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_off_networkStateChange_0100 Test end *************")
done()
})
...
...
@@ -156,7 +151,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_signalInfoChange_0100 Test end *************")
done()
})
...
...
@@ -175,7 +170,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_signalInfoChange_0200 Test end *************")
done()
})
...
...
@@ -192,7 +187,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_off_signalInfoChange_0100 Test end *************")
done()
})
...
...
@@ -211,7 +206,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0100 Test end *************")
done()
})
...
...
@@ -230,7 +225,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0200 Test end *************")
done()
})
...
...
@@ -247,7 +242,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_off_cellularDataConnectionStateChange_0100 Test end *************")
done()
})
...
...
@@ -264,7 +259,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0100 Test end *************")
done()
})
...
...
@@ -283,7 +278,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0200 Test end *************")
done()
})
...
...
@@ -300,7 +295,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_off_cellularDataFlowChange_0100 Test end *************")
done()
})
...
...
@@ -317,7 +312,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_callStateChange_0100 Test end *************")
done()
})
...
...
@@ -336,7 +331,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_callStateChange_0200 Test end *************")
done()
})
...
...
@@ -353,7 +348,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_off_callStateChange_0100 Test end *************")
done()
})
...
...
@@ -370,7 +365,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_simStateChange_0100 Test end *************")
done()
})
...
...
@@ -389,7 +384,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_on_simStateChange_0200 Test end *************")
done()
})
...
...
@@ -406,7 +401,7 @@ export default function observerJsunit() {
done()
return
})
setTimeout(timeout, 3000)
//
setTimeout(timeout, 3000)
console.log("************* Telephony_observer_observer_off_simStateChange_0100 Test end *************")
done()
})
...
...
telephony/telephonyjstest/observer/entry/src/main/ets/
MainAbility/
test/Utils.ets
→
telephony/telephonyjstest/observer/entry/src/main/ets/test/Utils.ets
浏览文件 @
f6686aa5
文件已移动
telephony/telephonyjstest/observer/entry/src/main/ets/
MainAbility/
test/lib/Const.js
→
telephony/telephonyjstest/observer/entry/src/main/ets/test/lib/Const.js
浏览文件 @
f6686aa5
文件已移动
telephony/telephonyjstest/observer/entry/src/main/resources/base/element/string.json
浏览文件 @
f6686aa5
...
...
@@ -7,6 +7,14 @@
{
"name"
:
"description_mainability"
,
"value"
:
"ETS_Empty Ability"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录