提交 b0f0b0b0 编写于 作者: T tuxingsun

add testcase for hiappevent

Signed-off-by: Ntuxingsun <duanhaizhen@huawei.com>
上级 ca7ff60f
......@@ -22,7 +22,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi01
* @tc.desc HiAppEvent write interface test.
*/
it('testHiAppEventApi01', Function|MediumTest|Level1, function () {
it('testHiAppEventApi01', 1, function () {
console.info('testHiAppEventApi01 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_int", 100, "key_float", 1.1, "key_string", "demo", "key_bool", true,
......@@ -49,7 +49,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi02
* @tc.desc HiAppEvent write json interface test.
*/
it('testHiAppEventApi02', Function|MediumTest|Level1, function () {
it('testHiAppEventApi02', 1, function () {
console.info('testHiAppEventApi02 start')
var result = false;
HiAppEvent.writeJson("writeJson", HiAppEvent.EventType.FAULT, {"key_int": 100, "key_string": "demo", "key_bool":true, "key_float":1.1
......@@ -74,7 +74,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi03
* @tc.desc HiAppEvent write EventType of STATISTIC.
*/
it('testHiAppEventApi03', Function|MediumTest|Level2, function () {
it('testHiAppEventApi03', 2, function () {
console.info('testHiAppEventApi03 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.STATISTIC, "key_int", 100, "key_float", 1.1, "key_string", "demo", "key_bool", true,
......@@ -99,7 +99,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi04
* @tc.desc HiAppEvent write EventType of SECURITY.
*/
it('testHiAppEventApi04', Function|MediumTest|Level2, function () {
it('testHiAppEventApi04', 2, function () {
console.info('testHiAppEventApi04 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.SECURITY, "key_int", 100, "key_float", 1.1, "key_string", "demo", "key_bool", true,
......@@ -124,7 +124,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi05
* @tc.desc HiAppEvent write EventType of BEHAVIOR.
*/
it('testHiAppEventApi05', Function|MediumTest|Level2, function () {
it('testHiAppEventApi05', 2, function () {
console.info('testHiAppEventApi05 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.BEHAVIOR, "key_int", 100, "key_float", 1.1, "key_string", "demo", "key_bool", true,
......@@ -150,7 +150,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi06
* @tc.desc HiAppEvent write datatype of int.
*/
it('testHiAppEventApi06', Function|MediumTest|Level2, function () {
it('testHiAppEventApi06', 2, function () {
console.info('testHiAppEventApi06 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_int", 100,
......@@ -173,7 +173,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi07
* @tc.desc HiAppEvent write datatype of int array.
*/
it('testHiAppEventApi07', Function|MediumTest|Level2, function () {
it('testHiAppEventApi07', 2, function () {
console.info('testHiAppEventApi07 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_int_array", [100, 200],
......@@ -196,7 +196,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi08
* @tc.desc HiAppEvent write datatype of float.
*/
it('testHiAppEventApi08', Function|MediumTest|Level2, function () {
it('testHiAppEventApi08', 2, function () {
console.info('testHiAppEventApi08 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_float", 1.1,
......@@ -219,7 +219,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi09
* @tc.desc HiAppEvent write datatype of float array.
*/
it('testHiAppEventApi09', Function|MediumTest|Level3, function () {
it('testHiAppEventApi09', 3, function () {
console.info('testHiAppEventApi09 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_float_array", [1.1, 1.2],
......@@ -242,7 +242,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi10
* @tc.desc HiAppEvent write datatype of string.
*/
it('testHiAppEventApi10', Function|MediumTest|Level3, function () {
it('testHiAppEventApi10', 3, function () {
console.info('testHiAppEventApi10 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_string", "hello world",
......@@ -265,7 +265,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi11
* @tc.desc HiAppEvent write datatype of string array.
*/
it('testHiAppEventApi11', Function|MediumTest|Level3, function () {
it('testHiAppEventApi11', 3, function () {
console.info('testHiAppEventApi11 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_string_array", ["hello world", "hello world2"],
......@@ -288,7 +288,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi12
* @tc.desc HiAppEvent write datatype of bool with true.
*/
it('testHiAppEventApi12', Function|MediumTest|Level3, function () {
it('testHiAppEventApi12', 3, function () {
console.info('testHiAppEventApi12 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_bool", true,
......@@ -311,7 +311,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi13
* @tc.desc HiAppEvent write datatype of bool with false.
*/
it('testHiAppEventApi13', Function|MediumTest|Level3, function () {
it('testHiAppEventApi13', 3, function () {
console.info('testHiAppEventApi13 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_bool", false,
......@@ -334,7 +334,7 @@ describe('HiAppEventApiTest', function () {
* @tc.name testHiAppEventApi14
* @tc.desc HiAppEvent write datatype of bool array.
*/
it('testHiAppEventApi14', Function|MediumTest|Level3, function () {
it('testHiAppEventApi14', 3, function () {
console.info('testHiAppEventApi14 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_bool_array", [false, true],
......@@ -351,4 +351,175 @@ describe('HiAppEventApiTest', function () {
});
console.info('testHiAppEventApi14 end')
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_1500
* @tc.name testHiAppEventApi15
* @tc.desc HiAppEvent write datatype of char.
*/
it('testHiAppEventApi15', 3, function () {
console.info('testHiAppEventApi15 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_char", 'c',
(err, value) => {
console.log(`HiAppEvent into json-callback`);
if (err) {
console.error(`HiAppEvent json-callback-error code=${err.code}`);
result = false;
} else {
console.log(`HiAppEvent json-callback-success value=${value}`);
result = true;
}
expect(result).assertTrue();
});
console.info('testHiAppEventApi15 end')
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_1600
* @tc.name testHiAppEventApi16
* @tc.desc HiAppEvent write datatype of long.
*/
it('testHiAppEventApi16', 3, function () {
console.info('testHiAppEventApi16 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_long", 2147483647,
(err, value) => {
console.log(`HiAppEvent into json-callback`);
if (err) {
console.error(`HiAppEvent json-callback-error code=${err.code}`);
result = false;
} else {
console.log(`HiAppEvent json-callback-success value=${value}`);
result = true;
}
expect(result).assertTrue();
});
console.info('testHiAppEventApi16 end')
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_1700
* @tc.name testHiAppEventApi17
* @tc.desc HiAppEvent write datatype of double.
*/
it('testHiAppEventApi17', 3, function () {
console.info('testHiAppEventApi17 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_double", 100.123,
(err, value) => {
console.log(`HiAppEvent into json-callback`);
if (err) {
console.error(`HiAppEvent json-callback-error code=${err.code}`);
result = false;
} else {
console.log(`HiAppEvent json-callback-success value=${value}`);
result = true;
}
expect(result).assertTrue();
});
console.info('testHiAppEventApi17 end')
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_1800
* @tc.name testHiAppEventApi18
* @tc.desc HiAppEvent write datatype of long.
*/
it('testHiAppEventApi18', 3, function () {
console.info('testHiAppEventApi18 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_longlong", 2147483647,
(err, value) => {
console.log(`HiAppEvent into json-callback`);
if (err) {
console.error(`HiAppEvent json-callback-error code=${err.code}`);
result = false;
} else {
console.log(`HiAppEvent json-callback-success value=${value}`);
result = true;
}
expect(result).assertTrue();
});
console.info('testHiAppEventApi18 end')
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_1900
* @tc.name testHiAppEventApi19
* @tc.desc HiAppEvent write eventtype of none exists.
*/
it('testHiAppEventApi19', 3, function () {
console.info('testHiAppEventApi19 start')
var result = false;
HiAppEvent.write("write", HiAppEvent.EventType.BEHAVIOR + 1, "key_longlong", 2147483647,
(err, value) => {
console.log(`HiAppEvent into json-callback`);
if (err) {
console.error(`HiAppEvent json-callback-error code=${err.code}`);
result = false;
} else {
console.log(`HiAppEvent json-callback-success value=${value}`);
result = true;
}
expect(result).assertFalse();
});
console.info('testHiAppEventApi19 end')
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2000
* @tc.name testHiAppEventApi19
* @tc.desc HiAppEvent write empty eventname .
*/
it('testHiAppEventApi20', 3, function () {
console.info('testHiAppEventApi20 start')
var result = false;
HiAppEvent.write("", HiAppEvent.EventType.FAULT, "key_longlong", 2147483647,
(err, value) => {
console.log(`HiAppEvent into json-callback`);
if (err) {
console.error(`HiAppEvent json-callback-error code=${err.code}`);
result = false;
} else {
console.log(`HiAppEvent json-callback-success value=${value}`);
result = true;
}
expect(result).assertTrue();
});
console.info('testHiAppEventApi20 end')
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2100
* @tc.name testHiAppEventApi21
* @tc.desc HiAppEvent write long eventname .
*/
it('testHiAppEventApi21', 3, function () {
console.info('testHiAppEventApi21 start')
var result = false;
var i = 0;
var strlong = "";
while (i < 1000) {
strlong = strlong + "eventnamelong";
i = i + 1;
}
HiAppEvent.write(strlong, HiAppEvent.EventType.FAULT, "key_longlong", 2147483647,
(err, value) => {
console.log(`HiAppEvent into json-callback`);
if (err) {
console.error(`HiAppEvent json-callback-error code=${err.code}`);
result = false;
} else {
console.log(`HiAppEvent json-callback-success value=${value}`);
result = true;
}
expect(result).assertTrue();
});
console.info('testHiAppEventApi21 end')
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册