Trying to get SimpleTest working, and driving myself insane.
Firstly, SimpleTest will not activate as it says that it cannot locate the settings.php file, which is located in /sites/default/settings.php. I found that modifying lines 140 and 152 of simpletest.install to add "/sites/default/" enabled installation:
Line 140:
if (strpos(file_get_contents(file_directory_path() . '/../sites/default/settings.php'), trim($find)) !== FALSE) {
Line 152:
array('%settings' => realpath(file_directory_path() . '/../sites/default/settings.php'),<code>
Given the following, however, I realise there might be something very wrong with having done that—I was just trying to figure out how to fix the install originally...
So, having installed SimpleTest I tried to run its own tests... It reported first
<code>The directory sites/default/files/simpletest852693 has been created.
The directory sites/default/files/simpletest28608 has been created.
The tests have finished running.
but then said
warning: Invalid argument supplied for foreach() in /Users/Duncan/Wavelength/Design/Development/catalyst.ac.nz/catalyst.ac.nz/sites/all/modules/simpletest/simpletest.test on line 149.
It reported ten of these errors, eight referring to line 149 and two referring to line 129.
Then, in the tests themselves, it reported 27 passes, 19 fails, 0 exceptions:
Created role of name: simpletest_HV_a, id: 3 Role drupal_web_test_case.php 481 _drupalCreateRole
Created permissions: administer unit tests Role drupal_web_test_case.php 481 _drupalCreateRole
User created with name simpletest_Beij and pass uuyHu6R4PH User login simpletest.test 38 drupalCreateUser
GET to http://catalyst.ac.nz, response is 5364 bytes. Browser drupal_web_test_case.php 748 curlExec
GET to http://catalyst.ac.nz/user, response is 3855 bytes. Browser drupal_web_test_case.php 822 curlExec
Valid HTML found on "http://catalyst.ac.nz/user" Browser drupal_web_test_case.php 864 parse
POST to http://catalyst.ac.nz/user, response is 3855 bytes. Browser drupal_web_test_case.php 896 curlExec
Found name: simpletest_Beij Other simpletest.test 39 drupalLogin
No blocked message at login page User login simpletest.test 39 drupalLogin
No reserved message at login page User login simpletest.test 39 drupalLogin
GET to http://catalyst.ac.nz/node, response is 5364 bytes. Browser drupal_web_test_case.php 822 curlExec
Valid HTML found on "http://catalyst.ac.nz/node" Browser drupal_web_test_case.php 1070 parse
Site title matches. Other drupal_web_test_case.php 274 testInternalBrowser
GET to http://catalyst.ac.nz/install.php, response is 0 bytes. Browser drupal_web_test_case.php 822 curlExec
Cannot access install.php with a "simpletest" user-agent header. Browser drupal_web_test_case.php 274 testInternalBrowser
Created role of name: simpletest_yn8b, id: 3 Role drupal_web_test_case.php 481 _drupalCreateRole
Created permissions: administer unit tests Role drupal_web_test_case.php 481 _drupalCreateRole
User created with name simpletest_OPO4 and pass sd5CM3QWP8 User login simpletest.test 38 drupalCreateUser
GET to http://catalyst.ac.nz, response is 5364 bytes. Browser drupal_web_test_case.php 748 curlExec
GET to http://catalyst.ac.nz/user, response is 3855 bytes. Browser drupal_web_test_case.php 822 curlExec
Valid HTML found on "http://catalyst.ac.nz/user" Browser drupal_web_test_case.php 864 parse
POST to http://catalyst.ac.nz/user, response is 3855 bytes. Browser drupal_web_test_case.php 896 curlExec
Found name: simpletest_OPO4 Other simpletest.test 39 drupalLogin
No blocked message at login page User login simpletest.test 39 drupalLogin
No reserved message at login page User login simpletest.test 39 drupalLogin
GET to http://catalyst.ac.nz/admin/build/testing, response is 4031 bytes. Browser drupal_web_test_case.php 822 curlExec
Valid HTML found on "http://catalyst.ac.nz/admin/build/testing" Browser drupal_web_test_case.php 864 parse
Failed to set field SimpleTestTestCase to 1 Other simpletest.test 85 drupalPost
Found the Run tests button Other simpletest.test 85 drupalPost
Found the requested form fields at Other simpletest.test 85 drupalPost
Found assertion {"SimpleTest pass.", "Other", "Pass"}. Other simpletest.test 89 confirmStubTestResults
Found assertion {"SimpleTest fail.", "Other", "Fail"}. Other simpletest.test 89 confirmStubTestResults
Found assertion {"Created permissions: access content", "Role", "Pass"}. Other simpletest.test 89 confirmStubTestResults
Found assertion {"Invalid permission invalid permission.", "Role", "Fail"}. Other simpletest.test 89 confirmStubTestResults
Found test ID in results. Other simpletest.test 89 confirmStubTestResults
GET to http://catalyst.ac.nz/admin/build/testing, response is 4031 bytes. Browser drupal_web_test_case.php 822 curlExec
Valid HTML found on "http://catalyst.ac.nz/admin/build/testing" Browser drupal_web_test_case.php 864 parse
Failed to set field SimpleTestTestCase to 1 Other simpletest.test 85 drupalPost
Found the Run tests button Other simpletest.test 85 drupalPost
Found the requested form fields at Other simpletest.test 85 drupalPost
Found assertion {"SimpleTest pass.", "Other", "Pass"}. Other simpletest.test 89 confirmStubTestResults
Found assertion {"SimpleTest fail.", "Other", "Fail"}. Other simpletest.test 89 confirmStubTestResults
Found assertion {"Created permissions: access content", "Role", "Pass"}. Other simpletest.test 89 confirmStubTestResults
Found assertion {"Invalid permission invalid permission.", "Role", "Fail"}. Other simpletest.test 89 confirmStubTestResults
Found test ID in results. Other simpletest.test 89 confirmStubTestResults
Test ID is incrementing. Other drupal_web_test_case.php 274 testWebTestRunner
I guess I had hoped that SimpleTest would at least pass its own tests on first try! I've tried reinstalling SimpleTest (after proper uninstall), I've tried installing and running it with all non-core modules turned off... same result.
Probably I broke it at A and so am getting B. But I'd love some sane advice. :)
Comments
Comment #1
babbage commentedshould preview posts before posting to ensure tag integrity. No edit by the look of it.
Comment #2
moshe weitzman commentedThe block test fails as well. Just go in and fix them - it is the only way progress gets made.
Comment #3
babbage commented@moshe weitzman: I would *try*, if I was sure that the problem wasn't with my site or aspects of my install—are you telling me that a current correct install of SimpleTest will fail nearly half of its own tests, when working??
If that is the case, the SimpleTest project page needs a large disclaimer telling people this—because for someone new to testing, the capacity to know what is going on is pretty severely undermined if SimpleTest itself is being distributed as a stable release, yet is failing nearly half its own tests.
ETA: Presumably there is a more nuanced view; perhaps the tests pass on some installations but fail on other (still working) installations?
Comment #4
boombatower commentedThe tests are not intended to fail, as when I run the SimpleTest test or the block test both pass.
I guess it has something to do with installation, both test pass for me on HEAD and 2.3.
I running SUSE 11.0 (latest apache/PHP)
Comment #5
neclimdul@dbabbage I looked at your original issue but the pasted table doesn't include a key bit of information; what tests failed.
I had the test fail too and I'm going to assume it was the same problem and document what I've found.
The key to me looks to be this failure:
Its in DrupalWebTestCase->drupalLogin() so I've got a good feeling the user doesn't get logged in. It happens for 2 users so I'm pretty sure all the later failures in the admin area are because the user is not logged in and can't access the pages.
I'm running gentoo, latest apache, php, drupal, simpletest, mysql... fresh install with all mandatory install.txt instructions followed.
Comment #6
jwarner6 commentedI was getting a similar error with simpletest and was eventually able to make it go away by adding the hostname to /etc/hosts on the drupal server host. So my guess is that the simpletest module is running on the local server, but that it uses whatever address it finds in the browser to start running the tests from and if they don't match the tests fail because they aren't able to find the server and execute the test.
Not sure if that will help in anybody else out, but it was a relief to me when I discovered the problem. Now all I have to do is figure out how to write test cases using SimpleTest. :)
Comment #7
jzp commentedI have just installed SimpleTest on my D6. The install went fine. I changed settings.php and system_admin_inc as required. admin/build/modules saved fine. I have a menu on SiteBuild->Testing. However, when I click on it, I got a completely empty page. This problem may not be totally related the SimpleTest. I have this problem when I was in D5 before I migrated to D6. I was never able to get something showing here. I did try a straight install D5 not related to my site. The testing menu will bring up a page for me to manage the execution of test cases. I am a bit lot when to look for the problem. Somewhere I can check my setup that might affecting this behavior? All my other admin pages work well.
Comment #8
boombatower commented@jzp: not sure on that....check the apache error log and see if there are any entries related tot hat.
Comment #9
jzp commentedAh! you are right. There are some test cases in og (Organic Group) that missed Class DrupalTestCase. Thanks a lot.
Comment #10
davyvdb commentedIf you're using MAMP, this solved my problem... http://drupal.org/node/308186
Comment #11
alex_b commentedThe patch on comment #2 on #308186: cURL 7.18.2 and SimpleTest module bitterly despise one another helps for me, too.
curl 7.18.2 (i386-apple-darwin9.2.0) libcurl/7.18.2 zlib/1.2.3
Comment #12
boombatower commentedSo this looks like it is an issue with cURL libraries. Marking closed unless anyone needs to open it,
Comment #13
babbage commentedJust returned to note a solution to this (for me) at last. The tests being run were just SimpleTest's own tests—nothing else. I do not know if this was related to cURL libraries, but know that the same multiple failures were observed on my live install (Linux server) as on my local MAMP development server. They also occurred on a clean Drupal 6.6 install with nothing extra installed but SimpleTest.
These errors continue with the current official release SimpleTest 6.x-2.5 released 2008-Oct-22. However, I have discovered today that they are solved in 6.x-2.x-dev released 2008-Dec-03—all SimpleTest tests now pass. Fantastic—at last I can use SimpleTest. Don't know who fixed whatever was causing this, but well done!
Comment #14
babbage commentedComment #16
Wesley Tanaka commentedDitto on #13 for me about 6.x-2.5 being broken and 6.x-2.x dev being fixed.