Internal browser

Last updated on
6 October 2020

SimpleTest contains a powerful internal browser that is used to test Drupal through its web interface. Having such a powerful tool available in core would open up a number of possibilities and allow certain areas to be cleaned up.

Abstract SimpleTest browser

The browser already built into SimpleTest needs to be abstracted to allow for general use beyond SimpleTest; it also needs to support pluggable back-ends, such as CURL and PHP-stream wrappers. This should separate the code into three parts:

  • Browser - provides general get, post, type functionality
  • Wrapper - back-end used to actually make the HTTP requests and handle any other low-level details
  • Page - provide convenience functions for manipulating and parsing HTML

Usage

In addition to making it possible to abstract parts of core, the code has a number of exciting uses. For instance, install/update scripts could be created that perform an operation on multiple remote machines. The idea is described in Abstract SimpleTest browser holds many possibilities: install and update scripts.

Having a general use install script would be helpful for the automated testing framework (Project Issue File Review) in that when changes are made to the visual installer the script could be updated and no changes would need to be made to the testing.drupal.org infrastructure. Another module that requires an install script is the Usability Testing Suite which would benefit in the same ways.

Status

The code for abstracting the browser is very far along. It needs a bit more refining, but the overall framework is in place. The original internal browser code has been re-factored to make it more readable and more "beautiful."

Related issues

Next steps

Once the browser is abstracted work can begin on:

  • Replacing/Integrating with drupal_http_request().
  • Creating install/update scripts.
  • Using the internal browser in areas of core that parse XML or perform HTTP requests, such as: update, aggregator.
  • Backport the browser and scripts to Drupal 6 as a module since the browser itself should be freestanding and only require PHP 5.
  • Use the Drupal 6 module and install script to abstract the installer used in PIFR and later UTS.

Help improve this page

Page status: No known problems

You can: