Motivation

When running tests in the GUI, it is often useful to look at the screenshots (HTML code) as seen by the test, for example if a certain word should appear in the HTML and does not appear, examining the HTML code can give us a good idea why is it not appearing.

If you have a continuous integration server running something like:

php scripts/run-tests.sh --verbose --xml path/to/artifacts my_website

You will see the test results (passes) as console output for each build, and if you save path/to/artifacts for each build, you will have access to failure messages in XML format.

Currently, though, there seems to be no way to keep screen capture HTML files as artifacts. Doing so would be useful in case a continuous integration server detects a failure for a given commit: one could then have a further tool (screen capture HTML files) to diagnose the problem.

Proposed approach

An issue is currently open, #2253999: Provide a way to keep test results and verbose messages as artifacts, which proposes a new unified way to output test results for continuous integration servers to use as artifacts. I have also submitted a pull request to the drush project which allows this. The latter request has been closed because it's outside the scope of Drush. The former might take a while to be developed.

For those who need this functionality soon, a simple argument --xml-verbose to scripts/run-tests.sh might suffise, for now. So, running:

php scripts/run-tests.sh --verbose --xml path/to/artifacts --xml-verbose my_website

would do two things:

(1) add the xml file lines for the HTML screen captures, in the correct order.
(2) copy the HTML screen capture files from sites/default/files/simpletest/verbose/* to the xml directory (for example path/to/artifacts)

Once we have that, we can set our continuous integration server to save, for each build, whatever is in path/to/artifacts for later use in diagnostics.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alberto56’s picture

Status: Active » Needs review
FileSize
2.12 KB

Here is a patch that does what is suggested above.

alberto56’s picture

Issue summary: View changes
Anonymous’s picture

Just wanted to mention that I tested this and it seems to work nicely.

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community
Fabianx’s picture

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

Generally +1 to the feature, but needs to go into 8.2.x first as simpletest is still supported.

Fabianx’s picture

Status: Reviewed & tested by the community » Needs work
David_Rothstein’s picture

Issue tags: +Needs backport to D7

This seems somewhat related to #2315791: Add functionality to open results in browser window to run-tests.sh, although probably not the exact same thing.

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

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now 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.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now 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.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now 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.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now 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.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.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.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.