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

boombatower’s picture

Assigned: Unassigned » boombatower
Status: Active » Needs review
StatusFileSize
new5.37 KB

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.

class SimpleTestCloneTestCase extends DrupalCloneTestCase {

  public static function getInfo() {
    return array(
      'name' => 'Clone',
      'description' => '...',
      'group' => 'SimpleTest',
    );
  }

  protected function testContact() {
    $this->drupalGet('contact');
    $this->assertText('Contact');
  }
}
boombatower’s picture

StatusFileSize
new5.35 KB

Removed unnecessary global $db_prefix;

Status: Needs review » Needs work

The last submitted patch, , failed testing.

dave reid’s picture

Status: Needs work » Needs review

My bad.

Re-test of from comment #2404046 was requested by @user.

Status: Needs review » Needs work

The last submitted patch, , failed testing.

boombatower’s picture

Status: Needs work » Needs review
StatusFileSize
new5.56 KB

Re-roll for temp directory patch.

Status: Needs review » Needs work

The last submitted patch, 666956-drupalclonetestcase.patch, failed testing.

boombatower’s picture

Status: Needs work » Needs review
StatusFileSize
new6.73 KB

Should be simple fix.

boombatower’s picture

StatusFileSize
new5.68 KB

Determined that this will work best if host db is cloned and is simplest to explain and such.

boombatower’s picture

StatusFileSize
new5.21 KB

Re-roll for core changes.

boombatower’s picture

StatusFileSize
new5.16 KB

Re-roll.

sun’s picture

+++ 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.

boombatower’s picture

$this->excludedTables[] = 'new_table';
sun’s picture

Status: Needs review » Reviewed & tested by the community

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).

boombatower’s picture

#13: 666956-drupalclonetestcase.patch queued for re-testing.

Retesting to make sure it still applies and passes.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 666956-drupalclonetestcase.patch, failed testing.

boombatower’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new5.55 KB

Re-rolling is getting old.

boombatower’s picture

StatusFileSize
new5.42 KB

Spacing was off in last patch.

webchick’s picture

Version: 7.x-dev » 8.x-dev

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?

boombatower’s picture

StatusFileSize
new5.42 KB

Re-roll.

sun’s picture

Status: Reviewed & tested by the community » Needs review

@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.

boombatower’s picture

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?

boombatower’s picture

StatusFileSize
new5.63 KB

Re-roll.

dave reid’s picture

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.

boombatower’s picture

StatusFileSize
new5.66 KB

Fixed.

rfay’s picture

Subscribe. Is there a movement to do this in contrib? Will Simpletest Clone become a D7 contrib project as well?

boombatower’s picture

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.

boombatower’s picture

Please note #29 is now active and is much improved over this version.

rfay’s picture

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)

boombatower’s picture

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.

pwolanin’s picture

@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.

Anonymous’s picture

subscribe.

boombatower’s picture

@pwolanin: Not sure what are referring to. As I mentioned above this has been implemented in contrib.

pwolanin’s picture

@boombatower - it seems like this could be implemented as a class that extends and just replaces the setUp method?

boombatower’s picture

It is

class DrupalCloneTestCase extends DrupalWebTestCase {

It just cleans up the setUp method to make it require less messing around which the remote test case also uses.

mojzis’s picture

@boombatower there is a task about this to "Determine if an old patch is still relevant" in the Drupal office hours website. Since it was one of the last to solve, i did attempt to :) but from the discussion aboive i sort of dont understand whether you still think it would be better to have this in core ?
thanks :)

Status: Needs review » Needs work

The last submitted patch, 666956-drupalclonetestcase.patch, failed testing.

boombatower’s picture

The DrupalCloneTestCase and the remote test case allow people to test configured websites with content and such which is necessary to do any sort of real end-to-end testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dawehner’s picture

Issue summary: View changes
Status: Needs work » Closed (duplicate)