Problem/Motivation

Issues like #2795037: BTB: Add cronRun function raise the question, should we expand the list of things on BrowserTestBase.
You could argue yes, for BC reasons, but another solution for the BC stuff is to add a LegacyBrowserTestBase which has the traits you need

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#5 2820182-5.patch433 bytesdawehner
#2 2820182-2.patch1.75 KBdawehner

Comments

dawehner created an issue. See original summary.

dawehner’s picture

Status: Needs review » Needs work

The last submitted patch, 2: 2820182-2.patch, failed testing.

jhedstrom’s picture

+++ b/core/tests/Drupal/Tests/LegacyBrowserTestBase.php
@@ -0,0 +1,45 @@
+use Behat\Mink\Driver\GoutteDriver;
+use Behat\Mink\Element\Element;
+use Behat\Mink\Mink;
...

Are all the unused use statements needed?

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new433 bytes

Not at all.

klausi’s picture

I would avoid adding yet another test base class.

Why is it such a problem that we add the most common APIs to BrowserTestBase itself? Code separation we can do with traits, so BrowserTestBase growing in code size is not an argument. For discoverability I think BrowserTestBase should have a rich API with many helper methods.

If we convert the old Simpletests to LegacyBrowserTestBase then we need to convert them another time to BrowserTestBase after that. I think it just creates more work and confusion.

But anyway, I also don't care too much about this, so feel free to proceed if others agree.

tim.plunkett’s picture

This is much better than polluting BTB itself!

dawehner’s picture

If we agree on that general approach, we should still somehow make it easily possible to find those additional traits. Maybe use some common name like "*TestHelperTrait",
or just somehow use @ingroup test_helper_trait to make them easy to find?

dawehner’s picture

@klausi @tim.plunkett @jhedstrom
So do we basically agree on RTBCing this issue?

klausi’s picture

Not sure that we need this now. In #2814047: BrowserTestBase should implement AssertMailTrait for backwards compatibility we decided that we can do the conversion script from old Simpletests to BrowserTestBase in a way that we add the required trait if the method gets called. That was successful for AssertMailTrait::getMails() in #2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits.

If we agree that approach is good enough then we can close this as won't fix.

dawehner’s picture

@klausi
I would totally agree with you, unless we want to make it as straightforward as possible for custom/contrib code. Not sure they'll be able to use the script?

klausi’s picture

Having that class in core means we have to maintain it, which means we have to test it although we don't use it in core. I don't see the benefit of doing that work. Probably some input from contrib maintainers would be good at this point, would they use LegacyBrowserTestBase or would they convert straight to BrowserTestBase directly?

@tim.plunkett how would you like to convert your tests?

tim.plunkett’s picture

Within a single subsystem or module, I'd prefer to individually convert each test to the latest and greatest approach. An intermediate step would just mean extra work.

But in terms of the best or most efficient way to remove the old WebTestBase, a legacy base class makes sense.

Absolutely we should strive to keep BTB clean.

klausi’s picture

Just to clarify: we will not remove WebTestBase in the Drupal 8 release cycle, ever. So Drupal 8 contrib converting their tests is optional. Simpletest will be supported forever in Drupal 8.

In Drupal 9 we will remove WebTestBase, but of course we will also remove any LegacyBrowserTestBase. So if a d8 contrib module converted to LegacyBrowserTestBase it will have to convert again to BrowserTestBase in Drupal 9.

dawehner’s picture

So what do we do about that, should we add one or not?

dawehner’s picture

Meh :)

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.

lendude’s picture

Having that class in core means we have to maintain it, which means we have to test it although we don't use it in core. I don't see the benefit of doing that work.

I agree with this.

Adding a trait to a specific test class when a method is needed is pretty trivial, and finding the right trait isn't all that hard either.

So my 2cts, I'd not add this.

dawehner’s picture

Status: Needs review » Fixed

I agree now, I believe. We see that we can make progress without it.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.