未验证 提交 ce695e3d 编写于 作者: O openharmony_ci 提交者: Gitee

!6048 【Distributeddatamgr】【monthly_20221018】用例新增

Merge pull request !6048 from 梁梁/monthly_20221018
......@@ -18,6 +18,7 @@ group("distributeddatamgr") {
deps = [
"dataObjectjstest/hap:dataObject_js_test",
"dataSharejstest/hap:dataShare_js_test",
"distributedKVStoretest:distributedKVStoretest",
"kvStoretest:kvStoretest",
"preferencesjstest/hap:preferences_js_test",
"relationalStorejstest/hap:relationalstore_js_test",
......
# 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("//test/xts/tools/build/suite.gni")
group("distributedKVStoretest") {
testonly = true
if (is_standard_system) {
deps = [ "distributedKVStorejstest/hap:distributedKvStore_js_test" ]
}
}
# Copyright (C) 2021 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("distributedKvStore_js_test") {
hap_profile = "./src/main/config.json"
deps = [
":distributedkvStore_js_assets",
":distributedkvStore_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsDistributedKvStoreJsTest"
subsystem_name = "distributeddatamgr"
part_name = "kv_store"
}
ohos_js_assets("distributedkvStore_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("distributedkvStore_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "1200000",
"testcase-timeout": 60000,
"bundle-name": "ohos.acts.distributedKvStore",
"package-name": "ohos.acts.distributedKvStore",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsDistributedKvStoreJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "ohos.acts.distributedKvStore",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.distributedKvStore",
"name": ".entry",
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 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.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
</div>
/*
* Copyright (c) 2021 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.
*/
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ''
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
\ No newline at end of file
/*
* 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 '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* 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'
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', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import ddm from '@ohos.data.distributedKVStore';
export default function FieldNodeTest(){
describe('FieldNodeTest', function() {
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0100
* @tc.desc Test Js Api FieldNode.AppendChild() testcase 001
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0100
*/
it('SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0100', 0, async function(done) {
try {
let node = new ddm.FieldNode("root");
let child1 = new ddm.FieldNode("child1");
let child2 = new ddm.FieldNode("child2");
let child3 = new ddm.FieldNode("child3");
node.appendChild(child1);
node.appendChild(child2);
node.appendChild(child3);
child1 = null;
child2 = null;
child3 = null;
node = null;
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0100 " + e);
expect(null).assertFail();
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0200
* @tc.desc Test Js Api FieldNode.AppendChild() testcase 002
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0200
*/
it('SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0200', 0, async function(done) {
try {
let node = new ddm.FieldNode("root");
let child = new ddm.FieldNode("child");
node.appendChild(child);
child = null;
node = null;
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0200 " + e);
expect(null).assertFail();
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0300
* @tc.desc Test Js Api FieldNode.AppendChild() testcase 003
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0300
*/
it('SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0300', 0, async function(done) {
try {
let node = new ddm.FieldNode("root");
let child = new ddm.FieldNode();
node.appendChild(child);
expect(null).assertFail();
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_APPENDCHILD_0300 is ok :" + e);
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_TOJSON_0100
* @tc.desc Test Js Api FieldNode.ToJson() testcase 001
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_TOJSON_0100
*/
it('SUB_DDM_DKV_FIELDNODE_TOJSON_0100', 0, async function(done) {
try {
let node = new ddm.FieldNode("root");
let child = new ddm.FieldNode("child");
node.appendChild(child);
} catch (e) {
expect(null).assertFail();
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_TOJSON_0200
* @tc.desc Test Js Api FieldNode.ToJson() testcase 002
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_TOJSON_0200
*/
it('SUB_DDM_DKV_FIELDNODE_TOJSON_0200', 0, async function(done) {
try {
let node = new ddm.FieldNode("root");
let child = new ddm.FieldNode("child");
node.appendChild(child);
} catch (e) {
expect(null).assertFail();
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_TOJSON_0300
* @tc.desc Test Js Api FieldNode.ToJson() testcase 003
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_TOJSON_0300
*/
it('SUB_DDM_DKV_FIELDNODE_TOJSON_0300', 0, async function(done) {
try {
let node = new ddm.FieldNode();
let child = new ddm.FieldNode();
node.appendChild(child);
expect(null).assertFail();
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_TOJSON_0300 is ok : " + e);
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_DEFAULT_0100
* @tc.desc Test Js Api FieldNode.default testcase 001
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_DEFAULT_0100
*/
it('SUB_DDM_DKV_FIELDNODE_DEFAULT_0100', 0, async function(done) {
try {
let node = new ddm.FieldNode('first');
node.default = 'first name';
console.info('defaultValue = ' + node.default);
expect(node.default === 'first name').assertTrue()
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_DEFAULT_0100 fail on exception: " + e);
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_DEFAULT_0100
* @tc.desc Test Js Api FieldNode.nullable testcase 001
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_NULLABLE_0100
*/
it('SUB_DDM_DKV_FIELDNODE_DEFAULT_0100', 0, async function(done) {
try {
let node = new ddm.FieldNode('first');
node.nullable = false;
console.info('nullable = ' + node.nullable);
expect(node.nullable === false).assertTrue()
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_DEFAULT_0100 fail on exception: " + e);
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_TYPE_0100
* @tc.desc Test Js Api FieldNode.type testcase 001
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_TYPE_0100
*/
it('SUB_DDM_DKV_FIELDNODE_TYPE_0100', 0, async function(done) {
try {
let node = new ddm.FieldNode('first');
node.type = ddm.value.type.STRING;
console.info('type = ' + node.type);
expect(node.type === ddm.type.STRING).assertTrue()
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_TYPE_0100 fail on exception: " + e);
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_TYPE_0200
* @tc.desc Test Js Api FieldNode.type testcase 002
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_TYPE_0200
*/
it('SUB_DDM_DKV_FIELDNODE_TYPE_0200', 0, async function(done) {
try {
let node = new ddm.FieldNode('first');
node.type = ddm.type.INTEGER;
console.info('type = ' + node.type);
expect(node.type === ddm.type.INTEGER).assertTrue()
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_TYPE_0200 fail on exception: " + e);
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_TYPE_0300
* @tc.desc Test Js Api FieldNode.type testcase 003
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_TYPE_0300
*/
it('SUB_DDM_DKV_FIELDNODE_TYPE_0300', 0, async function(done) {
try {
let node = new ddm.FieldNode('first');
node.type = ddm.type.FLOAT;
console.info('type = ' + node.type);
expect(node.type === ddm.type.FLOAT).assertTrue()
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_TYPE_0300 fail on exception: " + e);
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_TYPE_0400
* @tc.desc Test Js Api FieldNode.type testcase 004
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_TYPE_0400
*/
it('SUB_DDM_DKV_FIELDNODE_TYPE_0400', 0, async function(done) {
try {
let node = new ddm.FieldNode('first');
node.type = ddm.type.BYTE_ARRAY;
console.info('type = ' + node.type);
expect(node.type === ddm.type.BYTE_ARRAY).assertTrue()
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_TYPE_0400 fail on exception: " + e);
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_TYPE_0500
* @tc.desc Test Js Api FieldNode.type testcase 005
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_TYPE_0500
*/
it('SUB_DDM_DKV_FIELDNODE_TYPE_0500', 0, async function(done) {
try {
let node = new ddm.FieldNode('first');
node.type = ddm.type.BOOLEAN;
console.info('type = ' + node.type);
expect(node.type === ddm.ValueType.BOOLEAN).assertTrue()
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_TYPE_0500 fail on exception: " + e);
}
done();
})
/**
* @tc.name SUB_DDM_DKV_FIELDNODE_TYPE_0600
* @tc.desc Test Js Api FieldNode.type testcase 006
* @tc.type: FUNC
* @tc.number: SUB_DDM_DKV_FIELDNODE_TYPE_0600
*/
it('SUB_DDM_DKV_FIELDNODE_TYPE_0600', 0, async function(done) {
try {
let node = new ddm.FieldNode('first');
node.type = ddm.type.DOUBLE;
console.info('type = ' + node.type);
expect(node.type === ddm.type.DOUBLE).assertTrue()
} catch (e) {
console.info("SUB_DDM_DKV_FIELDNODE_TYPE_0600 fail on exception: " + e);
}
done();
})
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册