I’m fairly new to test based development. I get confused as to what I should be unit tested.
For example should I be testing the tableName method in a CActiveRecord class? relations, rules?
Also should I bother unit testing controllers or should I just use functional testing for that?
Any guidance appreciated.
The lack of responses leads me to think not many people are writing tests. Anyhow, I decided to test everything.
It doesn’t take long to copy and adapt the tests for tableName, relations and rules for each new class.
My controller tests are fairly basic. Essentially looking for a piece of text on the rendered page. I’ll supplement them with functional tests later.
It is very satisfying to run the tests and have everything come up green. I’m going to try and develop the next part of the project by writing the tests first. Looking forward to it.
good. I am trying to implement TDD too.
No, there is no need to test most of the framework code since it’s already covered well. Of course, if you want to help us writing tests for framework itself it will be much appreciated. You can review tests here: http://code.google.com/p/yii/source/browse/#svn/trunk/tests
Controllers testing is mostly functional testing task.
Thanks for the link SystemicPlural and samdark, looks like quite some test have been made on Yii.
I still have to get familiar with the testing process in Yii
but as you pointed out there isn’t much out there,
I was wondering if anyone had best practises for using unit testing
on a website, with Yii ?
what exactly should be tested ?
there could be a wiki made for this , giving pointers on what to think about when going into TDDs
I guess any process involved in generating the content for a URL must be tested ?
@SystemicPlural : would you mind sharing how you managed to finally organize yourself ?