Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b2bb98f4
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看板
提交
b2bb98f4
编写于
2月 20, 2023
作者:
Z
zhangyushuai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
request用例优化 004
Signed-off-by:
N
zhangyushuai
<
zhangyushuai1@huawei.com
>
上级
6c59d190
变更
7
展开全部
显示空白变更内容
内联
并排
Showing
7 changed file
with
513 addition
and
394 deletion
+513
-394
inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets
...est_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets
+11
-14
request/RequestTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...ge/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+1
-1
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
...st_Stage/entry/src/main/ets/test/requestDownload.test.ets
+145
-99
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
...Test_Stage/entry/src/main/ets/test/requestUpload.test.ets
+8
-10
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
...Test_ets/entry/src/main/ets/test/requestDownload.test.ets
+336
-246
request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets
...stTest_ets/entry/src/main/ets/test/requestUpload.test.ets
+10
-22
theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
...screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
+2
-2
未找到文件。
inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets
浏览文件 @
b2bb98f4
...
@@ -24,13 +24,6 @@ export default function imeAbilityTest(abilityContext) {
...
@@ -24,13 +24,6 @@ export default function imeAbilityTest(abilityContext) {
id:'',
id:'',
extra:{}
extra:{}
}
}
/**
* sleep function.
*/
function sleep(date, time){
while(Date.now() - date <= time);
}
/**
/**
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
...
@@ -75,12 +68,14 @@ export default function imeAbilityTest(abilityContext) {
...
@@ -75,12 +68,14 @@ export default function imeAbilityTest(abilityContext) {
}
}
inputMethod.switchInputMethod(imExtAbilityProperty).then((data)=>{
inputMethod.switchInputMethod(imExtAbilityProperty).then((data)=>{
console.info('====>SUB_InputMethod_IMEAbility_000
4
switchInputMethod to IME :' + data);
console.info('====>SUB_InputMethod_IMEAbility_000
1
switchInputMethod to IME :' + data);
expect(data == true).assertTrue();
expect(data == true).assertTrue();
});
});
sleep(Date.now(), 3000);
let t = setTimeout(() => {
console.info('====>----------SUB_InputMethod_IMEAbility_0001 end-------------');
console.info('====>----------SUB_InputMethod_IMEAbility_0001 end-------------' + t);
clearTimeout(t);
done();
done();
}, 500);
})
})
/**
/**
...
@@ -105,9 +100,11 @@ export default function imeAbilityTest(abilityContext) {
...
@@ -105,9 +100,11 @@ export default function imeAbilityTest(abilityContext) {
console.info('====>SUB_InputMethod_IMEAbility_0002 switchInputMethod to IME :' + data);
console.info('====>SUB_InputMethod_IMEAbility_0002 switchInputMethod to IME :' + data);
expect(data == true).assertTrue();
expect(data == true).assertTrue();
});
});
sleep(Date.now(), 2500);
let t = setTimeout(() => {
console.info('====>-----------SUB_InputMethod_IMEAbility_0002 end-------------');
console.info('====>----------SUB_InputMethod_IMEAbility_0001 end-------------' + t);
clearTimeout(t);
done();
done();
}, 500);
})
})
})
})
}
}
request/RequestTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
浏览文件 @
b2bb98f4
...
@@ -59,7 +59,7 @@ export default class OpenHarmonyTestRunner implements TestRunner {
...
@@ -59,7 +59,7 @@ export default class OpenHarmonyTestRunner implements TestRunner {
}
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
cmd : %{public}s
'
,
cmd
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
cmd : %{public}s
'
,
cmd
);
abilityDelegator
.
executeShellCommand
(
"
echo
\"
123456
\"
> /data/app/el2/100/base/com.acts.request
test
.test/haps/entry_test/cache/test.txt
"
,
abilityDelegator
.
executeShellCommand
(
"
echo
\"
123456
\"
> /data/app/el2/100/base/com.acts.request.test/haps/entry_test/cache/test.txt
"
,
(
err
:
any
,
d
:
any
)
=>
{
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
...
...
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
b2bb98f4
此差异已折叠。
点击以展开。
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
浏览文件 @
b2bb98f4
...
@@ -89,8 +89,7 @@ export default function requestUploadJSUnit() {
...
@@ -89,8 +89,7 @@ export default function requestUploadJSUnit() {
it('SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001', 0, async function (done) {
it('SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 is starting-----------------------");
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 is starting-----------------------");
try {
try {
request.uploadFile(globalThis.abilityContext, uploadConfig, (err, data)=>{
request.uploadFile(globalThis.abilityContext, uploadConfig, (err, uploadTask)=>{
uploadTask = data;
console.info("====>SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 uploadFile: " + uploadTask);
console.info("====>SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 uploadFile: " + uploadTask);
try{
try{
expect(true).assertEqual(uploadTask != undefined);
expect(true).assertEqual(uploadTask != undefined);
...
@@ -101,8 +100,9 @@ export default function requestUploadJSUnit() {
...
@@ -101,8 +100,9 @@ export default function requestUploadJSUnit() {
} catch (err) {
} catch (err) {
console.error("====>SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 error: " + err);
console.error("====>SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 error: " + err);
};
};
setTimeout(()=>{
let t =
setTimeout(()=>{
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 end-----------------------");
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 end-----------------------");
clearTimeout(t);
done();
done();
}, 10000);
}, 10000);
});
});
...
@@ -117,8 +117,7 @@ export default function requestUploadJSUnit() {
...
@@ -117,8 +117,7 @@ export default function requestUploadJSUnit() {
it('SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001', 0, async function (done) {
it('SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 is starting-----------------------");
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 is starting-----------------------");
try{
try{
request.uploadFile(globalThis.abilityContext, uploadConfig).then(data => {
request.uploadFile(globalThis.abilityContext, uploadConfig).then(uploadTask => {
uploadTask = data;
console.info("====>SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 uploadFile: " + uploadTask);
console.info("====>SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 uploadFile: " + uploadTask);
try{
try{
expect(true).assertEqual(uploadTask != undefined);
expect(true).assertEqual(uploadTask != undefined);
...
@@ -132,8 +131,9 @@ export default function requestUploadJSUnit() {
...
@@ -132,8 +131,9 @@ export default function requestUploadJSUnit() {
}catch(err){
}catch(err){
console.error("====>SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 catch error: " + err);
console.error("====>SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 catch error: " + err);
}
}
setTimeout(()=>{
let t =
setTimeout(()=>{
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 end-----------------------");
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 end-----------------------");
clearTimeout(t);
done();
done();
}, 10000);
}, 10000);
});
});
...
@@ -147,9 +147,8 @@ export default function requestUploadJSUnit() {
...
@@ -147,9 +147,8 @@ export default function requestUploadJSUnit() {
*/
*/
it('SUB_REQUEST_UPLOAD_API_DELETE_0001', 0, async function (done) {
it('SUB_REQUEST_UPLOAD_API_DELETE_0001', 0, async function (done) {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 is starting-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 is starting-----------------------");
request.uploadFile(globalThis.abilityContext, uploadConfig, (err,
data
) => {
request.uploadFile(globalThis.abilityContext, uploadConfig, (err,
uploadTask
) => {
try{
try{
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask: " + uploadTask);
console.info("====>SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask: " + uploadTask);
expect(uploadTask != undefined).assertEqual(true);
expect(uploadTask != undefined).assertEqual(true);
uploadTask.delete((err, data) => {
uploadTask.delete((err, data) => {
...
@@ -184,8 +183,7 @@ export default function requestUploadJSUnit() {
...
@@ -184,8 +183,7 @@ export default function requestUploadJSUnit() {
*/
*/
it('SUB_REQUEST_UPLOAD_API_DELETE_0002', 0, async function (done) {
it('SUB_REQUEST_UPLOAD_API_DELETE_0002', 0, async function (done) {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0002 is starting-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0002 is starting-----------------------");
request.uploadFile(globalThis.abilityContext, uploadConfig, (err, data) => {
request.uploadFile(globalThis.abilityContext, uploadConfig, (err, uploadTask) => {
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_API_DELETE_0002 uploadTask: " + uploadTask);
console.info("====>SUB_REQUEST_UPLOAD_API_DELETE_0002 uploadTask: " + uploadTask);
try{
try{
expect(uploadTask != undefined).assertEqual(true);
expect(uploadTask != undefined).assertEqual(true);
...
...
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
b2bb98f4
此差异已折叠。
点击以展开。
request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets
浏览文件 @
b2bb98f4
...
@@ -49,13 +49,6 @@ export default function requestUploadJSUnit() {
...
@@ -49,13 +49,6 @@ export default function requestUploadJSUnit() {
console.info('====>afterAll: Test suite-level cleanup condition is executed');
console.info('====>afterAll: Test suite-level cleanup condition is executed');
});
});
/**
* sleep function.
*/
function sleep(date, time){
while(Date.now() - date <= time);
}
let uploadTask;
let uploadTask;
let RequestData = {
let RequestData = {
name: 'name',
name: 'name',
...
@@ -265,11 +258,9 @@ export default function requestUploadJSUnit() {
...
@@ -265,11 +258,9 @@ export default function requestUploadJSUnit() {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 is starting-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 is starting-----------------------");
try {
try {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 uploadConfig = " + JSON.stringify(uploadConfig));
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 uploadConfig = " + JSON.stringify(uploadConfig));
request.upload(uploadConfig, (err, data) => {
request.upload(uploadConfig, (err, uploadTask) => {
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask));
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask));
expect(uploadTask != undefined).assertEqual(true);
expect(uploadTask != undefined).assertEqual(true);
uploadTask.on('progress', function (data1, data2) {
uploadTask.on('progress', function (data1, data2) {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data1 =" + data1);
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data1 =" + data1);
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data2 =" + data2);
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data2 =" + data2);
...
@@ -282,15 +273,15 @@ export default function requestUploadJSUnit() {
...
@@ -282,15 +273,15 @@ export default function requestUploadJSUnit() {
uploadTask.remove((err, data) => {
uploadTask.remove((err, data) => {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 remove =" + data);
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 remove =" + data);
expect(data).assertEqual(true);
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 end-----------------------");
done();
});
});
});
});
} catch (err) {
} catch (err) {
console.error("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 error: " + err);
console.error("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 error: " + err);
expect().assertFail();
expect().assertFail();
}
}
sleep(Date.now(), 20000);
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 end-----------------------");
done();
});
});
/**
/**
...
@@ -305,33 +296,30 @@ export default function requestUploadJSUnit() {
...
@@ -305,33 +296,30 @@ export default function requestUploadJSUnit() {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 is starting-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 is starting-----------------------");
try {
try {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 UploadConfig = " + JSON.stringify(uploadConfig));
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 UploadConfig = " + JSON.stringify(uploadConfig));
request.upload(uploadConfig).then((data) => {
request.upload(uploadConfig).then((uploadTask) => {
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 uploadTask = " + uploadTask);
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {}));
expect(true).assertEqual((uploadTask != undefined));
uploadTask.on('headerReceive', (header) => {
uploadTask.on('headerReceive', (header) => {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header);
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header);
expect(true).assertEqual((header != undefined) || (header != "") || (header != {}
));
expect(true).assertEqual((header != {} || header != undefined
));
});
});
uploadTask.off('headerReceive', (header) => {
uploadTask.off('headerReceive', (header) => {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header);
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header);
expect(true).assertEqual((header != undefined) || (header != "") || (header != {}
));
expect(true).assertEqual((header != {} || header != undefined
));
});
});
uploadTask.remove().then((result)=>{
uploadTask.remove().then((result)=>{
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 remove result = " + result);
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 remove result = " + result);
expect(result).assertEqual(true);
expect(result).assertEqual(true);
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 end-----------------------");
done();
});
});
});
});
} catch (e) {
} catch (e) {
console.error("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 error: " + JSON.stringify(e));
console.error("====>SUB_REQUEST_UPLOAD_API_PROMISE_0001 error: " + JSON.stringify(e));
expect(true).assertFail(true);
expect(true).assertFail(true);
}
}
sleep(Date.now(), 20000);
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 end-----------------------");
done();
});
});
})
})
}
}
theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
浏览文件 @
b2bb98f4
...
@@ -170,7 +170,7 @@ export default function screenLockJSUnit() {
...
@@ -170,7 +170,7 @@ export default function screenLockJSUnit() {
screenLock.isSecureMode((err, data) => {
screenLock.isSecureMode((err, data) => {
try{
try{
console.info("====>SUB_MISC_THEME_screenLock_API_0003 secureMode's result is " + data);
console.info("====>SUB_MISC_THEME_screenLock_API_0003 secureMode's result is " + data);
expect(data ==
result
).assertTrue();
expect(data ==
false
).assertTrue();
console.info("====>------------------end SUB_MISC_THEME_screenLock_API_0003-------------------");
console.info("====>------------------end SUB_MISC_THEME_screenLock_API_0003-------------------");
done();
done();
}catch(err){
}catch(err){
...
@@ -288,7 +288,7 @@ export default function screenLockJSUnit() {
...
@@ -288,7 +288,7 @@ export default function screenLockJSUnit() {
try{
try{
secured = screenLock.isSecure()
secured = screenLock.isSecure()
console.info('====>SUB_MISC_THEME_screenLock_API_0011 data : ' + JSON.stringify(secured));
console.info('====>SUB_MISC_THEME_screenLock_API_0011 data : ' + JSON.stringify(secured));
if (
typeof secured == "boolean"
) {
if (
secured == false
) {
expect(true).assertTrue();
expect(true).assertTrue();
console.info('====>-------------SUB_MISC_THEME_screenLock_API_0011 end----------------------');
console.info('====>-------------SUB_MISC_THEME_screenLock_API_0011 end----------------------');
done()
done()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录