Need to test whether an email is getting sent to a specific email ID (Gmail) when a specific action is done from the application under test. Can we automate this using telerik test studio?
2 Answers
Yes, this you can validate using Telerik Test Studio but for this you need to add test case of 'Gmail login and checking Inbox'. I will say to use this test case of Mail check as a separate test case in Test Studio and then call it as a Child test case in your Master case, once the particular action is taken. So, your whole test suite will look like this:
Master Test case
- Step1: Login to application
- Step2: Perform action on which mail should be send
- Step3: Extract the subject (if your application uses some different subject for different actions), store this in a variable
- Step4: Validate the message shown in the application after performing action like 'Mail has been sent successfully'
Step5: Call Child test case of verifying mail sent or not
--- Child Test Case --- - Login to Gmail - Open Inbox (if not default) - Validate mail arrived or not, verify the extracted subject from step3 - If not, then add a wait and verify again after refreshing the Inbox
(this is just to ensure that if there is any delay in sending mail then you verify Inbox after that delay too, because sometimes mail sending services have a scheduler which runs after every configured amount of time, lets say after every 5 mins mail will be sent then you should validate the mail received functionality after a time of 5-6 mins.)
For making it more robust you can place Step2 of Mater test case in a 'IF' statement, i.e. if Action is taken then only you need to fire the Child test case else not.
-
Good answer but TLDR is make a web test that checks gmail. Call it as a Test as Step or as the next test in a test list. Commented Jul 30, 2015 at 14:48
Telerik test studio has a 30 day trail, maybe just try it? I would see no reasons why this could not work.
I would use something like MailTrap to catch emails send from the system under test and then use their API to check the email has arrived from a script/test. This sounds better then logging into gmail to check the email has arrived.
-
Intercepting a request before it is fulfilled will not ensure that you arent getting a deamon error or something. Commented Jul 30, 2015 at 14:50
-
Please explain? What deamon errors? The OP asked for "an email is getting sent to a specific email ID", with mailtrap you can verify the application under test sends an email successful the the correct email-address from the SUT infrastructure, including content, etc.... Do you really need to test more after the mail has left the building? Unless you want to know if the receiver places it in a Spam folder, but that was not the question :) Commented Jul 30, 2015 at 15:00
-
Sure, you could send it to the right ID but is that a valid email address? Does the email look right (html supported)? I find that using a web interface to check emails is simple and reliable. I do this in Telerik all the time. You could use the Fiddler proxy core in Telerik to intercept network traffic too (but theres a bit of overheard setting that up in code). Commented Jul 30, 2015 at 15:17
-
This is not the place to check email-address validity. I wonder how do you do parallel runs, do you have multiple email accounts setup? Or do you add an identifier to the subject just for the test run? I am not talking about network traffic, mailtrap is a real mailbox, except you get an API (docs.mailtrap.apiary.io) to access it, instead of a web-interface. Now you can test just from a unit-test framework and this makes any test much cleaner and easier to maintain. When using end-2-end testing tools for email-testing it sounds like you only have a hammer and everything looks like a nail. Commented Jul 30, 2015 at 15:40
-
I misunderstood what you meant by "catch" emails. But to answer your Q, I use time stamps. Telerik can do value extraction from elements to be saved and used in later tests. Also I can do UI validations in the same test (does the email load the proper images or html, etc). Commented Jul 31, 2015 at 0:14