Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
70025852
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看板
提交
70025852
编写于
3月 19, 2022
作者:
D
dy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
aafwk update ets test
Signed-off-by:
N
dy
<
dingyao5@huawei.com
>
(cherry picked from commit
142e3b4c
)
上级
d35a19fd
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
139 addition
and
949 deletion
+139
-949
aafwk/aafwk_standard/ActsDataAbilityJsTest/entry/src/main/js/test/ActsDataAbilityJsTest.test.js
...Test/entry/src/main/js/test/ActsDataAbilityJsTest.test.js
+129
-0
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/ContextJsunit.test.ets
...ntry/src/main/ets/MainAbility/test/ContextJsunit.test.ets
+9
-9
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/DataAbility.test.ets
.../entry/src/main/ets/MainAbility/test/DataAbility.test.ets
+0
-818
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/List.test.ets
...etstest/entry/src/main/ets/MainAbility/test/List.test.ets
+0
-2
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets
...main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets
+1
-120
未找到文件。
aafwk/aafwk_standard/ActsDataAbilityJsTest/entry/src/main/js/test/ActsDataAbilityJsTest.test.js
浏览文件 @
70025852
...
...
@@ -718,4 +718,133 @@ it('ACTS_ARelease_0100', 0, async function (done) {
}
})
/*
* @tc.number: ACTS_Call_0100
* @tc.name: call : Inserts a single data record into the database.
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
it
(
"
ACTS_Call_0100
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0100 start......
'
);
var
pacMap
=
{
'
group_name
'
:
'
test1
'
,
'
ringtone_modify_time
'
:
28
};
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
expect
(
typeof
(
rDAHelper
)).
assertEqual
(
"
object
"
);
pacMap
.
group_name
=
'
test2
'
;
rDAHelper
.
call
(
dataAbilityUri
,
'
insert
'
,
''
,
pacMap
).
then
((
data
)
=>
{
console
.
info
(
'
ACTS_Call_0100 succeeded data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
error
(
'
ACTS_Call_0100 error:
'
+
JSON
.
stringify
(
error
));
});
done
();
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0100 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0100====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0100 end......
'
);
})
/*
* @tc.number: ACTS_Call_0200
* @tc.name: call : Queries data in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it
(
"
ACTS_Call_0200
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0200 start......
'
);
var
arg
=
"
{
\"
equalTo
\"
:
\"
group_name
\"
}
"
;
var
pacMap
=
{
"
group_name
"
:
"
test1
"
,
"
columns
"
:
"
group_name,ringtone_modify_time
"
};
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
query
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
ACTS_Call_0200 error:
'
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
'
ACTS_Call_0200 succeeded:
'
+
JSON
.
stringify
(
data
));
}
});
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0200 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0200====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0200 end......
'
);
})
/*
* @tc.number: ACTS_Call_0300
* @tc.name: call : Updates data records in the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it
(
"
ACTS_Call_0300
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0300 start......
'
);
var
arg
=
"
{
\"
equalTo
\"
:
\"
ringtone_modify_time
\"
}
"
;
var
pacMap
=
{
'
ringtone_modify_time
'
:
28
,
'
group_name
'
:
'
testupdata1
'
};
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
update
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
ACTS_Call_0300 error:
'
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
'
ACTS_Call_0300 succeeded:
'
+
JSON
.
stringify
(
data
));
}
});
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0300 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0300====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0300 end......
'
);
})
/*
* @tc.number: ACTS_Call_0400
* @tc.name: call : Deletes one or more data records from the database.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it
(
"
ACTS_Call_0400
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_Call_0400 start......
'
);
var
arg
=
"
{
\"
lessThan
\"
:
\"
ringtone_modify_time
\"
}
"
;
var
pacMap
=
{
'
ringtone_modify_time
'
:
32
,
};
var
rDAHelper
try
{
rDAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
console
.
debug
(
'
ACTS_AbeforeAll rDAHelper ====>:
'
+
rDAHelper
+
"
,JSON.
"
+
JSON
.
stringify
(
rDAHelper
));
rDAHelper
.
call
(
dataAbilityUri
,
'
delete
'
,
arg
,
pacMap
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
ACTS_Call_0400 error:
'
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
'
ACTS_Call_0400 succeeded:
'
+
JSON
.
stringify
(
data
));
}
});
done
();
}
catch
(
err
)
{
console
.
error
(
'
ACTS_Call_0400 catch(err)====>:
'
+
err
);
console
.
log
(
'
ACTS_Call_0400====<end catch(err)
'
);
done
();
}
console
.
log
(
'
ACTS_Call_0400 end......
'
);
})
})
\ No newline at end of file
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/ContextJsunit.test.ets
浏览文件 @
70025852
...
...
@@ -17,7 +17,7 @@ import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeEach, afterEach, it, expect} from "deccjsunit/index.ets";
import Utils from './Utils';
export default function
c
ontextJsunit() {
export default function
C
ontextJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info("context before each called");
...
...
@@ -47,11 +47,11 @@ export default function contextJsunit() {
})
} catch (error) {
console.log("logMessage context_getCacheDir_test_0100: error = " + error);
expect(error).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration/cache
");
expect(error).assertEqual("/data/
storage/el2/base/haps/entry/caches
");
}
var data1 = await context.getCacheDir();
expect(typeof (data1)).assertEqual("string");
expect(data1).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration/cache
");
expect(data1).assertEqual("/data/
storage/el2/base/haps/entry/caches
");
done();
console.log("------------------end context_getCacheDir_test_0100-------------------");
});
...
...
@@ -74,11 +74,11 @@ export default function contextJsunit() {
});
} catch (error) {
console.log("logMessage context_getCacheDir_test_0200: error = " + error);
expect(error).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration/cache
");
expect(error).assertEqual("/data/
storage/el2/base/haps/entry/caches
");
}
var data1 = await context.getCacheDir();
expect(typeof (data1)).assertEqual("string");
expect(data1).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration/cache
");
expect(data1).assertEqual("/data/
storage/el2/base/haps/entry/caches
");
done();
console.log("------------------end context_getCacheDir_test_0200-------------------");
});
...
...
@@ -101,11 +101,11 @@ export default function contextJsunit() {
})
} catch (error) {
console.log("logMessage context_getFilesDir_test_0100: error = " + error);
expect(error).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration
/files");
expect(error).assertEqual("/data/
storage/el2/base/haps/entry
/files");
}
var data1 = await context.getFilesDir();
expect(typeof (data1)).assertEqual("string");
expect(data1).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration
/files");
expect(data1).assertEqual("/data/
storage/el2/base/haps/entry
/files");
done();
console.log("------------------end context_getFilesDir_test_0100-------------------");
});
...
...
@@ -128,11 +128,11 @@ export default function contextJsunit() {
});
} catch (error) {
console.log("logMessage context_getFilesDir_test_0200: error = " + error);
expect(error).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration
/files");
expect(error).assertEqual("/data/
storage/el2/base/haps/entry
/files");
}
var data1 = await context.getFilesDir();
expect(typeof (data1)).assertEqual("string");
expect(data1).assertEqual("/data/
accounts/account_0/appdata/com.ohos.acecollaboration
/files");
expect(data1).assertEqual("/data/
storage/el2/base/haps/entry
/files");
done();
console.log("------------------end context_getFilesDir_test_0200-------------------");
});
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/DataAbility.test.ets
已删除
100644 → 0
浏览文件 @
d35a19fd
此差异已折叠。
点击以展开。
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/List.test.ets
浏览文件 @
70025852
...
...
@@ -19,11 +19,9 @@ import getAbilityInfoJsunit from './getAbilityInfoJsunit.test.ets';
import getApplicationContext from './getApplicationContextJsunit.test.ets';
import getAppVersionInfoJsunit from './getAppVersionInfoJsunit.test.ets';
import ContextJsunit from './ContextJsunit.test.ets';
import DataAbilityJsunit from './DataAbility.test.ets';
export default function testsuite() {
ContextJsunit();
DataAbilityJsunit();
addContextAndAbilityJsunit();
getHapModuleInfoJsunit();
getAbilityInfoJsunit();
...
...
aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets
浏览文件 @
70025852
...
...
@@ -75,29 +75,6 @@ export default function getHapModuleInfoJsunit() {
done();
});
/**
* @tc.number: context_getHapModuleInfo_test_0300_1
* @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application.
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
it('context_getHapModuleInfo_test_0300_1', 0, async function (done) {
console.info('[context_getHapModuleInfo_test_0300_1] START');
var str = {
"want": {
"bundleName": "com.ohos.acecollaboration",
"abilityName": "com.example.myapplication1.MainAbility",
},
};
ability_featureAbility.startAbility(str)
.then((data) => {
console.info('[context_getHapModuleInfo_test_0300_1] start myapplication1 successful: ' + JSON.stringify(data))
}).catch((error) => {
console.error('[context_getHapModuleInfo_test_0300_1] start myapplication1 Cause: ' + JSON.stringify(error));
})
done();
});
function checkHapModuleInfo(msg, data) {
console.log(msg + "checkHapModuleInfo start " + JSON.stringify(data));
console.log(msg + "checkHapModuleInfo name : " + data.name);
...
...
@@ -147,10 +124,7 @@ export default function getHapModuleInfoJsunit() {
expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0);
expect(data.deviceTypes[0]).assertEqual("phone");
for (var i = 0; i < data.abilityInfos.length; i++) {
console.log(msg + "-------AbilityInfo data.abilityInfos[" + i + "] : START ------" );
checkAbilityInfo(msg,data.abilityInfos[i]);
}
checkAbilityInfo(msg,data.abilityInfos[0]);
expect(data.moduleName).assertEqual("entry")
expect(data.mainAbilityName).assertEqual("");
expect(data.installationFree).assertEqual(false);
...
...
@@ -233,8 +207,6 @@ export default function getHapModuleInfoJsunit() {
expect(data.label).assertEqual("$string:entry_MainAbility");
expect(data.description).assertEqual("$string:mainability_description");
expect(data.icon).assertEqual("$media:icon");
expect(data.descriptionId > 0).assertTrue();
expect(data.iconId > 0).assertTrue();
expect(data.moduleName).assertEqual("entry");
expect(data.process).assertEqual("");
expect(data.targetAbility).assertEqual("");
...
...
@@ -247,106 +219,15 @@ export default function getHapModuleInfoJsunit() {
expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.readPermission).assertEqual("");
expect(data.writePermission).assertEqual("");
checkApplicationInfo(msg,data.applicationInfo);
expect(data.formEntity).assertEqual(0);
expect(data.minFormHeight).assertEqual(0);
expect(data.defaultFormHeight).assertEqual(0);
expect(data.minFormWidth).assertEqual(0);
expect(data.defaultFormWidth).assertEqual(0);
expect(data.uri).assertEqual("");
expect(data.labelId > 0).assertTrue();
expect(data.subType).assertEqual(0);
console.log(msg+ "---checkAbilityInfo End--- ");
}
function checkApplicationInfo(msg,info) {
console.log(msg+ "checkApplicationInfo start : " + JSON.stringify(info));
console.log(msg+ "checkApplicationInfo name : " + info.name);
console.log(msg+ "checkApplicationInfo description : " + info.description);
console.log(msg+ "checkApplicationInfo descriptionId : " + info.descriptionId);
console.log(msg+ "checkApplicationInfo systemApp : " + info.systemApp);
console.log(msg+ "checkApplicationInfo enabled : " + info.enabled);
console.log(msg+ "checkApplicationInfo label : " + info.label);
console.log(msg+ "checkApplicationInfo labelId : " + info.labelId);
console.log(msg+ "checkApplicationInfo icon : " + info.icon);
console.log(msg+ "checkApplicationInfo iconId : " + info.iconId);
console.log(msg+ "checkApplicationInfo process : " + info.process);
console.log(msg+ "checkApplicationInfo supportedModes : " + info.supportedModes);
console.log(msg+ "checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
for (var j = 0; j < info.moduleSourceDirs.length; j++) {
console.log(msg+ "checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
}
console.log(msg+ "checkApplicationInfo permissions length : " + info.permissions.length);
for (var k = 0; k < info.permissions.length; k++) {
console.log(msg+ "checkApplicationInfo info.permissions[" + k + "] : " + info.permissions[k]);
}
console.log(msg+ "checkApplicationInfo moduleInfos length : " + info.moduleInfos.length);
for (var i = 0; i < info.moduleInfos.length; i++) {
console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleName : " +
info.moduleInfos[i].moduleName);
console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleSourceDir : " +
info.moduleInfos[i].moduleSourceDir);
}
console.log(msg+ "checkApplicationInfo entryDir : " + info.entryDir);
expect(typeof (info)).assertEqual("object");
expect(typeof (info.name)).assertEqual("string");
expect(typeof (info.description)).assertEqual("string");
expect(typeof (info.descriptionId)).assertEqual("number");
expect(typeof (info.systemApp)).assertEqual("boolean");
expect(typeof (info.enabled)).assertEqual("boolean");
expect(typeof (info.label)).assertEqual("string");
expect(typeof (info.labelId)).assertEqual("string");
expect(typeof (info.icon)).assertEqual("string");
expect(typeof (info.iconId)).assertEqual("string");
expect(typeof (info.process)).assertEqual("string");
expect(typeof (info.supportedModes)).assertEqual("number");
expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
expect(Array.isArray(info.permissions)).assertEqual(true);
expect(Array.isArray(info.moduleInfos)).assertEqual(true);
expect(typeof (info.entryDir)).assertEqual("string");
if (info.moduleSourceDirs.length == 1){
expect(info.moduleInfos[0].moduleName).assertEqual("entry");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}else if(info.moduleSourceDirs.length == 2) {
if (info.moduleInfos[0].moduleName == "myapplication1") {
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication1");
expect(info.moduleInfos[1].moduleName).assertEqual("entry");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}else{
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication2");
expect(info.moduleInfos[1].moduleName).assertEqual("entry");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}
}else {
expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication1");
expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2");
expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.example.myapplication2");
expect(info.moduleInfos[2].moduleName).assertEqual("entry");
expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
}
expect(info.name).assertEqual("com.ohos.acecollaboration");
expect(info.description).assertEqual("$string:mainability_description");
expect(info.descriptionId > 0).assertTrue();
expect(info.systemApp).assertEqual(true);
expect(info.enabled).assertEqual(true);
expect(info.label).assertEqual("$string:entry_MainAbility");
expect(info.icon).assertEqual("$media:icon");
expect(info.process).assertEqual("");
expect(info.supportedModes).assertEqual(0);
expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" +
"com.ohos.acecollaboration/com.ohos.acecollaboration");
console.log(msg+ "---checkApplicationInfo End--- ");
}
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录