Similarities and Differences Between PHPUnit and PHPSpec
Asked Answered
A

1

13

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.

Anatomist answered 19/6, 2013 at 15:26 Comment(1)
For Example, does PHPSpec support Mapping like PHPUnit does with @dataProvider?Anatomist
P
11

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.

Pluri answered 20/6, 2013 at 16:11 Comment(1)
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.