Voting starts in March for the Drupal Association Board election.
We want to get rid of simpletest.module in Drupal 9. We want to prepare the latest Drupal 8 development branch as much as possible before opening the Drupal 9 development branch (see). Therefore we need to convert all web tests to BrowserTestBase or UnitTestBase or KernelTestBase and deprecate WebTestBase.
1) Convert a small part of Drupal core web tests to Browser tests to get them battle tested. See all the conversion child issues that have been opened here before 2016-Sept-01.
2) Implement a backward compatibility layer as AssertLegacyTrait used by BrowserTestBase. Ideally a test conversion should only be the change of the namespace and used base class. Everything else should be covered by backwards compatible methods as far as possible/reasonable.
3) Prepare one big bang patch of test conversions in . Commit it during code freeze of the next Drupal minor release (likely March 2017 for 8.3).
4) In the meantime open child issues to convert web tests for each core module. While doing so we should also check if the test cases actually require a browser or can be converted to unit/kernel tests. They will be postponed until is committed.
Resolve all the child issues. Convert web tests in child issues per module/component in Drupal core.
Instructions for converting a Simpletest web test:
- Read https://www.drupal.org/phpunit and all subpages, especially https://www.drupal.org/node/2783189 .
- Move the test file to a tests/src/Functional folder in the module.
- Rename the namespace, make the class extends BrowserTestBase and fix the use statement.
- Try to run the single test with phpunit, example for HelpTest (replace the path with the file you converted):
cd core ../vendor/bin/phpunit modules/help/tests/src/Functional/HelpTest.php --stop-on-failure
- You can download the helper script browsertest-convert.php to your Drupal root directory and do a primitive conversion for all web tests of a core module with
php browsertest-convert.php <MODULENAME>
- Fatal error: undefined function assertNoLink(): not all legacy assertion methods are implemented yet, check to borrow from there.
- If there is a test method which does not perform a web request (for example no ->drupalGet() or ->drupalPostForm() calls) then that method should be extracted to a unit test or kernel test.
- Otherwise try to change as little things as possible in the converted web test. The conversion should be easy to review and further cleanup can be done in a follow-up issue.
- If you get stuck checkout the other child issues that do conversions - they can give you a hint what needs to be changed.
User interface changes
Simpletest and WebTestBase will be deprecated.
Data model changes