imap - Testing advanced scenarios using JMeter Mail Reader sampler -
I have written a test plan in Jmator using the Mail Reader Sampler to check an IMAPS server. The test only allows me to read all the mail from a folder or read the x number from the folder. Alternatively, I can remove the mail from the server after I read it.
However, other tasks like:
- Read a special email identified by some mail identifier
- Copy mail to a folder
- Reading / unreading mails
- Clear mail from trash explicitly.
Is there any way in which these other scenarios can also be tested using some Aadian specimen or plugin?
If Jmator does not support this, please suggest any other demonstration test device which can be tested like this
Unfortunately JMF Mail Mail Reader Sampler does not allow advanced operation. Although JM + can be extended by scripting
you can apply all the necessary methods that provide Java Mail API and scripting samples:
See the examples below for deleting all messages from the "spam" folder using IMAP for Gmail:
import com Sun.mail.imap.IMAPSSLStore; Import javax.mail *; {Attribute Properties = Try Sahara; Properties.put ("mail.smtps.auth", "true"); Properties.put ("mail.imap.ssl.enable", "true"); Session copy = session Gate instence (property, zero); Imapsession.setDebug (wrong); Store imapstore = new IMAPSSLStore (fake, new URL name ("imaps", "imap.gmail.com", 993, "", "your.account@gmail.com", "password")); Imapstore.connect (); Folder Root Folder = imapstore.getDefaultFolder (); Folder [] imapfolders = rootfolder.list ("*"); For (folder folder: imapfolders) {if (folder.getName (.) Equals ("spam")) {folder.open (folder.READ_WRITE); Log.info ("in the spam folder" + folder.getMessageCount () + "message"); Message [] message = folder.getmessage (); For (message message: message) {message.setFlag (Flags.Flag.DELETED, true); Log.info ("Mark messages with subject:" + message.getSubject () + "to delete"); } Folder.expunge (); Folder.close (true); }} Imapstore.close (); } Hold (exception before) {log. Terror ("IMAP operation failed", formerly); }
No additional configuration is necessary for the BenShell template, you can only copy and paste the above code.
Although the bancis has to know the performance issues and boundaries well, so if your test accepts more or less high load then it is recommended to use JSR223 sample and Groovy language.
See the Scripting Engine Comparison Benchmark for more information and installation instructions for the Groove scripting engine.
Comments
Post a Comment