[browser] tests failing on localhost?
| Project: | SimpleTest |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
I have some very simple test code that is working fine on a production server (LAMP), but when I try to test it on my localhost (WAMP) I am getting all kinds of errors.
For example, this code works fine on production:
$permissions = array(
'access content'
) ;
$this->import_user = $this->drupalCreateUserRolePerm($permissions) ;
$this->drupalLoginUser($this->import_user) ;However locally it generates heaps of errors:
[role] created name: simpletest_YQEC, id: 184 at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 351] OK
[role] created permissions: at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 355] OK
[user] name: simpletest_TaTW pass: TUZXbkGgsj created at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 385] OK
[browser] GET path "user" at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 190] FAIL
[browser] Setting name="simpletest_TaTW" at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 194] FAIL
[browser] Setting pass="TUZXbkGgsj" at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 194] FAIL
[browser] POST by click on Log in at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 198] FAIL
[login] found name: simpletest_TaTW at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 416] FAIL
[login] not blocked at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 417] OK
[login] not reserved at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 418] OK
status: simpletest_TaTW has been deleted. at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 476]
Any idea what could be causing the problems on my local setup? Thanks.

#1
I don't do allot of work in the 5.x branch anymore, but I don't believe it uses cURL like 6.x and 7.x do.
From the error message it gets it looks like the internal browser is having issues. Try the following code and see what you get.
Note: may not be exact syntax.
<?php$this->drupalGet('user');
var_dump($this->drupalGetContent());
?>
#2
boombatower,
thanks for your help. I was hoping turning on cURL (it was off) on my localhost would fix the problem but it did not.
Executing the code above returns FALSE boolean. So I guess drupalGetContent is not working, which I kindof figured before. Any idea what could be causing the problem? I have looked for simpletest requirements but haven't found any as of yet in documentation. If they are there, could someone point me to them? Any other PHP extensions that I should have enabled?
#3
You have the SimpleTest library downloaded?
#4
Yeah I do. My unit tests using assert functions calling my module functions directly w/no drupal specific functions all work.
#5
Confirmed in the 1.1 final for D6.
Happens on my localhost MAMP install. It's not the browser either, because this happens both in Safari and Firefox. Looks like a critical bug?
dmitrig01 told me on IRC he had the same problem, and he was also using MAMP (he failed to find the cause btw). At the very least, if this is a MAMP-specific problem, we should figure out a way around this and document it: many people use MAMP!
#6
oh wow good to see (in a weird way) that others are having this same problem. I figured it was some dumb configuration setting on my part.
Note though that I am on WAMP, so it can't be a MAMP specific problem. I can provide more details if they will help.
#7
I'm somewhat glad that it's not just MAMP.
Simpletest maintainers, I'm at your service. Let's fix this.
#8
Hmm I can run block.test which uses 7.x style code and book_module.test which also passes.
I'm running of 6.x HEAD, try that...if it works then I will make a release.
#9
I have having these issues in 5.x-1.1. If this is indeed fixed in 6 HEAD, any chance of backporting whatever the fix was?
#10
Appears to work for me running 5.x HEAD.
#11
Alright I just downloaded and installed 5 HEAD (which seems to be the same code as 5.x-1.1?). Ran the Page Node Creation test, and I get this:
#12
Hmm.... I ran that one last night and I don't get any errors, just several exceptions which weren't fixed until 7.x branch of test. Not sure what to tell you.
I would try and find someone who wants to debug it and who encounters the problem as I can't really tell.
#13
Boombatower, are you testing in WAMP? Or what is your setup?
Is there a list of PHP/apache/sql/system requirements for the simpletest module specifically? Could there perhaps be some extension that I need enabled or something? I have been having no other problems with my localhost sandbox in regaurds to drupal acting exactly as it does in our live (LAMP) environment. I could post my PHP.ini file or something if that would help.
Wim Leers mentions that he is having similar issues, as are multiple other people he has spoken with.
#14
I'm running LAMP on my all-purpose desktop. I don't have any problems.
If you are using 5.x branch then there shouldn't be any requirements. 6.x using DrupalWebTestCase requires cURL.
I'm not sure how to go about figure this out as I have no idea what would cause this.
#15
Someone who has the issue and skills/time to debug it would be much appreciated. When the cause is found I can help fix the issue.
#16
Ah yes that would make sense as the original issue was this not working on WAMP/MAMP, but working fine on LAMP :D
#17
I have cURL working, and SimpleTest 7.x works for me. However, I get the same problem as Wim in 6.x.
#18
I narrowed it down further!
It only happens when you use
DrupalTestCase, it doesn't happen when you upgrade to 7.x style tests, i.e.DrupalWebTestCase!#19
I have just confirmed that a guy at our office is uxing XAMP on a windows box and is able to successfully run [browser] based simpletests with the same drupal installation as I.
I am using WAMPServer and am not able to run simpletests, so this would lead me to believe it is some configuration issue. I have looked at both PHP.ini files and have been unable to determine the offending configuration in my install.
Would posting the PHP.ini files (working and non-working), or apache config files be of any help to anyone?
#20
Another note, I'm on Vista.
#21
KingMoore: see #18. And the OS shouldn't matter at all, as I had the same problem on Mac OS X Leopard :)
#22
Wim Leers: I saw post #18. Unfortunately for me I am in a group environment and the group is using DrupalTestCase. No one else is having problems w/the exact same code. Most on linux, couple on XP. If it isn't the OS, it seems like we should be able to figure out what it is... but I can't narrow it down.
#23
Well, you're right that it's a very obscure bug. I'm sure it's somewhere in the Simpletest module (either the Drupal code or the Simpletest lib itself). But DrupalWebTestCase is for D7 style tests and therefor it is the future. So I don't mind making the necessary changes all that much :)
Anyway, good luck with tracking this down!
#24
Have you diffed configuration files?
Take a look at the apache access & error logs and see if they have anything related to simpletest browser.
#25
Got it!
Figured it out w/help of Komodo and XDebug. It is a vista issue, in particular, the call to fsockopen() in simpletest's socket.php
/*** Actually opens the low level socket.
* @param string $host Host to connect to.
* @param integer $port Port on host.
* @param integer $error_number Recipient of error code.
* @param string $error Recipoent of error message.
* @param integer $timeout Maximum time to wait for connection.
* @access protected
*/
function _openSocket($host, $port, &$error_number, &$error, $timeout) {
return @fsockopen($host, $port, $error_number, $error, $timeout);
}
fsockopen FAILS in Vista because of the configuration of c:\windows\system32\drivers\etc\hosts, see here: http://bugs.php.net/bug.php?id=44335&edit=1
Once I removed the line from the above file:
::1 localhost
my simpletests now work. AWESOME! I guess this doesn't require a patch on simpletests part, but would be a helpful TIP somewhere in the documentation.
#26
I get this in the latest 6.x-1.x-dev of simpletest on Ubuntu (hardy heron AKA 804).
[login] found name: simpletest_mk5e at [/var/www/m/drupal6/sites/all/modules/simpletest/drupal_test_case.php line 432] FAILThat is with the simpletest library simpletest_1.0.1.tar.gz
So, it appears not to be OS specific necessarily. I tried adding
var_dump($this->drupalGetContent());right after line 432 and got a "method not found" error.Is there anything else I can do to help?
#27
Should I create a new issue for my problem specifically (the Vista issue) so that other troubled testers will find it when searching? Or should I document somewhere else? Am glad to do either.
#28
Documentation....I'm working on a getting started doc that will contain stuff like that. So I'll let you know when I get something setup.
#29
excellent.
#30
@KingMoore: You can try documenting it http://drupal.org/node/291740 or create a new page for troubleshooting and linking to it.
#31
Automatically closed -- issue fixed for two weeks with no activity.
#32
I have added to the documentation here:
http://drupal.org/node/304216
Hopefully this will save at least one person some time and frustration :)