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

!6394 电话用例整改

Merge pull request !6394 from zhangfuzhi/master
......@@ -417,7 +417,7 @@ export default function ObjectInterfaceTest() {
try {
var resultSet = await contactsapi.queryContact(queryId);
console.info("contactsApi_query_contact_test_400 : query resultSet = " + JSON.stringify(resultSet));
expect(resultSet != null).assertTrue();
expect(resultSet == undefined).assertTrue();
done();
} catch (error) {
console.info("contactsApi_query_contact_test_400 query error = " + error);
......@@ -437,7 +437,7 @@ export default function ObjectInterfaceTest() {
done();
return;
}
var queryId = gRawContactId.toString();
var queryId = gRawContactId;
var holder = {
bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1
}
......@@ -445,7 +445,8 @@ export default function ObjectInterfaceTest() {
expect(holder.displayName === null).assertFalse();
expect(holder.holderId != 0).assertTrue();
try {
var resultSet = await contactsapi.queryContact(queryId, holder);
var findKey = contactsapi.queryKey(queryId);
var resultSet = await contactsapi.queryContact(findKey, holder);
console.info("contactsApi_query_contact_test_500 : query resultSet = " + JSON.stringify(resultSet));
expect(resultSet === null).assertFalse();
done();
......@@ -467,7 +468,7 @@ export default function ObjectInterfaceTest() {
done();
return;
}
var queryId = gRawContactId.toString();
var queryId = gRawContactId;
var holder = {
bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1
};
......@@ -475,7 +476,8 @@ export default function ObjectInterfaceTest() {
attributes: [1, 5, 6]
}
try {
var resultSet = await contactsapi.queryContact(queryId, holder, ContactAttributes);
var findKey = contactsapi.queryKey(queryId);
var resultSet = await contactsapi.queryContact(findKey, holder, ContactAttributes);
console.info("contactsApi_query_contact_test_600 : query resultSet = " + JSON.stringify(resultSet));
expect(resultSet === null).assertFalse();
done();
......@@ -1051,7 +1053,7 @@ export default function ObjectInterfaceTest() {
try {
var updateCode = await contactsapi.updateContact(updateValues, condition);
console.info("abnormal_contactsApi_update_test_3000 : updateCode = " + updateCode);
expect(updateCode === -1).assertFalse();
expect(updateCode === -1).assertTrue();
done();
} catch (error) {
console.info("abnormal_contactsApi_update_test_3000 : update error = " + error);
......
......@@ -32,15 +32,12 @@ describe("Telephony_NetManager_NetWorkTest", function () {
},
fail : function(data,code){
console.info("NetManager code "+ code)
expect(code === 602).assertTrue()
expect(code == 602).assertTrue()
done();
},
complete : function(){
expect().assertTrue()
done();
}
})
done();
});
/**
......@@ -56,15 +53,12 @@ describe("Telephony_NetManager_NetWorkTest", function () {
},
fail : function(data,code){
console.info("NetManager code "+ code)
expect(code === 602).assertTrue()
expect(code == 602).assertTrue()
done();
},
complete : function(){
expect().assertTrue()
done();
}
})
done();
});
/**
......@@ -80,11 +74,10 @@ describe("Telephony_NetManager_NetWorkTest", function () {
},
fail : function(data,code){
console.info("NetManager code "+ code)
expect(code === 602).assertTrue()
expect(code == 602).assertTrue()
done();
}
})
done();
})
/**
......@@ -100,11 +93,10 @@ describe("Telephony_NetManager_NetWorkTest", function () {
},
fail : function(data,code){
console.info("NetManager code "+ code)
expect(code === 602).assertTrue()
expect(code == 602).assertTrue()
done();
}
})
done();
})
});
......
......@@ -15,6 +15,14 @@
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602",
"uinput -T -m 425 1000 425 500 400"
]
}
]
}
......@@ -29,6 +29,7 @@
const TIMEOUT = 100;
const TIMEOUT_1 = 1000;
let VALUE = 0;
let envReady = false;
function sleep(timeout) {
return new Promise((resolve, reject) => {
......@@ -2258,6 +2259,11 @@
* @tc.desc Function test
*/
it('Telephony_NetworkManager_unregister_Async_0100', 0, async function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let caseName = 'Telephony_NetworkManager_unregister_Async_0100';
let netSpecifier = {
netCapabilities: {
......@@ -2353,6 +2359,11 @@
* @tc.desc Function test
*/
it('Telephony_NetworkManager_unregister_Async_0200', 0, async function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let caseName = 'Telephony_NetworkManager_unregister_Async_0200';
let netConn = connection.createNetConnection();
netConn.on('netAvailable', (error, value) => {
......@@ -2439,6 +2450,11 @@
* @tc.desc Function test
*/
it('Telephony_NetworkManager_unregister_Async_0300', 0, async function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let caseName = 'Telephony_NetworkManager_unregister_Async_0300';
let netConn = connection.createNetConnection();
netConn.on('netAvailable', (error, value) => {
......
......@@ -19,7 +19,7 @@ export default function Telephony_NETSTACK_SocketTest() {
describe('Telephony_NETSTACK_SocketTest', function () {
let envReady = false;
/**
* @tc.number Telephony_NetStack_UDPTest0100
......@@ -28,6 +28,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.bind({
address: "127.0.0.1",
......@@ -47,6 +52,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest0200', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.bind({
address: "127.0.0.1",
......@@ -66,6 +76,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest0300', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.send({
address: {
......@@ -88,6 +103,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest0400', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.send({
address: {
......@@ -110,6 +130,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest0500', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.close(function (err, data) {
expect(err !== undefined).assertTrue()
......@@ -125,6 +150,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest0600', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.close().then(function (data) {
expect(data !== undefined).assertTrue()
......@@ -140,6 +170,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest0700', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.getState(function (err, data) {
expect(err !== undefined).assertTrue()
......@@ -155,6 +190,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest0800', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.getState().then(function (data) {
expect(data !== undefined).assertTure()
......@@ -170,6 +210,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest0900', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.setExtraOptions({}, function (err, data) {
expect(err !== undefined).assertTure()
......@@ -185,6 +230,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest1000', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.setExtraOptions({},).then(function (date) {
expect(date !== undefined).assertTrue()
......@@ -200,6 +250,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest1100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.on('message', function () {
expect().assertFail()
......@@ -227,6 +282,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_UDPTest1200', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let udp = netSocket.constructUDPSocketInstance()
udp.on('message', function () {
})
......@@ -262,6 +322,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest0100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.bind({
address: "127.0.0.1",
......@@ -281,6 +346,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest0200', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.bind({
address: "127.0.0.1",
......@@ -300,6 +370,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest0300', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.send({
data: "Hello"
......@@ -317,6 +392,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest0400', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.send({
data: "Hello"
......@@ -334,6 +414,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest0500', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.close(function (err, data) {
expect(err !== undefined).assertTrue()
......@@ -349,6 +434,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest0600', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.close().then(function (data) {
expect(data !== undefined).assertTrue()
......@@ -364,6 +454,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest0700', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.getState(function (err, data) {
expect(err !== undefined).assertTrue()
......@@ -379,6 +474,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest0800', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.getState().then(function (data) {
expect(data !== undefined).assertTure()
......@@ -394,6 +494,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest0900', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.setExtraOptions({}, function (err, data) {
expect(err !== undefined).assertTure()
......@@ -409,6 +514,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest1000', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.setExtraOptions({},).then(function (date) {
expect(date !== undefined).assertTrue()
......@@ -424,6 +534,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest1100', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.on('message', function () {
expect().assertFail()
......@@ -451,6 +566,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it('Telephony_NetStack_TCPTest1200', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.on('message', function () {
})
......@@ -485,6 +605,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
* @tc.desc Function test
*/
it('Telephony_NetStack_TCPTest1300', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.getRemoteAddress(function (err, data) {
expect(err !== undefined).assertTure()
......@@ -499,6 +624,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
* @tc.desc Function test
*/
it('Telephony_NetStack_TCPTest1400', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let tcp = netSocket.constructTCPSocketInstance()
tcp.getRemoteAddress().then(function (data) {
expect(data !== undefined).assertTure()
......@@ -513,6 +643,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
* @tc.desc Function test
*/
it("Telephony_NetStack_TCPTest_1500", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let TCP = netSocket.constructTCPSocketInstance()
TCP.connect({
address: {
......@@ -534,6 +669,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
* @tc.desc Function test
*/
it("Telephony_NetStack_TCPTest_1600", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
let TCP = netSocket.constructTCPSocketInstance()
TCP.connect({
address: {
......
......@@ -19,12 +19,19 @@ import utils from './Utils.ets'
export default function connectionSecondJsUnit() {
describe("connectionSecondJsunit", function () {
let envReady = false;
/**
* @tc.name: Telephony_connection_ConnectionProperties_0100
* @tc.desc: ConnectionProperties Properties detection
* @tc.author: kangyuntao
*/
it("Telephony_connection_ConnectionProperties_0100", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony ConnectionProperties Test is starting-----------------------");
let caseName = 'Telephony_connection_ConnectionProperties_0100';
try {
......@@ -74,6 +81,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getConnectionProperties_Async_0200', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getConnectionProperties Test is starting-----------------------");
if(false){
expect(true).assertTrue();
......@@ -119,6 +131,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it("Telephony_connection_RouteInfo_0300", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("----------------------RouteInfo Properties Test is starting-----------------------");
try {
let resultInterface = {
......@@ -158,6 +175,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getRouteInfo_Async_0400', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getRouteInfo Test is starting-----------------------");
let caseName = 'Telephony_connection_getRouteInfo_Async_0400';
connection.getAllNets((error, value) => {
......@@ -195,6 +217,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it("Telephony_connection_LinkAddress_0500", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("----------------------LinkAddress Properties Test is starting-----------------------");
try {
let resultPrefixLength = {
......@@ -214,6 +241,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getLinkAddress_Async_0600', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getLinkAddress Test is starting-----------------------");
let caseName = 'Telephony_connection_getLinkAddress_Async_0600';
connection.getAllNets((error, value) => {
......@@ -249,6 +281,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it("Telephony_connection_NetAddress_0700", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("----------------------NetAddress Properties Test is starting-----------------------");
try {
let resultPort = {
......@@ -268,6 +305,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetAddress_Async_0800', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getNetAddress Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetAddress_Async_0800';
connection.getAllNets((error, value) => {
......@@ -303,6 +345,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it("Telephony_connection_NetCap_0900", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony NetCap Properties Test is starting-----------------------");
if (false) {
expect(true).assertTrue();
......@@ -329,6 +376,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetCap_Async_1000', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getNetCap Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetCap_Async_1000';
connection.getAllNets((error, value) => {
......@@ -362,6 +414,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it("Telephony_connection_NetBearType_1100", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony NetBearType Properties Test is starting-----------------------");
if (false) {
expect(true).assertTrue();
......@@ -385,6 +442,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetBearType_Async_1200', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getNetBearType Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetBearType_Async_1200';
connection.getAllNets((error, value) => {
......@@ -418,6 +480,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetCapabilities_Promise_1300', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getNetCapabilities Promise Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetCapabilities_Promise_1300';
connection.getAllNets().then((handle) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册