I am currently doing research into which test framework I should be using for php. The two choices I have are PHPUnit and PHPSpec. I know that PHPUnit is TDD(Test driven development) and PHPSpec is BDD(Behavior driven development). However due to the lack of any real PHPSpec tutorial and limited documentation on the PHPSpec site I am unable to come to a full conclusion. My question to everyone is what are some addition similarities and differences between the two frameworks? Yes BDD and TDD are big ones but are there others? And they seem similar but no one talks about their similarities in great detail. Thank you.
Similarities and Differences Between PHPUnit and PHPSpec
Asked Answered
For Example, does PHPSpec support Mapping like PHPUnit does with @dataProvider? –
Anatomist
PHPSpec is a SpecBDD tool more dedicated to guide you in code design rather than a testing framework. It depends what you expect from tool and if you want to make a proper TDD/SpecBDD it's easier to use PHPSpec because it was created to help developers write readable and well designed code.
Remember that TDD/SpecBDD is not about testing all edge cases or doing whole-application-integration testing. It's about writing specifications for small units of code.
Few days ago I gave a talk on it, here you can find slides: http://www.slideshare.net/cakper/2013-0613-spug-spec-bdd-in-php I hope it will be useful to make a decision.
On your slides (slide 46), you have: $this->liveAndLet()->shouldReturn($die); Does that mean that phpspec uses reflection to overload method calls onto a proxied instance of the object instance your testing? Does this also mean that I cannot name any methods in my classes the same as the phpspec library methods? –
Marlyn
© 2022 - 2024 — McMap. All rights reserved.