We currently use Drupal\simpletest\KernelTestBase for our kernel tests. This is deprecated and replaced by Drupal\KernelTests\KernelTestBase. As we are still in alpha, we can explore switching to the newer test base.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hussainweb created an issue. See original summary.

hussainweb’s picture

Status: Active » Needs review
FileSize
617 bytes

Right now, we have 44 tests running (including setUp). Let's see if that changes and everything works as expected.

hussainweb’s picture

From the dispatcher log, I see that all the tests are run but the way pass count is calculated is different. This is the pass count for the test on the branch:

20:37:28 Drupal\token\Tests\TokenUnitTest                               5 passes                                      
20:37:28 Drupal\token\Tests\TokenArrayTest                             31 passes                                      
20:37:28 Drupal\token\Tests\TokenNodeTest                              33 passes                                      
20:37:28 Drupal\token\Tests\TokenRandomTest                            17 passes                                      
20:37:29 Drupal\token\Tests\TokenFileTest                              10 passes                                      
20:37:30 Drupal\token\Tests\TokenDateTest                               6 passes                                      
20:37:33 Drupal\token\Tests\TokenCommentTest                           18 passes                                      
20:37:33 Drupal\token\Tests\TokenTaxonomyTest                          36 passes                                      
20:37:34 Drupal\token\Tests\TokenEntityTest                            32 passes                                      
20:37:34 Drupal\token\Tests\Tree\HelpPageTest                          26 passes                                      
20:37:38 Drupal\token\Tests\TokenCurrentPageTest                       38 passes                                      
20:37:42 Drupal\token\Tests\TokenURLTest                               16 passes                                      
20:37:44 Drupal\token\Tests\TokenMenuTest                              56 passes                                      
20:37:47 Drupal\token\Tests\TokenBlockTest                             18 passes                                      
20:37:52 Drupal\token\Tests\Tree\AutocompleteTest                      17 passes                                      
20:37:52 Drupal\token\Tests\TokenUserTest                              41 passes                                      
20:37:52 Drupal\token\Tests\TokenFieldUiTest                           32 passes                                      
20:37:52 Drupal\token\Tests\Tree\TreeTest                              66 passes                                      

This is the log for this patch:

04:58:24 Drupal\token\Tests\TokenRandomTest                             1 passes                                      
04:58:24 Drupal\token\Tests\TokenUnitTest                               1 passes                                      
04:58:24 Drupal\token\Tests\TokenArrayTest                              1 passes                                      
04:58:24 Drupal\token\Tests\TokenNodeTest                               1 passes                                      
04:58:25 Drupal\token\Tests\TokenDateTest                               1 passes                                      
04:58:25 Drupal\token\Tests\TokenFileTest                               1 passes                                      
04:58:25 Drupal\token\Tests\TokenCommentTest                            1 passes                                      
04:58:31 Drupal\token\Tests\TokenTaxonomyTest                           2 passes                                      
04:58:31 Drupal\token\Tests\TokenEntityTest                             2 passes                                      
04:58:33 Drupal\token\Tests\Tree\HelpPageTest                          26 passes                                      
04:58:37 Drupal\token\Tests\TokenURLTest                               16 passes                                      
04:58:39 Drupal\token\Tests\TokenCurrentPageTest                       38 passes                                      
04:58:43 Drupal\token\Tests\TokenMenuTest                              56 passes                                      
04:58:46 Drupal\token\Tests\TokenBlockTest                             18 passes                                      
04:58:50 Drupal\token\Tests\Tree\AutocompleteTest                      17 passes                                      
04:58:50 Drupal\token\Tests\TokenUserTest                              41 passes                                      
04:58:51 Drupal\token\Tests\TokenFieldUiTest                           32 passes                                      
04:58:51 Drupal\token\Tests\Tree\TreeTest                              66 passes                                      

All tests that use KernelTestBase have been reduced to 1 or 2 passes (which is the number of the test methods, not asserts). There are 9 such tests which account for the difference between 44 tests passed earlier and 35 now. This can be explained by setUp not counted anymore. You can see this at the job page for the test on the patch. The method setUp is not listed anymore for all kernel tests.

While this looks good to go ahead, I am thinking that we should actually see the tests work properly.

hussainweb’s picture

I am breaking a couple of tests to see the effect. There should be two failures.

Status: Needs review » Needs work

The last submitted patch, 4: use_the-2647884-4.patch, failed testing.

hussainweb’s picture

Status: Needs work » Needs review
FileSize
702 bytes

The additional failure is for entity test failure. I am not sure why it gives that error but I have seen this a few times. I will leave this for review anyway.

Berdir’s picture

Status: Needs review » Needs work

Hm, not sure why this works. phpunit tests must be moved to tests/src, and the namespace has to change. See Drupal\Tests\file\Kernel\FileItemValidationTest for an example.

hussainweb’s picture

Status: Needs work » Needs review
FileSize
7.62 KB

I see. I am attempting that here in the attached patch. I am also removing the prefix 'Token' from the filenames here as the classes are namespaced with token anyway and it appears that way in test results here on d.o and in simpletest as well.

Status: Needs review » Needs work

The last submitted patch, 8: use_the-2647884-8.patch, failed testing.

hussainweb’s picture

Status: Needs work » Needs review
FileSize
427 bytes
7.66 KB

Oops...

hussainweb’s picture

For reference, here is the log and pass count from the dispatcher:

09:19:31 Drupal\Tests\token\Kernel\ArrayTest                            1 passes                                      
09:19:31 Drupal\Tests\token\Kernel\RandomTest                           1 passes                                      
09:19:31 Drupal\Tests\token\Kernel\UnitTest                             1 passes                                      
09:19:31 Drupal\Tests\token\Kernel\FileTest                             1 passes                                      
09:19:31 Drupal\Tests\token\Kernel\NodeTest                             1 passes                                      
09:19:32 Drupal\Tests\token\Kernel\DateTest                             1 passes                                      
09:19:33 Drupal\Tests\token\Kernel\CommentTest                          1 passes                                      
09:19:39 Drupal\Tests\token\Kernel\TaxonomyTest                         2 passes                                      
09:19:39 Drupal\Tests\token\Kernel\EntityTest                           2 passes                                      
09:19:40 Drupal\token\Tests\Tree\HelpPageTest                          26 passes                                      
09:19:41 Drupal\token\Tests\TokenURLTest                               16 passes                                      
09:19:44 Drupal\token\Tests\TokenCurrentPageTest                       38 passes                                      
09:19:47 Drupal\token\Tests\TokenMenuTest                              56 passes                                      
09:19:50 Drupal\token\Tests\TokenBlockTest                             18 passes                                      
09:19:53 Drupal\token\Tests\Tree\AutocompleteTest                      17 passes                                      
09:19:58 Drupal\token\Tests\TokenUserTest                              41 passes                                      
09:19:58 Drupal\token\Tests\TokenFieldUiTest                           32 passes                                      
09:19:58 Drupal\token\Tests\Tree\TreeTest                              66 passes                                      
Berdir’s picture

Status: Needs review » Fixed
d8/modules/token(8.x-1.x)$ ../../vendor/bin/phpunit -c ../../core/ .
PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

...........

Time: 32.9 seconds, Memory: 10.00Mb

OK (11 tests, 163 assertions)

Nice. Committed. @dawehner will be happy ;)

  • Berdir committed 30953c7 on 8.x-1.x authored by hussainweb
    Issue #2647884 by hussainweb: Use the Drupal\KernelTests\KernelTestBase...
dawehner’s picture

Nice. Committed. @dawehner will be happy ;)

I fear you are right.

Status: Fixed » Closed (fixed)

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