Experimental project

This is a sandbox project, which contains experimental code for developer use only.

Node: I've decided to rewrite this more along the lines of Ruby Koans, using Drush commands and Behat/PHPUnit instead of Simpletest. You're welcome to check out the code here, but I am not actively developing or maintaining this project. -Sam

This is a sandbox project for the Test Driven Learning module, which has the goal of teaching developers Drupal 8 by providing them with tests that cover the basics of Drupal 8 core. Currently only Blocks, Entities, Controllers, Events and module configuration have tests associated with them, but over-time all elements of Drupal 8 will have test coverage.


  1. Run "git clone --branch 8.0.x-dev git.drupal.org:sandbox/samuel.mortenson/2342299.git tdl" from your module directory.
  2. Enable the Test Driven Learning module

Basic Use

  1. Visit the "/tdl" path to get a list of test groups you can start working on.
    • If you have run any tests within a group, a percentage of your passed tests will be displayed next to the group name.
  2. Each group page list contains a list of tests and their basic information. You can review each test by clicking on it and reading its requirements and description.
    • The color of tests (and classes/methods) relate to the pass (green) and fail (red) status.
  3. Once you have chosen a test, there are a few ways to approach developing a solution:
    1. Read all the hints associated with the test.
    2. Click through each class and method to review requirements and failed test messages (if present).
    3. Search Drupal.org and [your search engine here] for appropriate documentation, or grep through core modules to see how it's already done in Drupal 8.
      • This module tries not to give away too much, plus maintaining tests is significantly simpler than maintaining documentation.
    4. If you want to get a head start, click "Download Skeleton" to get an incomplete module that contains most of the structure required to pass the test.
    5. When you feel ready, run the test and review the resulting messages in each failed class/method. If the information there isn't good enough, you can always run tests directly from Simpletest.


If you have a test or test group you would like to contribute or see added, file a new issue with an appropriate patch. The requirements for a new test/group are:

  1. Ensure that a properly formatted group config exists in tdl/src/Tests/metadata. If you are creating a new group, you can use the template located in that directory.
  2. For each class in your group config, create a new test in tdl/src/Tests/[group]. If you want a message to show up in the UI, make sure that the group is set to "TDL".
    • Example: $this->assertTrue(FALSE, 'You'll never pass my test, sucker!', 'TDL');
  3. For each lesson in your group config create a folder in tdl/src/Tests/skeletons, replacing spaces with underscores. Skeletons should include all the files needed to pass the test, but not too much of the logic (if any). Classes should have at least all the aliases (use *) needed, as well as the empty class itself.
  4. In general, try to keep your hints and test messages as verbose and helpful as possible. Linking to Drupal.org is o.k., but is not as valuable as something that directly relates to the test.

Project Information