Page 2 of 2
Posted: Tue Sep 25, 2007 4:20 am
by Maugrim_The_Reaper
I have to say the disagreement is surprising. The point is these rationales are not new - XP has had them since time began. Maybe this is a problem here? Am I speaking too much XP?
Posted: Tue Sep 25, 2007 10:45 am
by sike
after reading about rspec a year ago or so it influenced my testing style a lot.
i started to drift away from the old "one test per method" style to a more behavior describing one.
e.g.
Code: Select all
/**
* Container_Array_List
*/
class TestOfContainer_Array_List extends Container_Collection_Test
{
public function testSwap()
{
}
public function testInsert()
{
}
public function testContainsIndex()
{
}
public function testRemoveIndex()
{
}
public function testSet()
{
}
public function testGet()
{
}
public function testIndexOf()
{
}
}
vs
Code: Select all
<?php
/**
* Validation_Set
*/
class TestOfValidation_Filter_Integer extends DefaultUnitTestCase
{
public function testNullIsValid()
{
}
public function testEmptyStringIsValid()
{
}
public function testNumericStringIsValid()
{
}
public function testAlphanumericStringIsInvalid()
{
}
public function testMixedStringIsValid()
{
}
public function testIntegerIsValid()
{
}
public function testFloatIsValid()
{
}
}
?>
i found it improved the quality of my tests a lot because of the readability of the testcase (bar the fact that this is not really bdd). another improvement i noticed was that the testing methods became shorter.
so yes : i would like to see some bdd love for php testing. i am unsure though if it has to be a new framework or if a shift in paradigms would suffice.
Chris
btw:
http://en.wikipedia.org/wiki/Behavior_d ... evelopment uses JUnit for explanation (:
Posted: Tue Sep 25, 2007 11:35 am
by Maugrim_The_Reaper
The Wikipedia article is flawed - it uses the "test" word

.
Anyway... It's cool that two people here have come across BDD previously.
As I noted to arborint, the reason for a new framework is to accelerate getting something available. It still needs a lot of code outside what a testing framework usually offers, for example implementing an RSpec style DSL that's readable, maybe some future look at how TestNG style grouping/sharing meshes with BDD, etc. Once we have working code, it may then be possible to move towards a current framework. We'd have to wait and see.
Both of us on the project ruled out PHPUnit inside of a two line email exchange (the Zend Framework is basically THE only reason I learned PHPUnit a few months ago - it has traditionally lacked any usefulness for TDD).
So SimpleTest will take away any benefit if it comes down to it. At the moment though SimpleTest is still PHP4 oriented - we're all waiting for a move to PHP5 when it's migrated to subversion on Sourceforge.
Posted: Tue Sep 25, 2007 6:14 pm
by Maugrim_The_Reaper
Oh, and I can confirm the framework is now real.

I posted a few opening lines of code into subversion a few short minutes ago.
I'll post more details about it soon - for the moment it's largely underground until naming/domain reg happens (don't want some chancer to start grabbing all the tlds on us!).
You can of course PM me for more details - just don't want to post too much to a public forum for another day or two. If anyone is interested in following the project, we'll have mailing lists available soon.
We're aiming at an RSpec like port with a PHP twist. Travis would like an independent DSL for use in phpt like tests. Crazy stuff - but perhaps it will make phpt fans happier without throwing everything at a full UT framework. Maximum benefits of course only with a full framework. We're using phpt to drive development simply because it's there and it has no E_STRICT limitation. BDD with phpt - this one should be interesting...
Posted: Tue Sep 25, 2007 7:03 pm
by lastcraft
Hi...
Maugrim_The_Reaper wrote:Oh, and I can confirm the framework is now real.

I posted a few opening lines of code into subversion a few short minutes ago.
Damn. I arrived at this discussion too late to have an influence. What would you have to change to SimpleTest to make it BDD? I have only a passing knowledge of RSpec, and almost none of JBehave. A code snippet or two?
Regarding starting another project - probably a good idea given the glacial development cycle of SimpleTest at the moment. Time is allocated to the project though, and you can be sure that I will steal all of your ideas

.
yours, Marcus
Posted: Tue Sep 25, 2007 10:24 pm
by Christopher
Great to hear from you Marcus, I think Pádraic has given some examples in this thread and in his blog post that he linked to in the first post. BDD is a different approach to the many (and more) of the goals of TDD. I was the one who suggested that Pádraic might want to talk to you to see if something could be build on top of the SimpleTest core that allow using the BDD approach. You would know best if/how SimpleTest could be taken in the Ubiquitous Language direction to switch the focus from tests and units to behaviors and specifications?
Posted: Wed Sep 26, 2007 4:22 am
by Maugrim_The_Reaper
Hi Marcus,
I was going to take the opportunity to email you later on BDD but also in regards to an email from Paul Morgan

. Will do later.
In brief, I have always believed SimpleTest is the only really productive TDD framework in PHP - and it's the only option we'd consider if porting the framework into something already established. There are a few reasons why pursuing development separately at the moment is attractive:
- It's a fresh approach and we don't want to get stuck with an established frameworks conventions (no offence!)
- Development would likely be faster
- It's an experiment - BDD frameworks change very quickly as the topic evolves. Some of the latest API is barely 6 months out the door.
- No such thing as one catch-all BDD framework (rspec is code driven, rbehave is a more XP story driven acceptance testing tool using the rspec DSL).
- It's been tried already in Java - didn't work very well since BDD is not simply changing method names. Consider rspec's ability to share behaviours across varying contexts so the Parent A and Class B are "shared" with fewer duplicate specs. One of a few changes in managing behaviour rather than tests. I think Java is probably a bad example though - JUnit is not all that dynamic in adopting new developments.
- TestNG? Still looking into how BDD and TestNG mesh or not.
This isn't ruling anything out - just explaining why it's difficult or unattractive right now.
Regarding starting another project - probably a good idea given the glacial development cycle of SimpleTest at the moment. Time is allocated to the project though, and you can be sure that I will steal all of your ideas.
Just grab me or Travis beforehand - if what we cobble together holds up porting it to SimpleTest would be seriously considered depending on how easy a port would be. Would give PHPUnit a new set of worries besides Mock Objects at least

.
Posted: Wed Sep 26, 2007 8:00 pm
by Maugrim_The_Reaper
Hi guys,
The project is now hosted from Google Code. You can follow the redirect trail from
http://www.phpspec.org . We have a developers mailing list linked to from the Google Code page for anyone interested in lurking

.
Posted: Tue Jan 01, 2008 2:04 pm
by staar2
hm BDD sounds good i just started learning theory about that and found your PHPSpec framework what i am going to test.