BDD Testing frameworks - RSpec and Cucumber
I was looking into RSpec and cucumber and was wondering what this adds to unittesting?
On the one hand you may say that having "s开发者_开发技巧tories" or more readable tests is a plus, but doesn't all this aliasing of functions names go against using unittests as examples of code usage?
Functional tests like you would do with Cucumber are very different from unit tests. A unit test should test a unit of work at a method/class level. They ideally should not test the interaction between an entire system. They need to be fast and isolated (see http://agileinaflash.blogspot.com/2009/02/first.html)
Thats where Cucumber comes in. It provides a front where customers can help define what they want the app to do, then you write the tests that implement it. This means that the cucumber layer most likely sits right at the same level as the UI (and thus prevents you from placing logic in your UI as a bonus)
In the future, when your customer wants to change functionality, you can open the test, change it's expectations (WITH the customer) and then code the changes. Hook the whole thing up to CI and your good to go.
精彩评论