SitePoint Sponsor |
|
User Tag List
Results 26 to 50 of 59
Thread: SimpleTest vs PHPUnit?
-
Jun 12, 2005, 19:05 #26
- Join Date
- Jun 2001
- Location
- In your basement
- Posts
- 1,268
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Im testing 1 product... and cleaning up a few things before it can go live... and another product is about 70% done.
I do have a 3rd project just starting, so I think from reading a post above I shold write tests before the code.... What i've always done is just document before hand, something like
PHP Code:class document {
/**
* Add a document to the database, blah blah
*
* @param array $data Data to be added to the database
* @return bool
*/
function addDocument( $data ) { }
}
Eric Coleman
We're consentratin' on fallin' apart
We were contenders, now throwin' the fight
I just wanna believe, I just wanna believe in us
-
Jun 12, 2005, 19:08 #27
- Join Date
- Nov 2001
- Location
- Bath, UK
- Posts
- 2,498
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I wouldn't bother with the comment. What does /* Add a document */ tell you that function addDocument() doesn't?
What do you want the code to do?
Once you know that, you write a test to make sure it does that
DouglasHello World
-
Jun 12, 2005, 19:11 #28
- Join Date
- Jun 2001
- Location
- In your basement
- Posts
- 1,268
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It's so I can generate API documentation once im totaly done with the project.. and since I work in a team of 3 or 4, I need to make documents available to them.
It's much easier to look at API documentation than have to look at 400 different functions or classes or whateverEric Coleman
We're consentratin' on fallin' apart
We were contenders, now throwin' the fight
I just wanna believe, I just wanna believe in us
-
Jun 12, 2005, 23:12 #29
- Join Date
- Sep 2004
- Location
- Zagreb, Croatia
- Posts
- 830
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Eric.Coleman
PHP Code:/**
* @param $documentPath String.
**/
-
Jun 16, 2005, 17:20 #30
- Join Date
- Jun 2001
- Location
- In your basement
- Posts
- 1,268
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ok, i've got all this down...
Is it to late to start even after the project is public? The stuff has been out a while, and I want to write tests now... that good, or is it easier to start with tests first?Eric Coleman
We're consentratin' on fallin' apart
We were contenders, now throwin' the fight
I just wanna believe, I just wanna believe in us
-
Jun 16, 2005, 17:52 #31
- Join Date
- Nov 2001
- Location
- Bath, UK
- Posts
- 2,498
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If you want to write tests my man, write tests
It just isn't as much fun writing tests for code you know works. How about writing tests for new code you write? Or, the next time you find an unexpected bug, try and test it to pieces rather than using echos or log files etc. That might be a better start than just saying "I've got some code that works, I'll write some tests to make sure it works", it is always more fun to know what it is you are trying to achieve when you do something
DouglasHello World
-
Jun 16, 2005, 17:56 #32
- Join Date
- May 2005
- Posts
- 76
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I'm just starting to get into patterns and test driven development, are tests basically just cut down versions of the final classes, i.e. the absolute core functionality of the class?
-
Jun 17, 2005, 05:06 #33
- Join Date
- Jan 2004
- Location
- Oslo, Norway
- Posts
- 894
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
At the risk of seeming egotistical, here is the comment I just posted to the SimpleTest mailing list:
As far as I'm concerned I gave up on PHPUnit because of a lack of documentation and lack of compatibility between versions. I used the pre-1.0 versions of PHPUnit and did fine with them. But I was unable to get version 1 to work. When Advanced PHP Programming appeared I tried copying the examples from the book, but it still didn't work. I simply couldn't figure out how to run the tests.
What I generally do when I can't get open source software to work is to try an alternative. My experience is that trying to fix problems with poorly documented software is frequently more time-consuming than learning something else.
I now use SimpleTest exclusively and don't know any good reasons why I would switch back.Dagfinn Reiersøl
PHP in Action / Blog / Twitter
"Making the impossible possible, the possible easy,
and the easy elegant" -- Moshe Feldenkrais
-
Jun 17, 2005, 14:06 #34
- Join Date
- Nov 2003
- Location
- Los Angeles, CA
- Posts
- 460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I have officially moved to simpleTest and havne't looked back
My-Bic - Easiest AJAX/PHP Framework Around
Now Debug PHP scripts with Firebug!
-
Jun 17, 2005, 14:17 #35
- Join Date
- Jun 2001
- Location
- In your basement
- Posts
- 1,268
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
We need a simple test plugin for Eclipse..
Eric Coleman
We're consentratin' on fallin' apart
We were contenders, now throwin' the fight
I just wanna believe, I just wanna believe in us
-
Jul 1, 2005, 10:50 #36
- Join Date
- Dec 2004
- Location
- Cluj
- Posts
- 7
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Some concrete examples??
I do not hove but i'm sure that you can find some here.
-
Jul 1, 2005, 14:02 #37
- Join Date
- Apr 2003
- Location
- London
- Posts
- 2,423
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Hi.
Regarding Eclipse support, the Eclipse plug-in is currently being moved over to the SimpleTest web space. Watch this space...
yours, MarcusMarcus Baker
Testing: SimpleTest, Cgreen, Fakemail
Other: Phemto dependency injector
Books: PHP in Action, 97 things
-
Jul 1, 2005, 21:14 #38
- Join Date
- Nov 2003
- Location
- Los Angeles, CA
- Posts
- 460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Marcus, curious if there is anything that you haven't implemented in SimpleTest that you wanted to? Or is the project pretty much complete?
My-Bic - Easiest AJAX/PHP Framework Around
Now Debug PHP scripts with Firebug!
-
Jul 1, 2005, 22:30 #39
- Join Date
- Sep 2003
- Location
- Glasgow
- Posts
- 1,690
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by dalechristian
Tests should explore the behaviour of the class. For example;
PHP Code:class Greeter
{
function greet()
{
return 'hello world';
}
}
// would have a test method:
function testGreet()
{
$greeter =& new Hello;
$this->assertEqual($greeter->greet(), 'hello world');
}
Assertions act as constraints on possible implementations of the class. Assert everything you have to, but no more than you have to since that can impede future refactorings.
-
Jul 2, 2005, 14:54 #40
- Join Date
- Apr 2003
- Location
- London
- Posts
- 2,423
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Hi...
Originally Posted by jplush76
As for what I want to add two years after starting the project, mainly stronger HTML parsing so that I can do something like this if needed...
PHP Code:class TestOfPhp5Stability extends WebTestCase {
function testCanIUpgradeNow() {
$this->get('http://bugs.php.net/bugstats.php?phpver=5');
$this->assertTableCell('Open', 'All',
new LessThanExpectation(100));
}
}
What would you say I am missing?
yours, MarcusMarcus Baker
Testing: SimpleTest, Cgreen, Fakemail
Other: Phemto dependency injector
Books: PHP in Action, 97 things
-
Jul 3, 2005, 15:36 #41
- Join Date
- Nov 2003
- Location
- Los Angeles, CA
- Posts
- 460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
if you could integrate js unit testing as well that would be a super bonus, I'm currently looking into using JSUnit, but running/maintaining 2 seperate packages will get annoying I'm sure.
My-Bic - Easiest AJAX/PHP Framework Around
Now Debug PHP scripts with Firebug!
-
Jul 4, 2005, 14:08 #42
- Join Date
- Apr 2003
- Location
- London
- Posts
- 2,423
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Hi.
I am very intersted in combining JSUnit and SimpleTest, probably by having JSUnit run the show. Harry Feucks is the man to ask about this, but he is rather tied up these days.
yours, MarcusMarcus Baker
Testing: SimpleTest, Cgreen, Fakemail
Other: Phemto dependency injector
Books: PHP in Action, 97 things
-
Jul 27, 2005, 12:52 #43
- Join Date
- Apr 2003
- Location
- London
- Posts
- 2,423
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Hi...
Originally Posted by Captain Proton
http://sourceforge.net/projects/simpletest/
yours, MarcusMarcus Baker
Testing: SimpleTest, Cgreen, Fakemail
Other: Phemto dependency injector
Books: PHP in Action, 97 things
-
Jul 27, 2005, 13:58 #44
- Join Date
- Oct 2001
- Posts
- 656
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I'll get to work the next couple of days. I noticed you had it in CVS for a couple of weeks now.
-
Aug 4, 2005, 10:42 #45
- Join Date
- Aug 2005
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
SimpleTest
Hi to all
I've installed your plugin SimpleTest for eclipse. I can see the "Result view" on my screen. But how should make it working ? Is it possible to have an exmple on how to use it ?
Btw, i'm quite new with Eclipse and phpEclipse.
regards,
f.
-
Aug 4, 2005, 11:45 #46
- Join Date
- Oct 2001
- Posts
- 656
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
there are some readme files in the plugins/...simpletest../ directory (don't know the exact name).
I've been meaning to post the following for a while, but I kept forgetting:
I gave the plugin a run and was able to run a test through it. The plugin is not very useful yet because it does not support group tests yet.
I believe the plugin itself can be tested pretty well automatically by making some PHP files that are known to produce failing tests and then test to see that the plugin detects the test failure and displays the error correctly. I'll see if I feel like writing some JUnit tests
-
Aug 4, 2005, 17:19 #47
- Join Date
- Apr 2003
- Location
- London
- Posts
- 2,423
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Hi...
Originally Posted by Captain Proton
yours, MarcusMarcus Baker
Testing: SimpleTest, Cgreen, Fakemail
Other: Phemto dependency injector
Books: PHP in Action, 97 things
-
Aug 4, 2005, 18:07 #48
- Join Date
- Jan 2005
- Location
- Belgium
- Posts
- 354
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well, i've tried it with eclipse3.1 and preview release of phpeclipse on php5. As documented, it didn't work.
But I have an all_test.php file like (and all test cases are in the same directory)..
PHP Code:require_once('../../../init.php');
require_once(FRAMEWORK_EXT . '/simpletest/unit_tester.php');
require_once(FRAMEWORK_EXT . '/simpletest/mock_objects.php');
require_once(FRAMEWORK_EXT . '/simpletest/reporter.php');
$test = &new GroupTest('All file tests');
foreach(glob('test_*.php') as $testfile)
{
$test->addTestFile($testfile);
}
if (TextReporter::inCli())
{
$test->run(new TextReporter());
}
else
{
$test->run(new HtmlReporter());
}
Code:All file tests OK Test cases run: 1/1, Passes: 50, Failures: 0, Exceptions: 0
-
Aug 5, 2005, 02:09 #49
I just installed the simpletest plug-in but it doesn't seem to work. Eclipse says that it isn't installed.
**Edit* Scratch that got it working now.*
Just to go off on a slight tangent. What is everyone's PHP Plug in of choice. I use the Trustudio one just now. I haven't really looked at PHPEclipse.
GeorgeGot Sig!
-
Aug 5, 2005, 07:54 #50
- Join Date
- May 2004
- Location
- Germany
- Posts
- 550
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by chiefmonkey
With 3.1 SDK i got it working, but then i installed TruStudio (never used PHPEclipse too) and TruStudio wouldn't work. The other way round it was the same.
But perhaps it's only me being stupid
I'd really like to run tests with 1-2 mouseclicks, but having the choice between being able to use TruStudio XOR Simpletest Plugin i'd go for Trustudio
Bookmarks