Problem/Motivation

Follow up from #3089907: standardize docs on how to use the 4 types of test base

We should explain where they need to go for core lib tests too -- core should be documenting itself

Steps to reproduce

N/A

Proposed resolution

TBD

Remaining tasks

File in summary

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Issue fork drupal-3462973

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

smustgrave created an issue. See original summary.

quietone’s picture

bhaveshdas made their first commit to this issue’s fork.

rodrigoaguilera’s picture

Issue summary: View changes
Novice issue reserved for the Mentored Contribution during DrupalCon Barcelona 2024. After the 27th of September 2024, this issue returns to being open to all. Thanks

Look at this commit
https://git.drupalcode.org/project/drupal/-/commit/c70620dc49df2ca821857...

and write similar guidance about where core tests(not in modules) should be located.

ultimike’s picture

Is the following correct for core lib tests?

  • Unit tests: core/lib/tests/Drupal/Tests/Core (Drupal\Tests\Core\)
  • Kernel tests: core/lib/tests/Drupal/KernelTests/ (Drupal\KernelTests\Core\)
  • Functional tests: core/lib/tests/Drupal/FunctionalTests/ (Drupal\FunctionalTests\Core\)
  • Functional Javascript tests: core/lib/tests/Drupal/FunctionalJavascriptTests/ (Drupal\FunctionalJavascriptTests\Core\)
  • Build tests: core/lib/tests/Drupal/BuildTests (Drupal\BuildTests)
  • Test site tests: core/lib/tests/Drupal/TestSite (Drupal\TestSite)
  • Test tools tests: core/lib/tests/Drupal/TestTools (Drupal\TestTools)
  • Nightwatch tests: core/lib/tests/Drupal/Nightwatch

-mike

alexpott’s picture

@ultimike if by core lib tests you mean testing things in core/lib/Drupal/Core then yes. Things are a bit messy though. \Drupal\FunctionalJavascriptTests\Ajax\AjaxCallbacksTest is testing core stuff for example. And \Drupal\FunctionalJavascriptTests\Components\ComponentRenderTest is not about core/lib/Drupal/Component

The unit test directory is probably the most sorted... where tests for core/lib/Drupal/Core live in core/tests/Drupal/Tests/Core and tests for core/lib/Drupal/Component live in core/tests/Drupal/Tests/Component

mattlc made their first commit to this issue’s fork.

ultimike’s picture

Issue tags: +Barcelona2024
ultimike’s picture

Status: Active » Needs review

Tests are passing. Needs review.

-mike

ctrladel’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

larowlan’s picture

Status: Reviewed & tested by the community » Needs review

Requeued tests, added question about another possible enhancement we could add here

smustgrave’s picture

Status: Needs review » Needs work

Probably does need a rebase now, 150+ commits back, not that I think the comments will fail a test.

But there is also an open thread about more improvements and can't see a reason off the top of my head not to.

mattlc’s picture

Status: Needs work » Needs review

Thank you @larowlan & @smustgrave for your comments.

I rebased on 11.x and added missing part for contrib modules in BuildTestBase class.

Moving issue to Needs review.

mattlc’s picture

I'm sorry, I don't know why functional tests do not pass.
As an example : Drupal\Tests\layout_builder\Functional\LayoutSection gives following error :

Layout section formatter access
       ┐
       ├ Behat\Mink\Exception\ResponseTextException: The text "Hello test world" was not found anywhere in the text of the current page.

As it does not relates on this issue, I don't know how to get the whole test pipeline work.

quietone’s picture

@mattlc, thanks for rebasing this. Some of the tests often fail randomly, and this is what you have encountered. We keep track of the random fails and in this issue, #2829040: [meta] Known intermittent, random, and environment-specific test failures. That is where anyone who wants to the challenge of fixing a randomly failing test can find one to work on.

I have restarted the failing tests and they have come back passing this time. You should also be able to restart the tests using the GitLab UI.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Believe feedback has been addressed for this one.

dww’s picture

Status: Reviewed & tested by the community » Needs review

Spotted one problem with existing docs right next to the ones we're adding in core/tests/Drupal/Tests/UnitTestCase.php. Should we fix those here or in a follow-up?

dww’s picture

I should have added: the new docs look great! Big improvement. Thanks for working on this!

mattlc’s picture

Fixed #14 (& #15). CI is running.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @dww! Believe feedback has been addressed.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 6025a14 and pushed to 11.x. Thanks!
Committed f54e0fc and pushed to 11.1.x. Thanks!

  • alexpott committed f54e0fc3 on 11.1.x
    Issue #3462973 by mattlc, ultimike, smustgrave, dww, larowlan, alexpott...

  • alexpott committed 6025a148 on 11.x
    Issue #3462973 by mattlc, ultimike, smustgrave, dww, larowlan, alexpott...

Status: Fixed » Closed (fixed)

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