drupal_tests enables quick, easy, and repeatable tests for individual Drupal modules. While it can replace the Drupal testbot for projects outside of Drupal.org, it's most appropriate for private modules shared among multiple sites or an internal distribution.
This repository shows how to run module tests, using the existing tests for the Drupal 8 node module. As well, a sample Behat test has been added to the node module demonstrate Behat tests and screenshot capture.
This repository also overrides the default variable for the module name, as I didn't want to simply call this GitHub repository 'node'.
Walk through the notes below to see how this works!
- f95125
shows the files that were added after running setup.sh. At the time,
0.2.0
was the newest tag of drupal_tests. - 3d83dc shows overriding test commands.
- 75374c shows a basic Behat test viewing a node.
- #36 shows running Unit and Kernel tests, with all passing. Every job saves the composer.lock file so exact versions in tests can be reproduced later if needed.
- #37
shows code quality checks, including Drupal coding standards which the Node
module currently fails.
- The artifacts of the job contain static HTML reports with complexity, probable bugs, and other reports. For example, we can see that the Drupal\node\Plugin\Search\NodeSearch is a good candidate for refactoring.
- #38
shows the results of our Behat tests.
- The artifacts of the job contain screenshots of each step. Each feature is combined into one long image to easily scroll through.
- #39
shows code coverage results from Unit and Kernel tests. Code coverage is
only generated if the prior Unit and Kernel test job passes.
- The artifacts of the job contain both the XML and HTML output from PHP unit. The coverage dashboard shows good classes to target for testing.