[browser] tests failing on localhost?

KingMoore - July 15, 2008 - 03:23
Project:SimpleTest
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

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

boombatower - July 15, 2008 - 19:41
Status:active» active (needs more info)

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

KingMoore - July 16, 2008 - 00:17

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

boombatower - July 16, 2008 - 00:49

You have the SimpleTest library downloaded?

#4

KingMoore - July 16, 2008 - 00:55

Yeah I do. My unit tests using assert functions calling my module functions directly w/no drupal specific functions all work.

#5

Wim Leers - July 23, 2008 - 11:35
Version:5.x-1.1» 6.x-1.1
Category:support request» bug report
Priority:normal» critical
Status:active (needs more info)» active

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

KingMoore - July 23, 2008 - 12:25

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

Wim Leers - July 23, 2008 - 12:47

I'm somewhat glad that it's not just MAMP.

Simpletest maintainers, I'm at your service. Let's fix this.

#8

boombatower - July 24, 2008 - 03:18
Status:active» active (needs more info)

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

KingMoore - July 24, 2008 - 03:45

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

boombatower - July 24, 2008 - 04:29

Appears to work for me running 5.x HEAD.

#11

KingMoore - July 24, 2008 - 04:54

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:

[role] created name: simpletest_SUoc, id: 173 at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 350] OK
[role] created permissions: edit own page content, create page content at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 354] OK
[user] name: simpletest_fxNK pass: Xyfx29KZ3R created at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 384] OK
[browser] GET path "user" at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 189] FAIL
[browser] Setting name="simpletest_fxNK" at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 193] FAIL
[browser] Setting pass="Xyfx29KZ3R" at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 193] FAIL
[browser] POST by click on Log in at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 197] FAIL
[login] found name: simpletest_fxNK at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 415] FAIL

[login] not blocked at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 416] OK
[login] not reserved at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 417] OK
[browser] GET path "node/add/page" at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 189] FAIL
[browser] Setting title="!SimpleTest test node! simpletest_dqTxe0Eqyd" at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 193] FAIL
[browser] Setting body="!SimpleTest test body! simpletest_VS6CN5rmvwoBXPMLkdIaJg7yVYNaGnjM simpletest_GtRtzrQ1slK5CI2d9gBRZmkQldBonAFc" at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 193] FAIL
[browser] POST by click on Submit at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 197] FAIL
Page created at [C:\wamp\www\lonely\sites\all\modules\simpletest\tests\page_creation.test line 31] FAIL
Node found in database. [Boolean: false] should not be null at
[C:\wamp\www\lonely\sites\all\modules\simpletest\tests\page_creation.test line 34] OK
status: simpletest_fxNK has been deleted. at [C:\wamp\www\lonely\sites\all\modules\simpletest\drupal_test_case.php line 475]

#12

boombatower - July 24, 2008 - 16:47

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

KingMoore - July 24, 2008 - 23:38

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

boombatower - July 25, 2008 - 00:09

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

boombatower - July 25, 2008 - 00:10

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

KingMoore - July 25, 2008 - 00:15

Ah yes that would make sense as the original issue was this not working on WAMP/MAMP, but working fine on LAMP :D

#17

dmitrig01 - July 25, 2008 - 09:20

I have cURL working, and SimpleTest 7.x works for me. However, I get the same problem as Wim in 6.x.

#18

Wim Leers - July 25, 2008 - 13:57

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

KingMoore - August 4, 2008 - 00:28

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

KingMoore - August 4, 2008 - 01:25

Another note, I'm on Vista.

#21

Wim Leers - August 4, 2008 - 08:16

KingMoore: see #18. And the OS shouldn't matter at all, as I had the same problem on Mac OS X Leopard :)

#22

KingMoore - August 4, 2008 - 23:54

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

Wim Leers - August 5, 2008 - 00:04

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

boombatower - August 5, 2008 - 00:04

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

KingMoore - August 5, 2008 - 05:36

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

greggles - August 5, 2008 - 16:54
Version:6.x-1.1» 6.x-1.x-dev

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] FAIL

That 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

KingMoore - August 6, 2008 - 00:48
Title:drupalLoginUser failing on localhost?» [browser] tests failing on localhost?

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

boombatower - August 6, 2008 - 01:10

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

KingMoore - August 6, 2008 - 01:58

excellent.

#30

boombatower - August 21, 2008 - 18:42
Status:active (needs more info)» fixed

@KingMoore: You can try documenting it http://drupal.org/node/291740 or create a new page for troubleshooting and linking to it.

#31

Anonymous (not verified) - September 4, 2008 - 18:52
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#32

KingMoore - September 5, 2008 - 00:49

I have added to the documentation here:

http://drupal.org/node/304216

Hopefully this will save at least one person some time and frustration :)

 
 

Drupal is a registered trademark of Dries Buytaert.