diff --git a/POP3Client/entry/src/ohosTest/ets/test/POP3Press.test.ets b/POP3Client/entry/src/ohosTest/ets/test/POP3Press.test.ets index 031e8250328f62ab4448bb557efd03af41ee50b7..dc5655b5deee02cceb6fd48da53fe06430b7a6b6 100644 --- a/POP3Client/entry/src/ohosTest/ets/test/POP3Press.test.ets +++ b/POP3Client/entry/src/ohosTest/ets/test/POP3Press.test.ets @@ -36,10 +36,11 @@ export default function POP3PressTest() { let selectMsgNum: number = -1 let isListShow: boolean = false const BASE_COUNT = 1000 - + let count = 1; + let id = undefined; describe('POP3PressTest', function () { - for (var i = 1;i < BASE_COUNT; i++) { + function allApiInterface() { it('LIST', 0, function () { let option = { @@ -54,7 +55,6 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.LIST(); - console.log("LIST count:" + i) }) it('STAT', 0, function () { @@ -70,7 +70,6 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.STAT() - console.log("STAT count:" + i) }) it('NOOP', 0, function () { @@ -86,7 +85,6 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.NOOP() - console.log("NOOP count:" + i) }) it('UIDL', 0, function () { @@ -102,7 +100,6 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.UIDL("1") - console.log("UIDL count:" + i) }) it('RSET', 0, function () { @@ -118,7 +115,6 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.RSET() - console.log("RSET count:" + i) }) it('RETR', 0, function () { @@ -134,7 +130,6 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.RETR("1") - console.log("RETR count:" + i) }) it('DELE', 0, function () { @@ -150,7 +145,6 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.DELE("1") - console.log("DELE count:" + i) }) it('QUIT', 0, function () { @@ -166,7 +160,6 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.QUIT() - console.log("QUIT count:" + i) }) it('connect', 0, function () { @@ -182,7 +175,6 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.connect() - console.log("connect count:" + i) }) it('TOP', 0, function () { @@ -198,10 +190,10 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.TOP("1") - console.log("TOP count:" + i) + }) - it('command', 0, function () { + it('command', 0, function (done) { let option = { host: 'pop.qq.com', port: 110, @@ -214,9 +206,23 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.command("NOOP") - console.log("command count:" + i) + if (id) { + clearInterval(id) + id = undefined; + } + if (count <= BASE_COUNT) { + count += 1; + console.log(`POP3---count -1 --->${count}`); + id = setTimeout(function () { + allApiInterface() + done() + }, 1000) + } else { + console.log(`POP3---count -2--->${count}`); + done() + } }) } - + allApiInterface() }) } \ No newline at end of file diff --git a/SMTPClient/entry/src/ohosTest/ets/test/SMTPPress.test.ets b/SMTPClient/entry/src/ohosTest/ets/test/SMTPPress.test.ets index dfcfd023df60b3f4bd2163447b26ad49678c4809..1b76921893f39abcdba62736a6bd63312b542599 100644 --- a/SMTPClient/entry/src/ohosTest/ets/test/SMTPPress.test.ets +++ b/SMTPClient/entry/src/ohosTest/ets/test/SMTPPress.test.ets @@ -17,10 +17,10 @@ export default function SMTPPressTest() { let subject: string = 'test' let content: string = 'test' const BASE_COUNT = 1000 - + let count = 1; + let id = undefined; describe('SMTPPressTest', function () { - - for (var i = 1;i <= BASE_COUNT; i++) { + function allApiInterface() { it('new_SMTPClient', 0, function () { let client = new SMTPClient({ user: '479868299@qq.com', @@ -32,10 +32,9 @@ export default function SMTPPressTest() { ssl: false, tls: undefined }); - console.log("new SMTPClient count:" + i); }) - it('sendAsync', 0, function () { + it('sendAsync', 0, function (done) { let client = new SMTPClient({ user: '479868299@qq.com', password: 'bfxeualuaxambged', @@ -57,8 +56,23 @@ export default function SMTPPressTest() { attachment: null } client.sendAsync(msg) - console.log("sendAsync count:" + i) + if (id) { + clearInterval(id) + id = undefined; + } + if (count <= BASE_COUNT) { + count += 1; + console.log(`SMTP---count -1 --->${count}`); + id = setTimeout(function () { + allApiInterface() + done() + }, 1000) + } else { + console.log(`SMTP---count -2--->${count}`); + done() + } }) } + allApiInterface() }) } \ No newline at end of file