Re: [Semanticscuttle-devel] Status for configurable privacy ....
Brought to you by:
cweiske
From: Brett D. <bs...@fr...> - 2011-04-14 04:42:23
|
Hello, Christian. I'm having trouble with a few items in PostsAddTest.php. I tried to run this test in PHPUnit and kept getting 404 responses from the Web server. Then I noticed line 36: protected $urlPart = 'api/posts/add'; I thought maybe this should be 'api/posts_add' and changed it. That eliminated the 404s, and so I thought it might be a mistake, but I was also unable to get the tests to run without explicitly specifying $urlSuffix because it was not getting set in TestBaseApi.php. I assume that I'm missing a bunch of setup tasks because these tests should not be able to pass as I first attempted to run them in PHPUnit. Or maybe I should be running the tests all at once? Rgrds, Brett > On Wed, 6 Apr 2011 09:55:01 +0200, Christian Weiske > <cw...@cw...> wrote: >> Hello Brett, >> >> About your tests: >> - You assume that the default privacy is configured to the default one, >> but that's something you cannot assume. If you do such assumptions, >> at least do a assertion on your assumed variable so the test fails >> with an explanatory message. >> - You assume a default privacy setting since there was no way to >> configure the privacy permanently for http requests - up to now! In >> the jquery branch, I had the same problem and solved it; the >> testbaseapi class has a way to set default configuration values. >> - You had one big method in BookmarksTest that checked all the >> different api methods. In general, keeping test methods small is a >> really good idea since in case of a failure, you can narrow down the >> problematic code line much faster. The rule of thumb is to test one >> thing in a test (but I don't want only one assertion in one test >> method, that'd be overkill). >> - I began to split up the big test method and >> moved the api/posts_add test to their corresponding Api test >> class. By doing that I could utilize the TestBaseApi methods that >> prepare authorized HTTP requests automatically for you if you wish >> that. Do the same for the rest of the tests in there. >> - In tests, always use example.org as hostname, or example.com and >> example.net (of course, you can use foo.example.org, >> example.org/foobar and such). >> - You assume that new bookmarks always get ID 1 in your tests. That >> might not always be the case, especially with database systems other >> than mysql. Better than fetching bookmark ID 1 is to fetch all >> bookmarks of the user with the ID you just created which keeps you on >> the safe side. >> - Assuming http://localhost/ as URL fails for my setup since I have >> "http://bm.bogo/" as URL under which my dev instance of SC is >> available. TestBaseApi takes care of this. >> |