This is a Drupal core issue.

Problem/Motivation

Based on conversation in #3057420: [meta] How to deprecate Simpletest with minimal disruption, it's likely that we'll move simpletest module out of core, to be a contrib module. Since that meta is basically accomplished, we have flexibility in what we decide to do with the simpletest module. That is to say we can remove it and the testing system will still work, so the question is: Should we remove it, and if we do, should we make a contrib module out of it?

Making it a contrib module would allow some flexibility for those who wish to use simpletest's WebTestBase framework, and/or also use the UI test runner.

Proposed resolution

  • Remove simpletest module from Drupal core
  • Open a beta-blocking tracking issue to ensure that contrib modules with simpletests can have them run via DrupalCI (with some or no changes). If that's not complete by beta, we'd need to revert the removal commit or discuss further
  • In a follow-up, decide whether run-tests.sh should support running TestBase-based tests, either as a supported feature, or as a short-term scaffolding while the contrib module is being developed. But leave that support in for now

Remaining tasks

How to deprecate and remove the module while not ruining people's day?

  • run-tests.sh (at least for now) will run simpletest tests if simpletest module is installed.
  • Can DrupalCI automatically install simpletest module or does it need to be an explicit dependency?
  • If it's an explicit dependency can we prompt somehow?
  • The contrib module will need manual testing for the simpletest UI and run-tests.sh to ensure they actually work as part of making a stable release.

Related non-core issues:

User interface changes

API changes

Data model changes

Release notes snippet

Dear SimpleTest, thank you for all the years of service. You helped drag Drupal from the depths of the untested to its almost test driven state now. You have watched over us as we went from no passed tests to over 25000 passed tests. We owe you much, you will be remembered. The time has come to rest in the pastures of contrib, you have earned it.

Drupal core no longer runs SimpleTest as part of its test suite. If your contributed module still uses SimpleTest in Drupal 9 follow the instructions on the change record in order to continue running the tests.

Comments

Mile23 created an issue. See original summary.

mile23’s picture

Status: Active » Postponed
Issue tags: +Needs change record
mile23’s picture

Mixologic’s picture

Lets verify the composer namespaceing and ensure we dont have unworkable snafu's for requirements on 'drupal/simpletest'

mile23’s picture

Status: Postponed » Needs review
StatusFileSize
new281.94 KB

Experimental patch to see how much of the simpletest module we can remove before it breaks.

Will set back to 'postponed' after the test runs.

mile23’s picture

Status: Needs review » Postponed
Mixologic’s picture

re #4 I did do some verification, and reported my results to slack, which isnt useful due to its ephemeralness.

In any case, the number of projects that declare a dependency on drupal/simpletest is *extremely* minimal, and really, we ought to be able to make contrib own the drupal/simpletest namespace since I couldnt find any examples that had any sort of constraint whatsoever on it.

+1 to move this out, as this wont affect p.d.o, but we'll probably need a postponed followup to do a namespace switcharoo in the packages.drupal.org issue queue.

mile23’s picture

Issue tags: +Needs followup

Adding NF per #7

mile23’s picture

Status: Postponed » Needs review
StatusFileSize
new458.05 KB

This patch includes current patches from #3074433: Decouple run-tests.sh from the simpletest module and #2800267: Turn simpletest_clean*() functions into a helper class, and then removes everything from the simpletest module which is not needed.

Doing this led me to file #3079988: Replace, deprecate simpletest_process_phpunit_results(), which illustrates why the simpletest module is not completely removed. :-)

This issue is still postponed, and if I haven't set it back that's a shortcoming on my part.

mile23’s picture

Status: Needs review » Postponed
mile23’s picture

Status: Postponed » Needs review
StatusFileSize
new459.58 KB
new1.69 KB

Failure in #9 illustrates why run-tests.sh should be testable.

mile23’s picture

Status: Needs review » Postponed
mile23’s picture

Based on the fact that the #11 has 156 fails and the search term TestFileCreationTrait appears 191 times in the results report, I filed #3080163: Decouple TestFileCreationTrait::getTestFiles() from simpletest module.

mile23’s picture

StatusFileSize
new438.31 KB
new98.46 KB

This adds the patch from #3080163-12: Decouple TestFileCreationTrait::getTestFiles() from simpletest module and completely deletes the simpletest module. That's in addition to the patches applied in #9. #3079988: Replace, deprecate simpletest_process_phpunit_results() was committed to core already.

As in that patch, we expect a fail from Drupal\Tests\migrate_drupal_ui\Functional\d6\Upgrade6Test.

mile23’s picture

Status: Postponed » Needs review
mile23’s picture

Status: Needs review » Postponed
mile23’s picture

Status: Postponed » Needs review
StatusFileSize
new433.07 KB
new7.36 KB

Let's try that again, this time with the ability to run tests.

run-tests.sh still needs the test_discovery service for BC for hooks that run against the deprecated WebTestBase framework that have themselves been deprecated and which no one uses. :-)

Update: Addressed many of these fails in #3080482: Decouple FunctionalTestSetupTrait from the simpletest module

mile23’s picture

Status: Needs review » Postponed
mile23’s picture

Status: Postponed » Needs review
StatusFileSize
new431.78 KB
new1.28 KB

Adding back the simpletest config so that FunctionalTestSetupTrait works. To be fixed in #3080482: Decouple FunctionalTestSetupTrait from the simpletest module

mile23’s picture

Status: Needs review » Postponed
mile23’s picture

Status: Postponed » Needs review
StatusFileSize
new431.65 KB

#2800267: Turn simpletest_clean*() functions into a helper class is in so yay!

This patch applies #3074433-19: Decouple run-tests.sh from the simpletest module and #3080163-14: Decouple TestFileCreationTrait::getTestFiles() from simpletest module.

It deletes most of the simpletest module, leaving only the test_discovery service for BC, and the config, which will be addressed in #3080482: Decouple FunctionalTestSetupTrait from the simpletest module

The only non-patch code change is to Drupal\Core\Test\TestRunnerKernel, so that it doesn't try to require simpletest.module when it creates an extension object for the simpletest module.

mile23’s picture

Status: Needs review » Postponed
mile23’s picture

Issue summary: View changes

Updating the IS with some ideas from slack chat w/ @xjm.

catch’s picture

So if we don't do anything special, 9.x-compatible modules with simpletests should be able to use.

test_dependencies:
 - drupal:simpletest

in info.yml. That seems acceptable but maybe not ideal since you could probably go a while without realising those tests aren't running.

The other way would be for DrupalCI, when it looks for test_dependencies, to always add simpletest if it's not there for you (which would need to stay in place until either a further announcement, or 9.x EOL).

mile23’s picture

An alternative is that TestDiscovery could still find TestBase/WebTestBase tests, and then error out if simpletest module is not present. This would allow run-tests.sh to fail, and would happen without a need for drupalci (so it would fail locally, too).

We could also have a message at the top of run-tests.sh and/or phpunit saying: Hey, guess what we're doing with the simpletest module?

mile23’s picture

Status: Postponed » Needs review
StatusFileSize
new413.25 KB
new6.23 KB

This patch applies #3080482-10: Decouple FunctionalTestSetupTrait from the simpletest module to #21, and also deletes the config directory from simpletest module. This leaves only the test_discovery service in place in the simpletest module, so that run-tests.sh can use it and provide BC for the hook_test*() hooks that no one uses. :-)

#3080482: Decouple FunctionalTestSetupTrait from the simpletest module changes the name of the config that is used by FunctionalTestSetupTrait. This addresses many of the fails from #17.

Update: These fails all look like they're related to updating, and that's because they update fixtures with the simpletest.settings config within them.

So the question becomes: How will we test updates from versions of core that have a simpletest module, to those without?

mile23’s picture

Status: Needs review » Postponed
mile23’s picture

Status: Postponed » Needs review
StatusFileSize
new413.63 KB
new2.56 KB

#3080163: Decouple TestFileCreationTrait::getTestFiles() from simpletest module and #3080482: Decouple FunctionalTestSetupTrait from the simpletest module are in so yay!

This patch applies #3074433-24: Decouple run-tests.sh from the simpletest module which is the only one remaining. :-)

It also completely removes the simpletest module, and changes run-tests.sh to not use the test_discovery service. This breaks BC for the testing hooks, but we’re doing it here experimentally. Included is a patch that only does the code changes to make this happen.

This should have the same 22 fails as #26, because of existing fixtures for upgrade tests which expect the simpletest module to exist.

mile23’s picture

Status: Needs review » Postponed
mile23’s picture

Two child issues, which we don't need to consider to be postponed:

These are based on the test results from #28.

mile23’s picture

catch’s picture

Issue summary: View changes
Issue tags: +Needs product manager review
xjm’s picture

Priority: Normal » Major
xjm’s picture

We should probably update the IS with what the required featureset for the contrib module is, e.g.,

  • It will include the legacy UI test runner, which should be installable on simplytest.me in order to test patches without setting up a dev stack.
  • It will include SimpleTest UTB, KTB, and WTB base classes so that modules that have not yet converted their full test suite to PHPUnit can simply declare a dependency on simpletest.
  • Will it include other base classes that are still included in D8 core currently? E.g. MenuWebTestBase or FileFieldTestBase.

Ideally the contrib module should be as close to the core module as possible to minimize disruptions, but there are some things (like the above) that we want to make sure are not broken or changed before D10. And perhaps the D10 version might remove the simpletest API base classes themselves, but retain the web UI test runner, or something.

xjm’s picture

Issue summary: View changes

Just adding some list markup to the IS.

mile23’s picture

Status: Postponed » Needs review
StatusFileSize
new407.42 KB

Now that #3057420: [meta] How to deprecate Simpletest with minimal disruption is basically done, it's time to un-postpone here.

Previous patches have been proofs-of-concept that the work in other issues has led us to be able to remove or minimize the presence of simpletest module in core.

This patch is the same: After #3074433: Decouple run-tests.sh from the simpletest module we can prove that simpletest can be removed without ill-effect. We might get failed tests, but they fail because we can run them.

We'll very likely leave a stub simpletest module in core for D9 for consistent upgrades. See issue: #3084493: Fully deprecate and prepare for removal of SimpleTest module

The process here is to just delete the simpletest module and apply the code_changes_only.txt patch from #28.

Status: Needs review » Needs work

The last submitted patch, 36: 3075490_36.patch, failed testing. View results

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new2.98 KB
new408.36 KB

So was playing around with this in a side issue, and this is what we would need to get this green without further other patches.

The interdiff is what would would need to add to the code_changes_only.txt patch from #28

In short, some small test changes that target simpletest, add a minimal simpletest stub module with an info file that sets it to hidden and the settings config that the update tests use.

catch’s picture

Just a note I updated #3084493: Fully deprecate and prepare for removal of SimpleTest module after talking to alexpott - it should not be necessary to have a stub module since people who want to keep using simpletest can use the contrib module. We do need stub modules when we're actually removing a core module outright but that's a different case. Production sites should not have simpletest module enabled anyway.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

lendude’s picture

StatusFileSize
new2.86 KB
new410.83 KB

So I've been trying to get the tests to go green when there is no .info.yml file any more, but this all turns out very hacky.

The problem here is that our current update DB dumps have Simpletest enabled, so all the tests expect the module to remain enabled. When we delete the entire module, we can't uninstall it anymore, and this where things get tricky. There is no good way to 'uninstall' a module when it no longer exists on the file system.

So this is a patch with the absolute minimum stub, a info.yml file. In order to get the upgrade tests to pass, we need an update function to uninstall the Simpletest module, to properly remove the simpletest.settings config.

lendude’s picture

So the whole 'getting update tests to play nice' is also relevant to #3084493: Fully deprecate and prepare for removal of SimpleTest module

Status: Needs review » Needs work

The last submitted patch, 41: 3075490-41.patch, failed testing. View results

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new393 bytes
new411.39 KB

Missed one....

catch’s picture

Update tests are a good reason to keep a stub module for now.

Once #3087644: Remove Drupal 8 updates up to and including 88** lands we could remove simpletest from any of the remaining update test database dumps, but until then stub seems easiest.

catch’s picture

Issue tags: +9.0.0 release notes
ghost of drupal past’s picture

Is someone planning to write an eulogy? To be very clear I am absolutely not against doing this, the time has certainly come, I am just nostalgic as always. Simpletest has helped Drupal grow from zero tests to almost test driven development. I feel a few words somewhere needs to be said (certainly not by me).

lendude’s picture

Issue summary: View changes

Added release note snippet

lendude’s picture

We now have a dev release of SimpleTest for D8/D9, see #3076422: [contrib] Move simpletest module to contrib for D9

https://www.drupal.org/project/simpletest/releases/8.x-3.x-dev, this obviously only works with this patch applied to core

xjm’s picture

Version: 8.9.x-dev » 9.0.x-dev
xjm’s picture

#48 gave a laugh; thanks @Lendude.

That said, we do need an actual release note snippet. :) And an actual change record that explains what exactly modules that want a UI testrunner or still have SimpleTest tests should do. Maybe the eulogy release note can go in the change record.

mile23’s picture

StatusFileSize
new313.54 KB
new5.73 KB

So the next question is:

Should Drupal 9 be able to run simpletest-based tests?

My answer is a resounding no, but your view may differ. :-)

If Drupal 9 run-tests.sh shouldn't run these tests, then the next steps go like this:

  • Remove the ability to run these tests from core.
  • Simpletest contrib has to be able to run them, probably using a semi-clone of the run-tests.sh script. This script won’t be that hard to write, thanks to recent refactoring of run-tests.sh.
  • Add a drupalci plugin which knows how to run simpletest contrib-based tests.

If Drupal 9 can run these tests, then the next steps go like this:

  • Work around contrib's needs for the next few years.

This patch removes the ability to run simpletest-based tests from D9. I assume this will be controversial, so let's talk about it.

Status: Needs review » Needs work

The last submitted patch, 52: 3075490_52.patch, failed testing. View results

mile23’s picture

Status: Needs work » Needs review
StatusFileSize
new316.74 KB
new3.2 KB

Picks up the failing test from #52.

Not sure why we see Build Successful instead of fail. Can investigate further if we think we don't want run-tests.sh to be able to run simpletest-based tests.

lendude’s picture

Taking the ability to run Simpletests out now would raise the barrier for D8 -> D9 migrations for contrib and from all I've seen and heard, this is something we want to avoid.
I think we need to operate on the assumption that D9 will be able to run simpletest, but somebody correct me if I'm wrong in my assumptions :)

Ah re-read, its 'move the ability to run the tests to contrib' vs 'having the ability in core' you are talking about? No opinion on that, whatever is easiest for the infra team I guess?

mile23’s picture

Right, #52/54 is about whether or not D9 core should have any built-in ability to discover and run simpletest TestBase-based tests.

I think it should not, and I'm willing to help out with a special-case drupalci plugin to run the contrib-based tests if one is required.

catch’s picture

@Mile23

So the next question is:

Should Drupal 9 be able to run simpletest-based tests?

Whether or not it should, is probably a decision and patch that should be separated from this issue about removing the module itself into a follow-up. Because otherwise removing the module is going to be dependent on that decision and/or any DrupalCI plugin we might need to write.

mile23’s picture

Because otherwise removing the module is going to be dependent on that decision and/or any DrupalCI plugin we might need to write.

Yes, this is why I'm pressing this issue.

If consistency for simpletest framework users is important, then, at minimum, contrib simpletest needs to be able to run its own tests in drupalci. We could use container_command to run a script supplied by the module. While this is not optimal, it's a way to make it work while a drupalci plugin is being authored. This is an issue someone could file.

The drupalci plugin would probably be mostly a clone of the run-tests one. This is another issue someone could file.

These are dependencies of removing simpletest from D9 because otherwise there is no net to catch users who need that framework.

Someone needs to write the meta... We have what, 6 months?

The unspoken alternative is to simply not support simpletest framework in any way, even as contrib. I advocate this approach, because I'm not sure who actually needs WebTestBase. In this scenario we rescope this issue to just remove everything from core simpletest that we don't need. The patch here already does this. And then we're done.

But that doesn't seem to be the plan, so let's write down the plan so we can accomplish it.

catch’s picture

I advocate this approach, because I'm not sure who actually needs WebTestBase

There are several dozen, contrib modules with unconverted WebTestBase. Those modules may not need to do much to have a working runtime Drupal 8 contrib module, meaning that converting the tests would outweigh the effort of the actual module port - because test conversion is one of the least straightforward changes to make. While they'll face the same issue when Drupal 10 comes around, Drupal 9 is the first release where we've promised a continual upgrade path, which hopefully includes most contrib modules being ported by 9.0.0, so minimising the amount of work people need to do seems worth the effort here.

mile23’s picture

Some work on making the contrib tests pass: #3093460: Make tests pass for 8.x-3.x (D9)

webchick’s picture

I was asked to chime in here from a product management POV, but can't seem to find a concise, objective write-up of the pros/cons and concerns that were raised in whatever other thread that was about removing the UI. Could someone passionate about this issue please help provide that?

mile23’s picture

I believe the UI thread is here: #2750461: Remove Simpletest UI because we don't want to maintain a graphical test runner, specifically #2750461-119: Remove Simpletest UI because we don't want to maintain a graphical test runner

I'm pretty sure we should close #3028663: Split up simpletest into simpletest and testing_ui to enable easier decisions for Drupal 9, since we seem to be beyond the decision-making part alluded to in the title.

Could someone passionate about this issue please help provide [an issue summary update]?

There isn't a good meta for this, tho I did file #2866082: [Plan] Roadmap for Simpletest quite a while back and no one else seemed interested in moving it forward. I'm totally OK with closing that in favor of something more up to date.

Minor IS updates, leaving the tag for someone who has an actual plan and/or is passionate. :-)

Patch in #54 removes the ability to run TestBase-based tests with run-tests.sh and probably needs a re-roll. I make that insistence based on the fact that we'll still be supporting TestBase in D10 if we allow that. :-) However, because we're a loose coalition of people working without a plan, the easiest move is to allow the technical debt for now and we do a follow-up to remove that functionality, so the patch in #44 is probably a better option. It needs a reroll.

xjm’s picture

Priority: Major » Critical

According to @Gábor Hojtsy this accounts for a quarter of the remaining deprecations in D9 core. We either need to complete the plan (maybe with a stub module and manual testing of the UX of the upgrade) or un-deprecate it.

xjm’s picture

Status: Needs review » Needs work

We also still need a real release note. :)

xjm’s picture

If possible, can someone summarize the user impacts of the change, pros and cons, in "three-tweet size"? From the perspective of a module owner. That's the information the product managers have requested to sign off. Thanks!

webchick’s picture

Heh, "three-tweet size" is a bit of a rough guideline, but basically product managers are interested in impacts of changes. I'm scanning for things like:

- How does this impact core developers?
- How does this impact module developers?
- How does this impact the usefulness of GUI tools like simplytest.me?
- How does this impact sprints (both those participating for the first time and those leading)?

I know from reading this like 11,000 years ago that there were a bunch of concerns raised in these general areas back in the day. What were those specific concerns? How does the current plan address them? If it doesn't address them, what's the workaround, and is it ok? etc.

It is going to take me multiple days over multiple weeks if I need to read each comment individually of multiple 100+ comment issues in order to glean this information. I'm hoping one of the folks who's already deep in this can gather that type of information and answer those types of questions more easily.

catch’s picture

Here's a stab at answering those questions, extra details and/or corrections welcome.

1. How does this impact core developers?

Core developers will no longer be able to run tests using the Simpletest UI. However, Simpletest UI output for phpunit is not very helpful. phpunit is easier to run via cli than simpletest was (less command line options etc.)

2. How does this impact module developers?

Modules with simpletests will be able to use the simpletest contributed module to run tests. Either transparently (DrupalCI adding simpletest module to every test run (requires DA help), or via dev-dependencies and a line or two in drupalci.yml (should not require DA help). Support for this is not yet complete yet however, and likely depends on a final decision being made here. Also if we remove simpletest support from run-tests.sh there'll need to be an equivalent script added to the contrib module (or we'll need to keep support for the contrib simpletest module in core's run-tests.sh until such a contrib script is available).

3. How does this impact the usefulness of GUI tools like simplytest.me?

Should not impact simplytest.me, it's not reliant on simpletest any more.

4. How does this impact sprints (both those participating for the first time and those leading)?

Would expect sprints to have been recommending phpunit and the cli runner for some time.

mile23’s picture

So we still have outstanding technical questions from #52. It seems like we're generally in agreement that simpletest module should be gone from core, perhaps replaced by a stub module for migration purposes.

I'd add:

1. How does this impact core developers?

Core developers can take advantage of the fact that most of the testing infrastructure is now @internal rather than API, and we don't need to work around/maintain the simpletest module.

The main impact would be to contrib project maintainers and owners of site projects that have WebTestBase-based tests. They should get to work on either converting their tests or expanding the stability of the contrib module: #3093621: [META] Plan to get a stable D8/D9 release of the SimpleTest module

webchick’s picture

http://grep.xnddx.ru/search?text=extends+DrupalWebTestCase&filename= isn't too crazy (5 pages of results, a few known projects in there). OTOH, that's only grepping D8 contrib. D7 contrib is likely to have tons more, and not all of those modules (let alone custom modules on 66% of all Drupal sites that are still on D7) are ported to D8 yet. We really do not want to add more stumbling blocks in getting people off D7 and onto D9, if we can help it.

I'm a little confused about #3093621: [META] Plan to get a stable D8/D9 release of the SimpleTest module ... if the answer to the above concern is "well now you just need to add "dependencies: simpletest" to your info file" then that seems like not a big deal. Is that it? Or is there some dependency on the contrib module doing something first?

Regarding sprinting, I'm not sure what the "official" resources are for sprinting these days are, but a google search lead me to http://drupalladder.org/lesson/f6499034-7520-2db4-6522-c32c8429e2d7 which is pointing to https://www.drupal.org/docs/7/testing which doesn't seem to imply at all that this is not the official recommended way to be writing tests. "During the Drupal 7 development cycle SimpleTest has become an integral part of the workflow, and it has been moved into core as the Testing module. It has significantly enhanced the way core is developed and made it possible to make major API enhancements with confidence."

Hacking the URL to https://www.drupal.org/docs/8/testing instead provides a buffet of options... one of which is converting SimpleTests to PHPUnit, but nothing once again stating outright that SimpleTest isn't the recommended way to be doing things...

Anyway. Point being, in order to do this, we likely need some docs updates in quite a few places first.

ghost of drupal past’s picture

I reviewed http://grep.xnddx.ru/search?text=extends+DrupalWebTestCase&filename= and there are extremely few D8 projects using DrupalWebTestCase. First of all, we can ignore .test files, these are leftovers from D7, they are not picked up by D8. Page 1 has ableplayer, baidu_analytics, baidu_tongji and bootstrap_menu_items projects having .php files which look like legit test cases. Page 3 has session_limit, page 4 has typogrify and cloudwords and it seems this is it. I count seven contrib projects. Just a data point.

mile23’s picture

The superclass you're looking for is WebTestBase.

Anyway. Point being, in order to do this, we likely need some docs updates in quite a few places first.

That's far too optimistic. :-)

Unless things have changed since I was last involved in this, there isn't a lot of momentum on making the contrib simpletest happen. I have no interest in maintaining it. @larowlan mentioned being interested, but I'm not sure whether that's still the case.

Simpletest (contrib) currently does not work, for a few reasons. The main one being that there's isn't (or shouldn't be) a way to run WTB tests from run-tests.sh once the simpletest module is gone from core. So therefore there's no way to know if the contrib module can pass its own tests.

It could be that the contrib module would eventually offer its own way to run tests via a script similar to run-tests.sh. In that case, I can help write a DrupalCI plugin for it if needed.

Basically it suffers from lack of momentum. The subsystem has two maintainers and neither has commented in this thread.

If it's decided that there is a need for consistency for the benefit of projects/sites which still use WTB, and no one steps up, then there are two options:

  1. Don't deprecate.
  2. Drum up some interest in the contrib so that consistency can be achieved and core can jettison the tech debt.
berdir’s picture

As someone who maintains a lot of contrib and has been working very actively on getting contrib ready, I'm a clear +1 on removing it from that perspective.

Points against removing:

* Yes, you did look for the wrong class, there are many more usages, around 43 pages on the search, https://dev.acquia.com/drupal9/deprecation_status/errors reports 575 usage.

* There are actually even more, as quite a few modules have base classes that hey extend from. webform for example had only a single deprecation message on that but actually had hundred or so subclasses, but that is an extreme examples.

* Yes, converting tests can be by far the hardest task in regards to deprecations, when they need to be converted to javascript tests for example, as our BC layers there don't really work. I've spent hours on single test classes.

But, We've also already made a lot of progress. According to https://dev.acquia.com/drupal9/deprecation_status/graphs, the number went down from 650 to 550 already, and that doesn't count a lot more that are available in dev releases and patches and "just" need to be committed. I'd say including patches that's surely another 100 and I wouldn't be surprised if it's twice that. And those base classes are often not actually removed just like core didn't remove them in case other modules still use them.

And these kind of stats are always a bit misleading as we tend to forget that contrib is basically wild west with a lot of unmaintained and barely used modules. Quite a few of the deprecations overall are from modules that were never fully ported to D8 in the first place like api.module.

I believe that sooner or later, pretty much any module out there is going to have a D9 patch. A lot of people are actively looking for modules to provide patches for (counting 13 pages of active issues with the "Drupal 9 compatibility" tag) and the only blocker will be for a maintainer to commit and release that.

That said, I agree we do need a way how the simpletest-as-contrib would actually work on DrupalCI or we could just as well drop it entirely. That's IMHO the main concern here, not contrib on its own. I think it would be possible for it to provide its own run-tests.sh that DrupalCI can run. I think it would be useful to have that detected automatically (grep for WebTestBase, if found, install simpletest and try to run those tests too).

catch’s picture

Simpletest (contrib) currently does not work, for a few reasons. The main one being that there's isn't (or shouldn't be) a way to run WTB tests from run-tests.sh once the simpletest module is gone from core. So therefore there's no way to know if the contrib module can pass its own tests.

I think we could do this in three steps.

Leave support for simpletest in the core run-tests.sh, while removing simpletest module from core.

Work on the contrib equivalent to run-tests.sh and ensure it works with drupalci

Remove simpletest support from core's run-tests.sh

Theoretically these could all happen prior to 9.x's release.

If somehow we got stuck with simpletest support in run-tests.sh, this is not the worst thing in the world, we can try to remove it again for Drupal 10 (possibly with no replacement if 500+ WebTestCase has got a lot closer to zero).

@webchick it's less a dependency on the contrib module doing something, than supporting the contrib module in DrupalCI. Although until you can actually see contrib SimplesTest results in DrupalCI we can't really prove the contrib module works. But yes once it's up and running there's either nothing, or nearly nothing, for contrib modules to do to get their old SimpleTests running.

Unless things have changed since I was last involved in this, there isn't a lot of momentum on making the contrib simpletest happen. I have no interest in maintaining it. @larowlan mentioned being interested, but I'm not sure whether that's still the case.

There's not much momentum, but I don't think there will be until there's a clear decision here (although that decision would be easier if there was more momentum), it's a bit chicken and egge.

mondrake’s picture

My 2 cents: actually there are still some interdependencies between Simpletest and the new core PHPUnit testing that would make a clear cut a bit difficult. IMHO we should try to land #3075608: Introduce TestRun objects and refactor TestDatabase to be testable (see there how the interaction with the simpletest database schema for test results is spread aroud, and how the currently-in-core Simpletest is affected by the patch), and possibly #2905007: Allow run-tests.sh to report skipped/incomplete PHPUnit tests, before a contrib Simpletest could be on its own.

gábor hojtsy’s picture

I stumbled into this question again while reviewing the remaining @deprecated APIs. 26% of all remaining @deprecated uses in core are now in simpletest module. These ones:

core/modules/simpletest/simpletest.api.php: * @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Convert
core/modules/simpletest/simpletest.api.php: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Convert your
core/modules/simpletest/simpletest.api.php: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Convert your
core/modules/simpletest/simpletest.api.php: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Convert your
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0. PHPUnit test
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Access the
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Access the
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Access the
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Access the
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/simpletest.module: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. This function
core/modules/simpletest/src/AssertContentTrait.php: * @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/AssertHelperTrait.php: * @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/BlockCreationTrait.php: * @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/BrowserTestBase.php: * @deprecated in drupal:8.1.0 and is removed from drupal:9.0.0.
core/modules/simpletest/src/ContentTypeCreationTrait.php: * @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/Exception/MissingGroupException.php: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/InstallerTestBase.php: * @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0.
core/modules/simpletest/src/NodeCreationTrait.php: * @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/RandomGeneratorTrait.php: * @deprecated in drupal:8.1.1 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/RouteProvider.php: * @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/SessionTestTrait.php: * @deprecated in drupal:8.1.1 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/TestBase.php: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Instead,
core/modules/simpletest/src/TestBase.php:   * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/TestDiscovery.php: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/TestServiceProvider.php: * @deprecated in drupal:8.6.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/UserCreationTrait.php: * @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0. Use
core/modules/simpletest/src/WebAssert.php: * @deprecated in drupal:8.1.1 and is removed from drupal:9.0.0.
core/modules/simpletest/src/WebTestBase.php: * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Instead,

If we decide not to remove the module, we have a bunch of undeprecation to do. If there are dependencies to removing the module in the first place, that will postpone removing all of those deprecated APIs as well I guess.

mile23’s picture

Technical debt was (mostly) handled in the other child issues of #3057420-55: [meta] How to deprecate Simpletest with minimal disruption, the parent issue here. So the main thing now is the decision about whether or not to un-deprecate or whatever.

As of Drupal 8.9.x (and probably 8.8.x), you can basically do rm -rf core/modules/simpletest/ and still run tests, either through phpunit or run-tests.sh. See #3075490-44: Move simpletest module to contrib

catch’s picture

Issue summary: View changes
gábor hojtsy’s picture

Looking at the steps in the issue summary and discussion above, we still don't know what will happen, and what the impact will be. Only the first item is certain in the proposal and then "either/or, we'll see", etc.

  • Remove simpletest module from Drupal core
  • Open a beta-blocking tracking issue to ensure that contrib modules with simpletests can have them run via DrupalCI (with some or no changes). If that's not complete by beta, we'd need to revert the removal commit or discuss further
  • In a follow-up, decide whether run-tests.sh should support running TestBase-based tests, either as a supported feature, or as a short-term scaffolding while the contrib module is being developed. But leave that support in for now

I agree with @webchick that we need documentation updates too but until we know how will the new setup work, we cannot document it either. To me it feels like if we keep insisting that all impact be defined up front, then nothing will get done, so as long as we can undo what we did if the impact turns out to be bad, I am fine with it.

#3110983: Verify that simpletest tests can be run in contrib, or add simpletest back to core was added as a blocker to beta, so that should ensure that this happens at least before its too late. As a product manager I think that is sufficient since we cannot tell what will the impact be, just have some rough ideas. Also we don't know if the Drupal Association is tracking this as something to do before the beta.

webchick’s picture

I think with #3110983: Verify that simpletest tests can be run in contrib, or add simpletest back to core being a beta blocker, I'm comfortable with this approach, too.

catch’s picture

Status: Needs work » Fixed
Issue tags: -Needs change record

We now have a contrib module, and I just committed #3110862: Remove simpletest module from core to Drupal 9. Contributed modules that have SimpleTest tests can re-enable them on DrupalCI with a short snippet added to drupalci.yml

So... I think we can call this issue complete too!

We can leave #3057420: [meta] How to deprecate Simpletest with minimal disruption open for tracking remaining follow-up like #3112432: Prevent core, stub simpletest module from being installed on new sites which isn't 9.0.x-blocking.

catch’s picture

Fixing credit.

Status: Fixed » Closed (fixed)

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

alexpott’s picture

Issue summary: View changes

I've updated the release note to have specific information for contributed modules that still want to run Simpletest on Drupal 9.

quietone’s picture

Issue tags: -Needs followup

A follow up was asked for in # and that work was done in #3083638: Ensure that simpletest and block_place do not get special core treatement. I am removing the tag.