Download & Extend

Provide DrupalCloneTestCase for testing pre-configured drupal sites

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

Assigned to:Anonymous» boombatower
Status:active» needs review

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');
  }
}
?>
AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch5.37 KBIdleRepository checkout: failed to checkout from [:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal/].View details | Re-test

#2

Removed unnecessary global $db_prefix;

AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch5.35 KBIdleFailed on MySQL 5.0 InnoDB, with: 9,587 pass(es), 2,140 fail(s), and 1,102 exception(es).View details | Re-test

#3

Status:needs review» needs work

The last submitted patch, , failed testing.

#4

Status:needs work» needs review

My bad.

#5

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

#6

Status:needs review» needs work

The last submitted patch, , failed testing.

#8

Status:needs work» needs review

Re-roll for temp directory patch.

AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch5.56 KBIdleFailed on MySQL 5.0 InnoDB, with: 9,610 pass(es), 2,139 fail(s), and 1,096 exception(es).View details | Re-test

#9

Status:needs review» needs work

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

#10

Status:needs work» needs review

Should be simple fix.

AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch6.73 KBIdlePassed on all environments.View details | Re-test

#11

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

AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch5.68 KBIdlePassed on all environments.View details | Re-test

#12

Re-roll for core changes.

AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch5.21 KBIdlePassed on all environments.View details | Re-test

#13

Re-roll.

AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch5.16 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 666956-drupalclonetestcase_5.patch.View details | Re-test

#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

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

#17

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

Retesting to make sure it still applies and passes.

#18

Status:reviewed & tested by the community» needs work

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

#19

Status:needs work» reviewed & tested by the community

Re-rolling is getting old.

AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch5.55 KBIdlePASSED: [[SimpleTest]]: [MySQL] 17,859 pass(es).View details | Re-test

#20

Spacing was off in last patch.

AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch5.42 KBIdlePASSED: [[SimpleTest]]: [MySQL] 17,850 pass(es).View details | Re-test

#21

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?

#22

Re-roll.

AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch5.42 KBIgnoredNoneNone

#23

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.

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

AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch5.63 KBIgnoredNoneNone

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

AttachmentSizeStatusTest resultOperations
666956-drupalclonetestcase.patch5.66 KBIgnoredNoneNone

#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

<?php
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.

nobody click here