General Questions on Testing

Hi,

I have a general question concerning testing. I have implemented a registration process for my website. Now I want to test the actionRegistration() method of my RegistrationController.

After quite a lot of reading this should be accomplished by functional tests using Selenium. Is that right?

Unit tests on the other hand we use for models and other functions. Right?

In the beginning I thought it would be a better approach to use unit tests for like everything (including controller testing) because Selenium tests take longer and are more ressource taking.

And then I have another question: If I use Selenium for testing my registration process, what is the best way to handle email activation. Should I somehow block email sending while testing or should I use Selenium to receive the email by logging in into a gmail account for example and then use the activation link?

Thank in advance,

as you can see I have some problems on starting my testing processes!

Best regards, Lukas

use a mailer as application component, then in your config (main, test) you can define different mailer

the test mailer does not connect to gmail or whatever service you may use

thx for the answer. ok I have a mailer for my main config. So what you say is, that I should define a different one for my test config, which does not "work", so that no emails will be sent? Is that what you are saying?

assume that your mailer works correct in your test enviroment, so always return true in your sendMail-method instead of really sending a mail

ok got it. I use the yii-mail extension and I now use the dry mode in my testing environment :) thx!