The way SimpleTest currently works is that it builds a new Drupal instance via install files, which is great for testing core, and for low-level module development. However, testing complex site configurations (workflows, ACLs, etc) is not currently possible without extending DrupalWebTestCase each time.

I have been using the technique described here for several months now with great success, but adding this as part of core simpletest would allow for this practice to be more rapidly adopted by people developing complex Drupal applications.

Things that remain to be done on this:

  • Write tests
  • Update to DBTNG where applicable
  • Determine if DrupalWebCloneSiteTestCase could have a better name...
  • Ideally this class would live in it's own file, but doing so would then require that any test cases extending this would need to manually include that file (unless the registry solves this?).
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhedstrom’s picture

FileSize
5.43 KB

This removes the redundant drupalCreateNormalUser function.

mikey_p’s picture

Could drupalCreateUserWithRole() be useful in DrupalWebTestCase itself? Seems like it could, and it doesn't necessarily fit with the intended functionality of DrupalWebCloneSiteTestCase (which is fairly specific).

Also, I don't know if core has a standard for the number of classes per file or not. It does seem odd that this is against a file which is currently named after the only class in it, but that may not mean anything.

drewish’s picture

It seems like you missed some of my feedback from your original post. Specifically I don't think your table prefixing will work with multisite installations. It also looks like we might need to take your college Michael Schwern's comment into account and add a tearDown().

If this is going into core then we should either look at having a common parent class with the shared setUp() code or moving the common code into helper functions.

I agree with mikey_p on drupalCreateUserWithRole()... either make the role a parameter on drupalCreateUser() or move the function up to the parent class.

boombatower’s picture

Already working on #323477: Increase simpletest speed by running on a simplified profile which will only need small follow-up patch to add this functionality (as I have designed it with this in mind).

The other patch will optimize it and support multiple processes running concurrently. It is currently waiting on another patch. Once that gets in I can finish it up and get this functionality.

jhedstrom’s picture

FileSize
6.08 KB

For the sake of completeness, I'm uploading a modified patch that takes into account drewish's feedback from #3, but it sounds like most of this won't be needed.

@boombatower: any idea if the changes in #323477 will be backported to 6.x, or are they too dependant on DBTNG?

@mikey_p: I'm not sure why drupalCreateUserWithRole would be needed in DrupalWebTestCase since there aren't any roles in a clean Drupal install.

boombatower’s picture

I attempt to backport everything that is possible...I would think it should work.

boombatower’s picture

Status: Needs work » Closed (duplicate)
tomhung’s picture

Has this functionality been backported into D6?
Greg