diff --git a/POP3Client/entry/src/ohosTest/ets/test/List.test.ets b/POP3Client/entry/src/ohosTest/ets/test/List.test.ets index 3c2a8efa169515482cb1fc11f3f7258c1d552c59..271e7581dfc6422d41605e53f7543ca1cf2cfb24 100644 --- a/POP3Client/entry/src/ohosTest/ets/test/List.test.ets +++ b/POP3Client/entry/src/ohosTest/ets/test/List.test.ets @@ -14,7 +14,8 @@ */ // import POP3Test from './POP3.test' -import POP3PressTest from './POP3Press.test' +// import POP3PressTest from './POP3Press.test' +import POP3PressTest from './POP3PressDeplayTime.test' export default function testsuite() { // POP3Test() diff --git a/POP3Client/entry/src/ohosTest/ets/test/POP3Press.test.ets b/POP3Client/entry/src/ohosTest/ets/test/POP3Press.test.ets index dc5655b5deee02cceb6fd48da53fe06430b7a6b6..d355107a7fa4c46c7d772571725c3fefc9af69ac 100644 --- a/POP3Client/entry/src/ohosTest/ets/test/POP3Press.test.ets +++ b/POP3Client/entry/src/ohosTest/ets/test/POP3Press.test.ets @@ -35,13 +35,9 @@ export default function POP3PressTest() { let client: Pop3Command = undefined let selectMsgNum: number = -1 let isListShow: boolean = false - const BASE_COUNT = 1000 - let count = 1; - let id = undefined; + const BASE_COUNT = 10000 describe('POP3PressTest', function () { - - function allApiInterface() { - + for (let i = 1;i <= BASE_COUNT; i++) { it('LIST', 0, function () { let option = { host: 'pop.qq.com', @@ -190,7 +186,7 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.TOP("1") - + }) it('command', 0, function (done) { @@ -206,23 +202,8 @@ export default function POP3PressTest() { } client = new Pop3Command(option); let result = client.command("NOOP") - 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() - } + console.log("command count:"+i) }) } - allApiInterface() }) } \ No newline at end of file diff --git a/POP3Client/entry/src/ohosTest/ets/test/POP3PressDeplayTime.test.ets b/POP3Client/entry/src/ohosTest/ets/test/POP3PressDeplayTime.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..10f0b810d00d721b7f764a577854f6f7f83328ed --- /dev/null +++ b/POP3Client/entry/src/ohosTest/ets/test/POP3PressDeplayTime.test.ets @@ -0,0 +1,251 @@ +/* + * Copyright (C) 2023 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 hilog from '@ohos.hilog'; +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from '@ohos/hypium' +import promptAction from '@ohos.promptAction' +import router from '@ohos.router' +import socket from '@ohos.net.socket' +import Pop3Command from '@ohos/node_pop3' +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import MsgBean from '../../../../../entry/src/main/ets/MsgBean' + +export default function POP3PressTest() { + + let message = 'Hello World' + let account = '479868299' + let password = 'prcryvqwfbspbhhi' + let mailType = '@qq.com' + let textValue = '' + let inputValue = 'click me' + let secure = false + let listData: Array = [] + let client: Pop3Command = undefined + let selectMsgNum: number = -1 + let isListShow: boolean = false + //总的次数 + const BASE_COUNT = 10000 + //每个用例延迟时间执行毫秒单位 + const deplayTime=500 + + describe('POP3PressTest', function () { + for (let i = 1;i <= BASE_COUNT; i++) { + it('LIST', 0, function (done) { + setTimeout(()=>{ + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + let result = client.LIST(); + done() + },deplayTime) + }) + + it('STAT', 0, function (done) { + setTimeout(()=>{ + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + let result = client.STAT() + done() + },deplayTime) + }) + + it('NOOP', 0, function (done) { + setTimeout(()=>{ + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + let result = client.NOOP() + done() + },deplayTime) + + }) + + it('UIDL', 0, function (done) { + setTimeout(()=>{ + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + let result = client.UIDL("1") + done() + },deplayTime) + }) + + it('RSET', 0, function (done) { + setTimeout(()=>{ + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + let result = client.RSET() + done() + },deplayTime) + + }) + + it('RETR', 0, function (done) { + setTimeout(()=>{ + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + let result = client.RETR("1") + done() + },deplayTime) + + }) + + it('DELE', 0, function (done) { + setTimeout(()=>{ + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + let result = client.DELE("1") + done() + },deplayTime) + }) + + it('QUIT', 0, function (done) { + setTimeout(()=>{ + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + let result = client.QUIT() + done() + },deplayTime) + + }) + + it('connect', 0, function (done) { + setTimeout(()=>{ + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + let result = client.connect() + done() + },deplayTime) + + }) + + it('TOP', 0, function (done) { + setTimeout(()=>{ + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + let result = client.TOP("1") + done() + },deplayTime) + }) + + it('command', 0, function (done) { + setTimeout(()=>{ + let option = { + host: 'pop.qq.com', + port: 110, + user: account + mailType, + password: password, + timeout: 30000, + servername: 'pop.qq.com', + tls: false, + tlsOptions: undefined + } + client = new Pop3Command(option); + let result = client.command("NOOP") + console.log("command count:"+i) + done() + },deplayTime) + + }) + } + }) +} \ No newline at end of file diff --git a/SMTPClient/entry/src/ohosTest/ets/test/List.test.ets b/SMTPClient/entry/src/ohosTest/ets/test/List.test.ets index 1c22bdf942b0151d93a9d4e2d2ac41d22ca9b22c..c54269a6d2d4597127e29a959fb4f53a8a3da0ea 100644 --- a/SMTPClient/entry/src/ohosTest/ets/test/List.test.ets +++ b/SMTPClient/entry/src/ohosTest/ets/test/List.test.ets @@ -17,7 +17,8 @@ // import connectionTest from './Connection.test' // import dateTest from './Date.test' // import mimeTest from './Mime.test' -import SMTPPressTest from './SMTPPress.test' +// import SMTPPressTest from './SMTPPress.test' +import SMTPPressTest from './SMTPPressDeplayTime.test' export default function testsuite() { // addressTest() diff --git a/SMTPClient/entry/src/ohosTest/ets/test/SMTPPress.test.ets b/SMTPClient/entry/src/ohosTest/ets/test/SMTPPress.test.ets index 1b76921893f39abcdba62736a6bd63312b542599..e314086e28759922197bb896ac3431869f82b233 100644 --- a/SMTPClient/entry/src/ohosTest/ets/test/SMTPPress.test.ets +++ b/SMTPClient/entry/src/ohosTest/ets/test/SMTPPress.test.ets @@ -16,11 +16,12 @@ export default function SMTPPressTest() { let bcc: string = '2' let subject: string = 'test' let content: string = 'test' - const BASE_COUNT = 1000 - let count = 1; - let id = undefined; + //总的次数 + const BASE_COUNT = 10000 + describe('SMTPPressTest', function () { - function allApiInterface() { + + for(let i=1;i<=BASE_COUNT;i++){ it('new_SMTPClient', 0, function () { let client = new SMTPClient({ user: '479868299@qq.com', @@ -32,9 +33,10 @@ export default function SMTPPressTest() { ssl: false, tls: undefined }); + console.log("new_SMTPClient count:"+i) }) - it('sendAsync', 0, function (done) { + it('sendAsync', 0, function () { let client = new SMTPClient({ user: '479868299@qq.com', password: 'bfxeualuaxambged', @@ -56,23 +58,8 @@ export default function SMTPPressTest() { attachment: null } client.sendAsync(msg) - 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() - } + console.log("sendAsync count:"+i) }) } - allApiInterface() }) } \ No newline at end of file diff --git a/SMTPClient/entry/src/ohosTest/ets/test/SMTPPressDeplayTime.test.ets b/SMTPClient/entry/src/ohosTest/ets/test/SMTPPressDeplayTime.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3660569aa3e53ab6a15597654fc54bc10525eaa1 --- /dev/null +++ b/SMTPClient/entry/src/ohosTest/ets/test/SMTPPressDeplayTime.test.ets @@ -0,0 +1,72 @@ +import hilog from '@ohos.hilog'; +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from '@ohos/hypium' +import { AUTH_METHODS, Message, MessageAttachment, MessageHeaders, SMTPClient } from '@ohos/emailjs' +import promptAction from '@ohos.promptAction' +import router from '@ohos.router' +import socket from '@ohos.net.socket' +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import fs from '@ohos.file.fs'; + +export default function SMTPPressTest() { + + let from: string = '479868299@qq.com' + let accountName: string = '479868299' + let to: string = '12345689@qq.com' + let cc: string = '1' + let bcc: string = '2' + let subject: string = 'test' + let content: string = 'test' + //总的次数 + const BASE_COUNT = 10000 + //每个用例延迟时间执行毫秒单位 + const deplayTime=500 + describe('SMTPPressTest', function () { + + for(let i=1;i<=BASE_COUNT;i++){ + it('new_SMTPClient', 0, function (done) { + setTimeout(()=>{ + let client = new SMTPClient({ + user: '479868299@qq.com', + password: 'bfxeualuaxambged', + host: 'smtp.qq.com', + port: 25, + timeout: 30000, + authentication: [AUTH_METHODS.LOGIN], + ssl: false, + tls: undefined + }); + console.log("new_SMTPClient count:"+i) + done() + },deplayTime) + }) + + it('sendAsync', 0, function (done) { + setTimeout(()=>{ + let client = new SMTPClient({ + user: '479868299@qq.com', + password: 'bfxeualuaxambged', + host: 'smtp.qq.com', + port: 25, + timeout: 30000, + authentication: [AUTH_METHODS.LOGIN], + ssl: false, + tls: undefined + }); + + let msg: Message | MessageHeaders = { + text: content, + from: `${accountName} <${from}>`, + to: to, + cc: cc, + bcc: cc, + subject: subject, + attachment: null + } + client.sendAsync(msg) + console.log("sendAsync count:"+i) + done() + },deplayTime) + }) + } + }) +} \ No newline at end of file