Problem/Motivation

We have test classes with many test methods that makes the testing slow.
Methods are not parallelisable and the setup happens again and again. A class is fully sequential.

Proposed resolution

Either split the class into multiple or make a single testmethod that calls such as...

function testCollection() {
 doTestContinuousJobForm();
 doTestAddContinuousLink();
 ... and many more
}

As a result the setup only happens once for testCollection.

Comments

miro_dietiker created an issue. See original summary.

miro_dietiker’s picture

BTW latest test time currently is took 7 min 8 sec on d.o infra and locally in full around 30mins... :-)

berdir’s picture

Specifically, we should split tests by dependencies. For example, TmgmtUiTest currently depends on tmgmt_content and ckeditor for a single/few tests each. The combination of those two adds around 6 additional modules to each test, that need to be enabled and installed.

Move continuous and ckeditor dependant tests both to a separate class.

berdir’s picture

Category: Task » Bug report
Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new21.99 KB

The ckeditor dependency was actually completely bogus, we didn't rely on this in any way.

Moved all continuous tests to a separate test class. Cleaned up the test a bit so we need fewer logins.

Also fixed the random fail that #2668384: Validate buttons don't show a success message introduced because randomString() sometimes spits out tags ;) That makes this a major bug.

miro_dietiker’s picture

+++ b/src/Tests/TMGMTUiContinuousTest.php
@@ -0,0 +1,210 @@
+ * Contains Drupal\tmgmt\Tests\TMGMTUiTest.

Almost.

Looks kinda good, but that diff is really hard to review. :-)

berdir’s picture

Yes, this is impossible to review, I know.

Fixed the @file, core actually recently changed the coding standard to no longer require that: #2304909: Relax requirement for @file when using OO Class or Interface per file

The previous patch was already 2m faster, 5 instead of 7. This moves another method, testReview(), to the new TmgmtUiReviewTest. Also removed the ckeditor dependency there.

Will commit once green, that's enough for now.

berdir’s picture

Title: Make tests faster » Make TmgmtUiTest faster by splitting it up
Status: Needs review » Fixed

Another 20s or so faster, down to exactly 5m. And now LocalTranslatorTest is the slowest test, so making this one faster for now doesn't bring more benefits for testbot. We should probably open another one for LocalTranslatorTest, maybe also the content entity UI test.

Committed.

  • Berdir committed cede0d7 on 8.x-1.x
    Issue #2685049 by Berdir: Make TmgmtUiTest faster by splitting it up
    

Status: Fixed » Closed (fixed)

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