Posted by boombatower on December 23, 2009 at 10:44pm
| Project: | Drupal core |
| Version: | 8.x-dev |
| Component: | simpletest.module |
| Category: | feature request |
| Priority: | normal |
| Assigned: | boombatower |
| Status: | needs review |
Issue Summary
I have discussed this idea quite a lot, attempted to refactor SimpleTest to do it cleanly, and implemented outside of core as simpletest_clone. I have cleaned up and simplified it for Drupal 7.
This is an extremely useful tool for performing regression testing against actually site builds.
Comments
#1
I tested the code by modifying my default installation to include the contact module enable and visible for anonymous users. This should fail if you do not have that setup.
Since we don't have any sort of pre-configured drupal (other than install profiles which SimpleTest already runs against) I am not sure how to easily test this in core. Short of have a webtestcase that launches a clone test after modifying the temp db, but I am not sure that we want to mess with all that.
<?php
class SimpleTestCloneTestCase extends DrupalCloneTestCase {
public static function getInfo() {
return array(
'name' => 'Clone',
'description' => '...',
'group' => 'SimpleTest',
);
}
protected function testContact() {
$this->drupalGet('contact');
$this->assertText('Contact');
}
}
?>
#2
Removed unnecessary global $db_prefix;
#3
The last submitted patch, , failed testing.
#4
My bad.
#5
Re-test of from comment #2404046 was requested by @user.
#6
The last submitted patch, , failed testing.
#8
Re-roll for temp directory patch.
#9
The last submitted patch, 666956-drupalclonetestcase.patch, failed testing.
#10
Should be simple fix.
#11
Determined that this will work best if host db is cloned and is simplest to explain and such.
#12
Re-roll for core changes.
#13
Re-roll.
#14
+++ modules/simpletest/drupal_web_test_case.php 27 Jan 2010 22:46:25 -0000@@ -2718,7 +2733,80 @@
+ protected $excludeTables = array(
What can we do to allow tests to extend this list easily without having to entirely replace it?
Powered by Dreditor.
#15
<?php$this->excludedTables[] = 'new_table';
?>
#16
Well then ;)
Those changes partially overlap and conflict with #347959: modules_installed is broken during testing, but someone would have to re-roll one of both either way (and the other isn't working yet).
#17
#13: 666956-drupalclonetestcase.patch queued for re-testing.
Retesting to make sure it still applies and passes.
#18
The last submitted patch, 666956-drupalclonetestcase.patch, failed testing.
#19
Re-rolling is getting old.
#20
Spacing was off in last patch.
#21
This definitely seems useful, but if it's available in contrib, it's a new feature for D7's SimpleTest module, and we're almost 6 months since feature freeze, why exactly is this being pushed now?
#22
Re-roll.
#23
@webchick: If people are able to write tests for their own, custom sites, this will lead to more contributors who are familiar with the testing framework. In turn, we'll see many more contributors that already know how to write tests, and therefore, bug reports can be resolved more quickly. Hence, committing this would be beneficial for overall Drupal development.
Some comments in this patch need some love though.
#24
Also note the related #758662: Add staging test case. Using this I was able to run a test against drupal.org staging servers!! Fairly useful eh?
#25
Re-roll.
#26
Considering that core doesn't take advantage of this, I don't see how it would be useful to provide in core. I'd be fine with it being in a simpletest 7.x-2.x drop-in contrib replacement for core.
#27
Fixed.
#28
Subscribe. Is there a movement to do this in contrib? Will Simpletest Clone become a D7 contrib project as well?
#29
Once I get my life back under control...I want to start up SimpleTest 7.x-2.x which I would like to include this and prep for SimpleTest 8.x.
#30
Please note #29 is now active and is much improved over this version.
#31
So Simpletest module in contrib now has a 7.x-2.x branch, which includes DrupalCloneTestCase. That's excellent. There is a 7.x-2.x dev release as well. (That was just me re-parsing #30)
#32
Yep, and I have an external git repository that I use to merge with HEAD on a regular basis so it is kept up-to-date.
#33
@boombatower - does it make sense to duplicate the whole thing?
It seems like one could just subclass the core class to provided the needed facility as long as your willing to suffer a little code duplication.
#34
subscribe.
#35
@pwolanin: Not sure what are referring to. As I mentioned above this has been implemented in contrib.
#36
@boombatower - it seems like this could be implemented as a class that extends and just replaces the setUp method?
#37
It is
<?phpclass DrupalCloneTestCase extends DrupalWebTestCase {
?>
It just cleans up the setUp method to make it require less messing around which the remote test case also uses.