Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Let's speed up the Field API tests and use DrupalUnitTestBase where possible. Patch upcoming.
Comment | File | Size | Author |
---|---|---|---|
#16 | 1932382-followup.patch | 949 bytes | amateescu |
#11 | field-dubt-1932382-11.patch | 41.51 KB | Berdir |
#11 | field-dubt-1932382-11-interdiff.txt | 813 bytes | Berdir |
#9 | field-dubt-1932382-9.patch | 41.56 KB | Berdir |
#9 | field-dubt-1932382-9-interdiff.txt | 699 bytes | Berdir |
Comments
Comment #1
swentel CreditAttribution: swentel commented4 tests could be converted so far.
Comment #3
BerdirHah, I just had the same idea :)
Converted most of them already, will upload a patch in a few minutes.
Comment #4
BerdirNotes:
- Patch is not based on swentel's patch, created mine in parallel today :)
- Also added a base class, additionally extended from EntityUnitBaseTest (will be renamed in the follow-up patch in #1893108: Convert most entity tests to DrupalUnitTestBase, so will need a re-roll then). Not 100% sure if that is necessary, shouldn't be too much to duplicate and we should probably avoid having too many dependencies in test classes.
- Killed FieldAttachTestBase and FieldItemUnitTestBase in favor of the new base class.
- Added assertRaw/Text helpers for various tests, there are a lot of those calls that should actually be a assertContains(), which we should probably add to TestBase but this allows to keep the impact of this change as small as possible.
- Moved a single test method from CrudTest and TranslationTest to separate test classes, so that the others can become DUBT.
Speed difference is quite impressive because there are a lot of test methods, will post a comparison later when I'm on my desktop.
Comment #5
BerdirBefore:
With patch
I just love DUBT :)
The only reason it's still > 1min is because of the remaining web tests (Field active test, Field form tests (obviously), Field translation web tests and Multilingual fields, that last one is scheduled for removal in the Node NG issue I think.
Keep in mind that I've run those tests sequentally, it won't make such a big difference on the bot.
Comment #7
BerdirFixed the translation tests, they require the node module to be active (and already had those exceptions in the output above, d'oh) and removed the dependency on EntityUnitTestBase.
Comment #8
swentel CreditAttribution: swentel commentedFunny, while going back from London to Belgium this evening, I hacked further on this and did almost the exact same things :)
I've tried ripping apart the formTest merging all methods into one single test method but still getting failures locally, but maybe that's not really interesting for now.
You left a debug statement and that's actually what I had todo as well, this is the missing node entity right ? ;)
Comment #9
BerdirI hoped you would be working on something else but I guess it's good that we ended up with almost the same code, even including the debug snippets :)
Re-rolled without that.
Comment #10
swentel CreditAttribution: swentel commentedTwo small things.
Should be FieldUnitTestBase
I guess we can drop this then.
Comment #11
BerdirOh, forgot to remove that, yes. It's gone now.
Comment #12
swentel CreditAttribution: swentel commentedAlright, let's do this
Comment #13
yched CreditAttribution: yched commentedAwesome !
While working on the CMI patch and battling with tests I was just thinking of the amount of tests that should be moved to DUTB...
Comment #14
webchickYay, faster tests! This should be nice for #SprintWeekend, within which testbot was backed up for 7 hours or so at one point. :P
Committed and pushed to 8.x. Thanks!
Comment #15
webchickx
Comment #16
amateescu CreditAttribution: amateescu commentedUnbreaking HEAD :)
Comment #17
webchickOops. :P
Committed and pushed to 8.x. Thanks!
Comment #18
sunI've added a note about this new base class to #1902098: Introduce DUTB helper methods for working with rendered content + FieldPluginUnitTestBase
Comment #19.0
(not verified) CreditAttribution: commentedUpdated issue summary.