BrowserTestBase seems to be working well. Let's deprecate WebTestBase so people start making new tests using BrowserTestBase.

Based on comment #10, we need to wait on formal deprecation until it's proven that all core tests can be converted to BTB. That essentially means until they're all converted: #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase) See a helpful countdown dataviz here:

Our formal deprecation process includes triggering @trigger_error(E_USER_DEPRECATED), which would be very disruptive to contrib/legacy projects since it will fail tests by default. We should consider doing this in a later minor version or maybe never, to minimize disruption. #2886547: Add trigger_error to deprecated TestBase classes that have none and add a reference to the relevant CR

It's also true that BrowserTestBase depends on the simpletest module. This dependency should be broken: #2803621: Break BrowserTestBase & children dependency on Simpletest, deprecate stub BC traits

Proposed resolution

Add a change record about the WTB deprecation.

Formally deprecate WebTestBase in favor of BrowserTestBase, or other phpunit-based framework as appropriate.

Remaining tasks

Follow-up to add @trigger_error() to WebTestBase and/or TestBase: #2886547: Add trigger_error to deprecated TestBase classes that have none and add a reference to the relevant CR

User interface changes

API changes

Data model changes

#2 2847678-02.patch493 bytesmpdonadio
Members fund testing for the Drupal project. Drupal Association Learn more


mpdonadio created an issue. See original summary.

mpdonadio’s picture


mpdonadio’s picture

Status: Active » Needs review
dawehner’s picture

I would say totally +1 as of 8.4.x
IMHO we should wait until we commit the conversions.

One important point maybe, what should happen with new tests. For me this will be solved kind of automatically and we don't need a policy. People will use the new test base over time, while we convert remaining ones at the same time.

mpdonadio’s picture

If we formally deprecate this, then don't we have an official (or semi-official) policy already that we don't commit new patches w/ deprecated code in them, except at the discretion of the committers as long as justification is provided? For this case, I don't see that happening as I think we have the Drupal specific things covered in BTB, and Mink provides a much better framework for the actual assertions (every time I write a test I learn how to do something better).

The biggest win with this patch is that PhpStorm and other IDEs that understand DocBlocks is that people will know to start using BTB when making new tests, and so will people who review patches applied.

I would be in favor of tweaking the language to mention that KTB or UTC should be considered if it isn't a proper functional test.

larowlan’s picture

I love it when a plan comes together

claudiu.cristea’s picture

Hm. I think we should fix this #2803621: Break BrowserTestBase & children dependency on Simpletest, deprecate stub BC traits before.

EDIT: Note that BTB is a core feature that depends on a module. This is conceptually wrong.

klausi’s picture

I think deprecating WebTestBase in 8.3.x is a bit too early. We need to get our big initial conversion patch in, then do some more manual conversions of what is left to gain more experience and confidence in BrowserTestBase. If everything goes smoothly we can then deprecate WebTestBase in 8.4.x, meaning contrib developers will see it first when 8.4.0 is released in October 2017.

I don't think issues such as #2803621: Break BrowserTestBase & children dependency on Simpletest, deprecate stub BC traits are blockers for the deprecation because BrowserTestBase is usable without that.

klausi’s picture

Status: Needs review » Postponed

Postponing this at least on #2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits. I think we need a bigger chunk converted to BrowserTestBase before we deprecate Simpletest.

mpdonadio’s picture

Issue tags: +DrupalCampNJ2017

@xjm and I talked a little about this at DrupalCampNJ. She doesn't think it is a good idea to formally deprecate WTB until we can prove that all of our tests can be converted sucessfully.

So, the tests that aren't in the mass conversion are blocking this. I think the issue about WebTestBase::drupalPostAjaxForm() is the main blocker, but I am also trying to figure out how to work around a particular usage of AssertContentTrait::setRawContent() w/o a major rework of two datetime tests classes.

I still think a formal policy about no new WTB after 2017/02/21 would be a good idea, even if we aren't deprecating it yet. That way we would have something to point to when doing patch reviews.

klausi’s picture

Status: Postponed » Active
klausi’s picture

Our original proposal for a timeline that we came up with in September 2016 in #2807237: PHPUnit initiative: We will deprecate Simpletest's WebTestBase in 8.4.x, but not for 8.3.x releases. Between the release of 8.3.0 and 8.4.0 we will polish our PHPUnit browser tests and then WebTestBase will be deprecated and forbidden for new tests with the release of 8.4.0 in October 2017.

Mile23’s picture

Drupal 8.0.1 is released, so this is back on, please. :-)

Looking for but can't find the how-to-convert-your-test doc. That should be a @see on this.

michielnugter’s picture

Issue tags: +phpunit initiative
Mile23’s picture

#2876145: ConfigTranslationViewListUiTest is a WTB test in the Functional namespace adds @trigger_error() for all WTB test base classes.

We might end up undoing that here to avoid double errors.

dawehner’s picture

We might end up undoing that here to avoid double errors.

That is something we could do indeed. I think a duplication is not really a big issue, especially because contrib might do the same as well, but yeah its a good idea to have indeed.

Mile23’s picture

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.