Can someone explain me how to use BDD to build MVC pattern based application ?
I saw enough examples, but of then so stupid (like calculator).
For example, I would like to build (in my case PHP) application which will interact with client (browser javascript) by JSON. How i should write my tests ? And what for i should write it ? for models ? controllers ? views ?
in TDD it's clear I have to test particular method of certain class (it can be model, controller or view). But with BDD I have to think from little bit upper level, and should test features, right ?
and one more question: in all examples what i have saw, scenarios only is a positive. what about bad scenarios ? as I understand it's totally depends from me ? i can write as many as i want, right ? and, than more i will have then more safely my app will be, right ?
thanks.
P.S. And with PHP i will use Behat.
Write tests who make sense.
For example, in a MVC application the business logic is in the Model, so you can test the Model in your unit tests. You can also test the controller using the real Model and mock/stub when you need. And you can write tests who uses the View. You can test everything, in many combinations.
Try to start with tests in the Model layer and measure the coverage of the tests. Try to be very pragmatic :)