提交 e7b1917e 编写于 作者: O openharmony_ci 提交者: Gitee

!454 【startup_standard】【master】fix problematic cases

Merge pull request !454 from 南先森/startup_standard
...@@ -18,6 +18,25 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' ...@@ -18,6 +18,25 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
import deviceinfo from '@ohos.deviceInfo' import deviceinfo from '@ohos.deviceInfo'
describe('DeviceInfoTest', function () { describe('DeviceInfoTest', function () {
beforeAll(function () {
console.info('beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.');
})
beforeEach(function () {
console.info('beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.');
})
afterEach(function () {
console.info('afterEach: Test case-level clearance conditions, which are executed after each test case is executed.');
})
afterAll(function () {
console.info('afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed');
})
console.info('start################################start'); console.info('start################################start');
/** /**
* @tc.number SUB_STARTUP_JS_DEVCEINFO_0100 * @tc.number SUB_STARTUP_JS_DEVCEINFO_0100
...@@ -407,7 +426,7 @@ describe('DeviceInfoTest', function () { ...@@ -407,7 +426,7 @@ describe('DeviceInfoTest', function () {
console.info('the value of the deviceinfo majorVersion is :' + majorVersionInfo); console.info('the value of the deviceinfo majorVersion is :' + majorVersionInfo);
expect(majorVersionInfo).assertInstanceOf('Number'); expect(majorVersionInfo).assertInstanceOf('Number');
if(majorVersionInfo !="" && majorVersionInfo != null && majorVersionInfo != undefined){ if(majorVersionInfo >= 0){
ret = true; ret = true;
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
...@@ -429,7 +448,7 @@ describe('DeviceInfoTest', function () { ...@@ -429,7 +448,7 @@ describe('DeviceInfoTest', function () {
console.info('the value of the deviceinfo seniorVersion is :' + seniorVersionInfo); console.info('the value of the deviceinfo seniorVersion is :' + seniorVersionInfo);
expect(seniorVersionInfo).assertInstanceOf('Number'); expect(seniorVersionInfo).assertInstanceOf('Number');
if(seniorVersionInfo !="" && seniorVersionInfo != null && seniorVersionInfo != undefined){ if(seniorVersionInfo >= 0){
ret = true; ret = true;
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
...@@ -451,7 +470,7 @@ describe('DeviceInfoTest', function () { ...@@ -451,7 +470,7 @@ describe('DeviceInfoTest', function () {
console.info('the value of the deviceinfo featureVersion is :' + featureVersionInfo); console.info('the value of the deviceinfo featureVersion is :' + featureVersionInfo);
expect(featureVersionInfo).assertInstanceOf('Number'); expect(featureVersionInfo).assertInstanceOf('Number');
if(featureVersionInfo !="" && featureVersionInfo != null && featureVersionInfo != undefined){ if(featureVersionInfo >= 0){
ret = true; ret = true;
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
...@@ -473,7 +492,7 @@ describe('DeviceInfoTest', function () { ...@@ -473,7 +492,7 @@ describe('DeviceInfoTest', function () {
console.info('the value of the deviceinfo buildVersion is :' + buildVersionInfo); console.info('the value of the deviceinfo buildVersion is :' + buildVersionInfo);
expect(buildVersionInfo).assertInstanceOf('Number'); expect(buildVersionInfo).assertInstanceOf('Number');
if(buildVersionInfo !="" && buildVersionInfo != null && buildVersionInfo != undefined){ if(buildVersionInfo >= 0){
ret = true; ret = true;
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
...@@ -495,7 +514,7 @@ describe('DeviceInfoTest', function () { ...@@ -495,7 +514,7 @@ describe('DeviceInfoTest', function () {
console.info('the value of the deviceinfo sdkApiVersion is :' + sdkApiVersionInfo); console.info('the value of the deviceinfo sdkApiVersion is :' + sdkApiVersionInfo);
expect(sdkApiVersionInfo).assertInstanceOf('Number'); expect(sdkApiVersionInfo).assertInstanceOf('Number');
if(sdkApiVersionInfo !="" && sdkApiVersionInfo != null && sdkApiVersionInfo != undefined){ if(sdkApiVersionInfo >= 0){
ret = true; ret = true;
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
...@@ -517,7 +536,7 @@ describe('DeviceInfoTest', function () { ...@@ -517,7 +536,7 @@ describe('DeviceInfoTest', function () {
console.info('the value of the deviceinfo firstApiVersion is :' + firstApiVersionInfo); console.info('the value of the deviceinfo firstApiVersion is :' + firstApiVersionInfo);
expect(firstApiVersionInfo).assertInstanceOf('Number'); expect(firstApiVersionInfo).assertInstanceOf('Number');
if(firstApiVersionInfo !="" && firstApiVersionInfo != null && firstApiVersionInfo != undefined){ if(firstApiVersionInfo >= 0){
ret = true; ret = true;
} }
expect(ret).assertTrue(); expect(ret).assertTrue();
......
...@@ -27,7 +27,7 @@ describe('SystemParameterTest', function () { ...@@ -27,7 +27,7 @@ describe('SystemParameterTest', function () {
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_001', 0, function () { it('system_parameter_test_001', 0, async function (done) {
console.info('system_parameter_test_001 start'); console.info('system_parameter_test_001 start');
var ret = false; var ret = false;
try { try {
...@@ -39,6 +39,7 @@ describe('SystemParameterTest', function () { ...@@ -39,6 +39,7 @@ describe('SystemParameterTest', function () {
console.info("set callback hw_sc.build.os.version value err:" + err.code); console.info("set callback hw_sc.build.os.version value err:" + err.code);
} }
}); });
done();
}catch(e){ }catch(e){
console.info("set callback hw_sc.build.os.version unexpect err:" + e); console.info("set callback hw_sc.build.os.version unexpect err:" + e);
} }
...@@ -54,7 +55,7 @@ describe('SystemParameterTest', function () { ...@@ -54,7 +55,7 @@ describe('SystemParameterTest', function () {
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_002', 0, function () { it('system_parameter_test_002', 0, async function (done) {
console.info('system_parameter_test_002 start'); console.info('system_parameter_test_002 start');
var ret = false; var ret = false;
try { try {
...@@ -67,6 +68,7 @@ describe('SystemParameterTest', function () { ...@@ -67,6 +68,7 @@ describe('SystemParameterTest', function () {
} }
}); });
done();
}catch(e){ }catch(e){
console.info("set callback ro.secure unexpect err:" + e) console.info("set callback ro.secure unexpect err:" + e)
} }
...@@ -82,7 +84,7 @@ describe('SystemParameterTest', function () { ...@@ -82,7 +84,7 @@ describe('SystemParameterTest', function () {
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_003', 0, function () { it('system_parameter_test_003', 0, async function (done) {
console.info('system_parameter_test_003 start'); console.info('system_parameter_test_003 start');
var parameterInfo = systemparameter.set("hw_sc.build.os.version", "1.5.3.6"); var parameterInfo = systemparameter.set("hw_sc.build.os.version", "1.5.3.6");
var ret = false; var ret = false;
...@@ -92,6 +94,7 @@ describe('SystemParameterTest', function () { ...@@ -92,6 +94,7 @@ describe('SystemParameterTest', function () {
}).catch(function (err) { }).catch(function (err) {
console.info("promise set hw_sc.build.os.version error: " + err.code); console.info("promise set hw_sc.build.os.version error: " + err.code);
}); });
done();
}catch(e){ }catch(e){
console.info("set callback hw_sc.build.os.version unexpect err:" + e) console.info("set callback hw_sc.build.os.version unexpect err:" + e)
} }
...@@ -110,7 +113,7 @@ describe('SystemParameterTest', function () { ...@@ -110,7 +113,7 @@ describe('SystemParameterTest', function () {
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_004', 0, function () { it('system_parameter_test_004', 0, async function (done) {
console.info('system_parameter_test_004 start'); console.info('system_parameter_test_004 start');
var parameterInfo = systemparameter.set("ro.secure", "10"); var parameterInfo = systemparameter.set("ro.secure", "10");
var ret = false; var ret = false;
...@@ -120,6 +123,7 @@ describe('SystemParameterTest', function () { ...@@ -120,6 +123,7 @@ describe('SystemParameterTest', function () {
}).catch(function (err) { }).catch(function (err) {
console.info("12333 promise set ro.secure error: " + err.code); console.info("12333 promise set ro.secure error: " + err.code);
}); });
done();
}catch(e){ }catch(e){
console.info("set callback ro.secure unexpect err:" + e) console.info("set callback ro.secure unexpect err:" + e)
} }
...@@ -174,32 +178,6 @@ describe('SystemParameterTest', function () { ...@@ -174,32 +178,6 @@ describe('SystemParameterTest', function () {
console.info('system_parameter_test_006 : PASS'); console.info('system_parameter_test_006 : PASS');
}) })
/**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0700
* @tc.name testGet01
* @tc.desc Set the value for the given key.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('system_parameter_test_007', 0, function () {
console.info('system_parameter_test_007 start');
var ret = false;
try {
var parameterInfo = systemparameter.get("ro.secure", "1");
parameterInfo.then(function (value) {
ret = true;
console.info("promise get ro.secure success: " + value);
}).catch(function (err) {
console.info("promise get ro.secure error: " + err.code);
});
}catch(e){
console.info("promise setSync ro.secure error: " + e);
}
setTimeout("expect(ret).assertTrue()", "10");
console.info('system_parameter_test_007 : PASS');
})
/** /**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0800 * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0800
* @tc.name testGet02 * @tc.name testGet02
...@@ -208,17 +186,19 @@ describe('SystemParameterTest', function () { ...@@ -208,17 +186,19 @@ describe('SystemParameterTest', function () {
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_008', 0, function () { it('system_parameter_test_008', 0, async function (done) {
console.info('system_parameter_test_008 start'); console.info('system_parameter_test_008 start');
var ret = false; var ret = false;
try { try {
var parameterInfo = systemparameter.get("hw_sc.build.os.version"); var parameterInfo = systemparameter.get("hw_sc.build.os.version");
parameterInfo.then(function (value) { parameterInfo.then(function (value) {
ret = true; ret = true;
console.info("promise get hw_sc.build.os.version success: " + value); console.info("promise get hw_sc.build.os.version success: " + value);
}).catch(function (err) { }).catch(function (err) {
console.info("promise get hw_sc.build.os.version error: " + err.code); console.info("promise get hw_sc.build.os.version error: " + err.code);
}); });
done();
}catch(e){ }catch(e){
console.info("promise setSync ro.secure error: " + e); console.info("promise setSync ro.secure error: " + e);
} }
...@@ -226,147 +206,6 @@ describe('SystemParameterTest', function () { ...@@ -226,147 +206,6 @@ describe('SystemParameterTest', function () {
console.info('system_parameter_test_008 : PASS'); console.info('system_parameter_test_008 : PASS');
}) })
/**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0900
* @tc.name testGet03
* @tc.desc Set the value for the given key.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('system_parameter_test_009', 0, function () {
console.info('system_parameter_test_009 start');
var ret = false;
try {
var parameterInfo = systemparameter.get("hw_sc.build.os.version", 897);
parameterInfo.then(function (value) {
console.info("897 promise get hw_sc.build.os.version success: " + value);
}).catch(function (err) {
console.info("897 promise get hw_sc.build.os.version error: " + err.code);
});
} catch (e) {
ret = true;
console.info("promise get input error: " + e);
}
expect(ret).assertTrue();
console.info('system_parameter_test_009 : PASS');
})
/**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0110
* @tc.name testGet04
* @tc.desc Set the value for the given key.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('system_parameter_test_010', 0, function () {
console.info('system_parameter_test_010 start');
var ret = false;
try {
systemparameter.get("hw_sc.build.os.version", 567, function (err, data) {
if (err == undefined) {
console.info(" 567 callback get hw_sc.build.os.version value success:" + data)
} else {
console.info(" 567 callback get hw_sc.build.os.version value err:" + err.code)
}
});
} catch (e) {
ret = true;
console.info(" 567 callback get inputttt error:" + e)
}
expect(ret).assertTrue();
console.info('system_parameter_test_010 : PASS');
})
/**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0120
* @tc.name testGet05
* @tc.desc Set the value for the given key.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('system_parameter_test_011', 0, function () {
console.info('system_parameter_test_011 start');
var ret = false;
try {
systemparameter.get("hw_sc.build.os.version", "10.20.30.4", function (err, data) {
if (err == undefined) {
ret = true;
console.info(" callback get hw_sc.build.os.version value success:" + data)
} else {
console.info(" callback get hw_sc.build.os.version value err:" + err.code)
}
});
} catch (e) {
ret = true;
console.info(" 567 callback get inputttt error:" + e)
}
setTimeout("expect(ret).assertTrue()", "10");
console.info('system_parameter_test_011 : PASS');
})
/**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0130
* @tc.name testGet06
* @tc.desc Set the value for the given key.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('system_parameter_test_012', 0, function () {
console.info('system_parameter_test_012 start');
var ret = false;
try {
systemparameter.get("ro.secure", "zbc", function (err, data) {
if (err == undefined) {
ret = true;
console.info("callback get ro.secure value success:" + data)
} else {
console.info("callback get ro.secure value err:" + err.code)
}
});
} catch (e) {
ret = true;
console.info(" 567 callback get inputttt error:" + e)
}
setTimeout("expect(ret).assertTrue()", "10");
console.info('system_parameter_test_012 : PASS');
})
/**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0140
* @tc.name testGet07
* @tc.desc Gets the value of the attribute with the specified key.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('system_parameter_test_013', 0, function () {
console.info('system_parameter_test_013 start');
var ret = false;
try {
systemparameter.get("ro.secure", function (err, data) {
if (err == undefined) {
ret = true;
console.info("callback get ro.secure value success:" + data)
} else {
console.info("callback get ro.secure value err:" + err.code)
}
});
} catch (e) {
ret = true;
console.info("callback get inputttt error:" + e)
}
setTimeout("expect(ret).assertTrue()", "10");
console.info('system_parameter_test_013 : PASS');
})
/** /**
* @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0150 * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0150
* @tc.name testGetSync01 * @tc.name testGetSync01
...@@ -375,7 +214,7 @@ describe('SystemParameterTest', function () { ...@@ -375,7 +214,7 @@ describe('SystemParameterTest', function () {
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('system_parameter_test_014', 0, function () { it('system_parameter_test_014', 0, async function (done) {
console.info('system_parameter_test_014 start'); console.info('system_parameter_test_014 start');
var ret = false; var ret = false;
try { try {
...@@ -385,6 +224,7 @@ describe('SystemParameterTest', function () { ...@@ -385,6 +224,7 @@ describe('SystemParameterTest', function () {
}).catch(function (err) { }).catch(function (err) {
console.info("496 promise get hw_sc.build.os.version error: " + err.code); console.info("496 promise get hw_sc.build.os.version error: " + err.code);
}); });
done();
} catch (e) { } catch (e) {
ret = true; ret = true;
console.info("promise get input error: " + e); console.info("promise get input error: " + e);
...@@ -392,5 +232,4 @@ describe('SystemParameterTest', function () { ...@@ -392,5 +232,4 @@ describe('SystemParameterTest', function () {
expect(ret).assertTrue(); expect(ret).assertTrue();
console.info('system_parameter_test_014 : PASS'); console.info('system_parameter_test_014 : PASS');
}) })
}) })
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册