Problem/Motivation

Because of the size of Drupal.org, the number of people we'd like working on tests, and the fact that nearly all of us are just learning, it would be nice to have some separation between major feature sets in the context files so that each area is relatively self-contained.

Proposed resolution

(description of the proposed solution, the rationale behind it, and workarounds for people who cannot use the patch)
I made a commit to the eliza411 topic branch that uses Behat subcontexts to accomplish this:

  • FeatureSet.php includes resources for all subcontexts
  • Each subcontext initializes the test environment independently (and is responsible for tearing it down, too).

I can imagine that once we have tests written and a better understanding of all the parts, we may want to initialize the test environment globally, but it seemed like the containment might be beneficial during this early stage.

For the time being, I imagine each team having its own context file. As more tests are written, we can consider a more elaborate directory structure as needed.

For now, to set up a new feature set:

  1. Create a file called FeaturesetnameContext.php in features/bootstrap (e.g. GitContext.php)
  2. Edit features/bootstrap/FeatureContext.php and call the new file in the contstructor, for example: $this->useContext('git_context', new GitContext($parameters));

Remaining tasks

(reviews needed, tests to be written or run, documentation to be written, etc.)

Comments

jhedstrom’s picture

One way of doing this would be to use Behat's subcontexts.

eliza411’s picture

Component: Tests » Environment setup
Status: Active » Needs review

I updated the issue summary and pushed the current proposed solution as a branch for evaluation. It seems easier to work in branches than to use the patch workflow for this project.

eliza411’s picture

Status: Needs review » Fixed

I think this is superseded by the work on the DrupalExtension, and that we've settled on a structure for the feature files.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updating with a possible solution