Problem/Motivation
We want to get rid of simpletest.module in Drupal 9. We want to prepare the latest Drupal 8 development branch as much as possible before opening the Drupal 9 development branch (see #2608062: [META] Requirements for tagging Drupal 9.0.0-alpha1). Therefore we need to convert all web tests to BrowserTestBase or UnitTestBase or KernelTestBase and deprecate WebTestBase.
Proposed resolution
1) Convert a small part of Drupal core web tests to Browser tests to get them battle tested. See all the conversion child issues that have been opened here before 2016-Sept-01.
2) Implement a backward compatibility layer as AssertLegacyTrait used by BrowserTestBase. Ideally a test conversion should only be the change of the namespace and used base class. Everything else should be covered by backwards compatible methods as far as possible/reasonable.
3) Prepare one big bang patch of test conversions in #2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits. Commit it during code freeze of the next Drupal minor release (likely March 2017 for 8.3).
4) In the meantime open child issues to convert web tests for each core module. While doing so we should also check if the test cases actually require a browser or can be converted to unit/kernel tests. They will be postponed until #2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits is committed.
Instructions for converting a Simpletest web test
- Read https://www.drupal.org/phpunit and all subpages, especially https://www.drupal.org/node/2783189 .
- Do not bulk move all the test files but move and work on one test at a time.
- Move the test file to a tests/src/Functional folder in the module.
- Rename the namespace, make the class extend BrowserTestBase and fix the use statement.
- If there is a test method which does not perform any web request (for example no ->drupalGet() or ->drupalPostForm() calls) then that method should be extracted to a unit test or kernel test. $this->setRawContent() generally means the test should be converted to a Kernel test
- $this->drupalPostAjaxForm(); means the test should be converted to a Javascript test. There most likely already is an issue for it, see #2809161: Convert Javascript/AJAX testing to use JavascriptTestBase
- Otherwise try to change as little as possible in the converted web test. Do not get tempted to "improve" or "tidy up" the tests - the conversion should be easy to review with only the minimum necessary changes. Further cleanup can be done in a follow-up issue.
- Run the single test file with phpunit (replace the path with the file you converted):
cd core ../vendor/bin/phpunit modules/help/tests/src/Functional/HelpTest.php --stop-on-failure
- Regularly upload a patch to see if the tests pass on the testbot as well.
- If the conversion starts to involve complex changes, please reach out to people or search the other conversion issues. Occasionally it can be helpful to skip tricky tests, in which case update the issue summry stating which tests are not converted yet.
- Create follow-up issues to deal with blockers so that progress can continue with converting the majority of tests in a module. Update the "Conversions blocked by another" section on this page.
- Any TestBase or Trait which is in the old /src/Tests/ location should remain there and be deprecated. Copy the TestBase or Trait file into the new location and alter the tests to use the new version. The deprecated class must not "use" the newly-moved class, but remain exactly as it is. Create a change record for the deprecation notice - one CR can cover all deprecations within a module.
Hints and Tips
- Simpletest allowed typecasting of elements. BrowserTestBase does not. Instead of (string) $element use $element->getText() or $element->getHtml();
- Views tests need the new constructor format with
$import_test_views = TRUE
as the first parameter in the setUp() method. - Attributes are fetched with
$item->getAttribute('value');
now, previously it was$item->value
or$item->attributes()->value.
- Not all legacy assertion methods are implemented yet, for example you may get
Fatal error: undefined function assertNoLink()
. Check #2750941: Additional BC assertions from WebTestBase to BrowserTestBase to borrow from there.
Remaining tasks
Resolve all the child issues. Convert web tests in child issues per module/component in Drupal core.
Issue creation
Please add the tag 'phpunit initiative' to every issue and add the issue to the correct Component (if it's a test for the comment module, add it to comment.module).
Remaining simpletests
- None
Check http://simpletest-countdown.org/simpletestcount/simpletests
Progress report
Want to know how we are doing? Check: http://simpletest-countdown.org
API changes
Simpletest and WebTestBase will be deprecated.
Comment | File | Size | Author |
---|---|---|---|
#34 | browsertest-convert.php_.txt | 1.12 KB | klausi |
Comments
Comment #2
catchJust a note when doing this we should also consider whether the test would be better as a kernel or unit tests - neither of which we had for the first several years we were adding web tests.
Comment #3
klausiGood idea.
Comment #4
dawehnerNot sure whether this is the best idea. Conceptual similar tests, aka. tests with similar scope, is often a better idea, because its easier to figure out what is going on.
Comment #5
catchYes that gets tricky as well. There's a fair bit of duplication between the test coverage for modules like node/taxonomy and entity system tests. Similarly between tests in Views module vs. tests in views-data-providing modules. That's no fun to pick apart but would be good if we did.
So issues by theme, then sub-issues for those sounds good.
Comment #6
jibranYes yes yes! but unfortunately it is not as straight forward as KTBNG conversion. I'm still struggling to convert DER WTB tests to BTB #2469609: Convert all WebTestBase to BrowserTestBase.
We, as Drupal developers, have to change our mentality about browser base testing. We don't have to think page as a giant html string or form as an giant array to pass to a function. We have to write tests in a way we test them on a browser. Like visit a link, click a link, click a form element. Form is not big piece of array we have to set. Input of the fields should be set in a way we set them while browsing.
For a start BTB::submitForm() is super flawed.
Exhibit A from DER #2712545: Field setting form is broken after 2412569 http://cgit.drupalcode.org/dynamic_entity_reference/tree/tests/src/Funct... and http://cgit.drupalcode.org/dynamic_entity_reference/tree/src/Tests/Dynam...
In WTB
BTB equivalent
Comment #7
dawehner@jibran
Can you elaborate why we have to? There is
submitForm()
for this kind of work.Comment #8
jibranAnd then there is a way we assert stuff on the page in WTB and BTB.
For example, before #2711963: Modernized ToolbarIntegrationTest
ToolbarIntegrationTest.php
was asserting stuff like WTB, treating page as giant piece of html string, and after #2711963: Modernized ToolbarIntegrationTestToolbarIntegrationTest.php
has a nice flow to it.I'm still trying to find a perfect balance with this apporoch as well in #2702233: [backport] Add JavaScript tests for Form API #states: required, visible, invisible, expanded, checked, unchecked. How to assert stuff on a page with form? Should we add
FormWebAssert
likeWebAssert
or not, as pointed in #2702233-30: [backport] Add JavaScript tests for Form API #states: required, visible, invisible, expanded, checked, unchecked? Or we shouldn't do this at all as suggested in #2702233-25: [backport] Add JavaScript tests for Form API #states: required, visible, invisible, expanded, checked, unchecked.Comment #9
jibranShort answer BTB is designed to work with different type of drivers and
GoutteDriver
sets element differently thenPhantomJSDriver
.Comment #10
klausiFiled #2735045: Convert StandardTest to BrowserTestBase by introducing a AssertLegacyTrait and new assertions on the WebAssert.
Comment #11
jibranComment #12
mpdonadioGiven that KTB/UTB tests typically live in a different namespace than WTB tests, how stupid of an idea would it be to do this as
1. Write equivalent KTB/UTB for existing WTB classes and similar tests that can run in a simpler space.
2. Make old tests as @deprecated
3. Run with both sets of tests for a while and see if we have regressions that one test catches that the other doesn't
4. Remove the @deprecated test before 9.0.0.
My fear is that that WTB has some implicit side effect coverage going on, and if we simplify (for lack of a better term) we may actually be losing some test coverage.
(this thought is somewhat half baked, but I have click save and head to a meeting)
Comment #13
dawehner@mpdonadio
I think this could be an interesting strategy for some subset of the tests. Maybe some which are really side wide.
Comment #14
klausiThat was fun: #2735199: Convert web tests to browser tests for help module
I had to implement many assert*() methods on BrowserTestBase and made the following decisions:
* Mink does not support custom messages for the built in assertions. So I just ignore a potential $message parameter in that case.
* I completely removed $group support for assertions. I don't think it makes sense to keep them, I never needed that when working/debugging with Simpletest.
The good news is that I had to change very few things in the web tests of help module to make this work. I'm hopeful that this can be a moderately easy conversion process.
We should probably create dedicated test coverage for all the new stuff on BrowserTestBase, I was just lazy for now to quickly see what we actually need.
Comment #15
klausiNext one: #2736109: Convert web tests to browser tests for action module.
The porting process is very straight forward, no pain points there - just copying and modifying all the helper methods from WebTestBase.
Comment #16
klausiGood news regarding test execution time: I was worried that BrowserTestBase would take longer to execute the same test, but that is not the case.
Simpletest:
PHPUnit Browsertest:
The converted Browser test is 1 second faster! I assume because of the complicated simplest module bootstrapping we have to do in run-test.sh.
Comment #17
larowlanSweet, and the second one includes all of phpunit's discovery processes, which are high for a single test, but for a full-testsuite or group are lower
Comment #18
dawehner@larowlan
Are you sure this is not triggered by less tests at the moment? What would happen if we have the same amount of tests as we have with simpletest now?
Comment #19
benjy CreditAttribution: benjy at PreviousNext commentedI don't find the debugging experience as good with BTB as WTB, the UI is very helpful for finding the rendered HTML closest to the failure or request you want to inspect. IMO, we should fix that before we replace everything with BTB.
Comment #20
klausiI think the debugging experience is better with PHPUnit and BrowserTestBase. Once you have copied core/phpunit.xml.dist to phpunit.xml and enabled BROWSERTEST_OUTPUT_DIRECTORY + configured printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter" you get very useful links when running the test.
When a test fails phpunit stops execution immediately, so the last printed link to the HTML response from your test is the place where it broke. No fiddling around in the Simpletest UI and desperately searching for the line where it actually broke and what might be the bad response. For me that is a lot better than Simpletest UI.
Sure - there is still room for a lot of developer experience improvements, but I think we should not hold up conversion to BrowserTestBase because of that. Can be parallel efforts.
Comment #21
dawehnerI agree, this is something we really need to teach people. We fail early, because in simpletest, further failures could be totally misleading once the system was in a broken state at some point.
Oh yeah totally. Please open issues if you have ideas!
Comment #22
larowlanSnagging #2737805: Convert web tests to browser tests for forum module
Comment #23
larowlanFound in #2737805: Convert web tests to browser tests for forum module that submitting admin/modules page to uninstall/install a module kicks out the logged in user. That one will be fun to debug...
Comment #24
dawehnerAdded a random related issue: #2738567: Add test trait for drupalGetTestFiles and drupalCompareFile
Comment #25
klausi#2735045: Convert StandardTest to BrowserTestBase by introducing a AssertLegacyTrait and new assertions on the WebAssert could use a review, it sets the foundation for all the other conversion issues.
Comment #26
alexpottWe need to fix #2575725: Run PHPunit tests one at a time via UI to avoid exception when selecting too many before doing too much BTB conversion since the fact they take some time to run means that the approach of trying to run all the PHPUnit tests first and in the form submission is quite flawed.
Comment #27
dawehnerAdded a new subissue for more assertions: #2750941: Additional BC assertions from WebTestBase to BrowserTestBase
Comment #28
klausiWe are still in the process of bringing BrowserTestBase fully up to speed with the deprecated WebTestBase, here is another issue that could use a review: #2751875: BrowserTestBase must enable cache tags in responses
Comment #29
dagmarI would like to help with the dblog tests conversion, I been working on several issues of this module for the last 2 months and I feel quite comfortable to help with this task. However, reading the comments, and specially #6 it seems this is not easy to implement.
I think it could be a good idea to update the summary issue to reflect what are the main changes need to be made in order to convert a WebTestcase into Unit or Kernel Test base.
So in the section "Proposed resolution" in addition to "create child issues" we should have more details regarding when a Kernel Test applies, or when a Unit test applies. I'm pretty sure this documentation already exists but we need links to this docs, otherwise I don't see how other people can join to help in this plan.
Comment #30
klausiAdded instructions.
We are not quite there yet for very smooth conversions, since we are still uncovering missing legacy methods.
Also https://www.drupal.org/phpunit does not even mention BrowserTestBase, a section we will have to write.
And https://api.drupal.org/api/drupal/core!core.api.php/group/testing/8.2.x is outdated, we need to replace the Functional part instructions with BrowserTestBase and JavascriptTestBase.
So I think there are no real docs yet - we should copy https://drupalcommerce.org/blog/45322/commerce-2x-unit-kernel-and-functi... to a drupal.org doc page.
Thanks for helping!
Comment #31
klausiI updated the docs at https://www.drupal.org/node/2116263 now to tell you how to run browser tests.
Comment #32
dagmarAmazing. Thanks!
Comment #33
dawehnerThanks a ton klausi!
Comment #34
klausiI created a script to help convert web tests to browser tests for a core module, see attachment. Copy it to the root of your Drupal 8 checkout and rename it to browsertest-convert.php. Usage:
... will convert all web tests in node module to browser tests with primitive string replacements, so that you don't need to do the easy work manually.
@todo This probably does not work with web tests in subfolders.
Comment #35
klausiComment #36
dawehnerI still believe we should go through the individual tests and identify places which could be rather a kernel test.
Comment #37
klausiYes, of course, this script only helps you get started.
Comment #38
klausiYay, #2750941: Additional BC assertions from WebTestBase to BrowserTestBase was committed! That is a big win of legacy compatibility functions, so that it is easier to convert an old web test.
Ideally our conversions should look as trivial as this: #2755991: Convert web tests to browser tests for telephone module (please review!)
A general note on conversions: we should touch the test cases as little as possible if they stay as browser test to make the conversion easier to review. We can convert the deprecated assert function calls later, our goal right now is to get off of SimpleTest as quickly as possible.
Comment #39
pfrenssenWhen adding new, untested, assertions to
AssertLegacyTrait
, please double check the visibility. If a method is added that is public instead of protected it will cause fatal errors in real life BrowserTestBase implementations in contrib.See for example: #2744089: Fix visibility of AssertLegacyTrait::assertLink(), #2752315: Fix visibility of AssertLegacyTrait::assertNoEscaped(), #2757139: Fix visibility of AssertLegacyTrait::buildXPathQuery().
I personally think the AssertLegacyTrait should not be included by default in BrowserTestBase at all, instead it should be included in the converted legacy tests.
Comment #40
klausiFixed script link.
Comment #41
klausiWhile working on #2756059: Convert web tests to browser tests for language module I discovered smaller issues that we should do as a next step to speed up phpunit conversions:
* #2759853: Create ConfigTestTrait to share code between PHPUnit and Simpletest
* #2759859: Implement getDrupalSettings() on BrowserTestBase for checking JS settings
* #2759863: Implement request header support for drupalGet() on BrowserTestBase
* #2759879: Additional assertions for WebAssert and AssertLegacyTrait, part 2
Please review!
Comment #42
benjy CreditAttribution: benjy at PreviousNext commentedThis is great when you have a nice fast unit test, run fail, fix and run again, great. But when you're talking about a web tests that can run for 3-10minutes, if it fails after 5 minutes on an assertion, then you run it again for another 5 minutes and it fails on the next line, that's just annoying. Sometimes it's better to know all the failures so you can attempt to fix more than one at a time. stopOnFailure="false" would be a better default for longer running browser tests IMO.
The problem here is, we seem to favour doing conversions and getting to the new shiny rather than adding the polish it needs. The verbose output only works for drupalGet() and drupalPost(), which is ironic given one of the benefits of BTB is familiar API's (mink) but if you use Mink directly, you don't get any verbose output. Also, other BTB functions like clickLink() do requests without capturing verbose output. IMO, we need a reliable way to capture output whenever a request happens in the test.
Comment #43
klausiThanks for the feedback.
When an assertion fails in PHPunit then an exception is thrown, so there is no way to continue with the test. The
--stop-on-failure
configuration only helps you when running multiple tests. Then it will stop on the first test that fails.Verbose output: we already hacked the HTTP client for mink to catch errors in #2664150: Expand BrowserTestBase with error handling support, so we should do something similar to always generate verbose output.
Comment #44
benjy CreditAttribution: benjy at PreviousNext commentedAhh, i see that's a shame.
How come we override the client rather than the driver? They look pretty similar looking at them.
Comment #45
klausiOpened #2763401: PHPunit browser tests should log all Mink requests to discuss and implement HTML output logging for all requests, let's continue there.
Comment #46
dawehnerJust to point out the failure discussion ... when there is a failure, anything could happen afterwards, much like you can prove anything when you start with "0 = 1". Given that the only way to fix tests properly is to fix the first failure.
Comment #47
benjy CreditAttribution: benjy at PreviousNext commentedSure anything can happen but most of the time you can infer quite well what went wrong. Take for example the following code, it would be helpful to see all failures, for example if the array was reversed vs being in a random order, it could help you find the issue right away. There are many situations like this imo.
Comment #48
dawehnerMh fair, but its seriously something the design of PHPUnit will never be able to support. The alternative for this usecase though would be to use something like the following:
Comment #49
klausi@benjy: continuing tests after the first assertion already failed can be a huge time waster. Since anything can happen after that failed assertion a PHP fatal error is likely in a completely different location, distracting you from the first fail. Or worse: our testbot is not even capable to display the failed assertions when a PHP fatal error has happened later. If you cannot reproduce that fail locally you need to start with weird robustness fixes to prevent the fatal error from happening just to see which assertion failed. Example: MigrateUpgrade7Test which I have to modify to even get an idea what went wrong on the testbot in #2712647: Update Symfony components to ~3.2.
So I think stopping a test case as soon as the first assertion fails is a very good thing in PHPUnit.
Comment #50
mpdonadioI pretty strongly disagree with #49 and #46. It really depends on what you are doing.
Within a test, if doing something sequential, then I can see stopping at the first failure. But, in other cases, seeing all the fails can be beneficial. If feeding a test with a data provider, then I want to see all of the fails at once: I can likely address several of the fails at once. I was working on an integration test last night, where seeing all of the fails at the same time pointed to the true cause of my problem.
When doing a full test run (which outside of just the UnitTestCase is mostly infeasible on a local machine) aborting after the first fail (even within a particular test) will probably end up with more full runs on the bot.
I think evaluating whether we can downgrade tests, which will shorten runs, will be the biggest benefit both for local dev and load on the bots.
Comment #51
Mile23Can we make sure that's in the docs somewhere if it isn't already?
Comment #52
claudiu.cristeaNew issue/bug that blocks some test conversions #2767655: Allow WebAssert to inspect also hidden fields.
Comment #53
claudiu.cristeaI provided a patch that is green in #2767655: Allow WebAssert to inspect also hidden fields. That needs review.
Comment #54
anavarre#51 - Hopefully #2760905: The documentation should be more explicit about PHPUnit requesting the webserver user to perform all functional tests is enough?
Comment #55
claudiu.cristea#2757007: Convert all book web tests to BrowserTestBase is ready for review.
Comment #56
xjmI posted #2770549: [plan] Discuss desired API and test suite following deprecation of SimpleTest to help address some of the architectural and long-term questions without derailing the conversions.
Comment #57
klausi@Mile23: yes, this is mentioned in the documentation at https://www.drupal.org/node/2116263
What we still need for documentation: how to write browser tests, similar to https://www.drupal.org/simpletest-tutorial-drupal7 - same for javascript tests.
Comment #58
xjm@klausi agreed, that would be very valuable.
Comment #59
xjmHmm, also, -1 for doing this on a per-module basis. I'd recommend trying #2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits and seeing what shakes out there, not only in terms of the API but also in terms of DrupalCI compatibility. E.g. there is a recent random fail in forum tests that may be caused by a difference between SimpleTest and BTB, but when it's on a per-module basis it becomes difficult to debug or track down. Or, see https://www.drupal.org/pift-ci-job/390573
And honestly I'd also kind of feel we need to have the documentation mentioned above before we do conversions, because we've missed the mark on the documentation gate so far for BTB. I wouldn't yet recommend reverting the 3 or 4 per-module conversions that have gone in, but it is something we might need to consider.
Comment #60
dawehnerI'm all for not backporting actual test changes, this is not adding that much value.
Backporting test framework changes though have a couple of big advantages:
Comment #61
claudiu.cristeaFound a bug in a previous conversion #2773389: BrowserTestBase::getTextContent() wrongly returns the raw content.
Comment #62
claudiu.cristeaYet another one that is required by more than one test conversion #2773733: Fix AssertLegacyTrait::assert(No)Text to handle html encoded strings (part 3). So I opened a dedicated issue.
Comment #63
benjy CreditAttribution: benjy at PreviousNext commentedRan across this today https://elliot.land/7-reasons-to-use-concise-on-top-of-phpunit thought it might be interesting following on from the convo in #47, it provides a verify() option so it doesn't quick fail the test. Also, the tool claims to have a better CLI/runner than PHPUnit. Could be worth an issue to discuss if anyone is interested.
Comment #64
dawehner@benjy
Sure open up an issue, but its unrelated with BTB, because concise is on a lower level.
For example when I review those patches I actually look at the converted tests and see whether they could be fundamentally approved.
Comment #65
Mile23I suggest beginning by converting per test base class.
In the entire hierarchy of
WebTestBase
, there are 930 classes. 403 of those are direct subclasses. 31 are*TestBase
classes, which means ~500 subclass from test bases. 31 issues for 500 classes.Here's our first round: Make an issue for each of these test base classes. Convert the base class, pick up the pieces on the subclasses.
Comment #66
BerdirPer base class is something that we also did more or less in kernel tests although I often did more than one there except for the really big ones. I think that does work fairly well.
One thing there is that contrib/custom code might also extend from those (extending from others is also possible but less likely. I sometimes do that for different backends, e.g. redis queue testing). what we did for kernel tests is mostly keeping the old base classes around, so contrib has some time to shift from the old to the new base classes and doesn't break every time we commit a new patch.
Comment #67
xjmI actually would like to get as close as possible to making the conversion of core a single, scheduled change, that we would do during a beta or RC phase, or immediately when a minor branch opens. Edit: The work already going on to add BC layers will work well with that approach.
(Editing to remove comments from the wrong issue, sorry).
Comment #68
claudiu.cristea@xjm, this is not possible for some of the tests, especially for those that are testing JS features in forms by setting hidden fields. This is because of Mink architecture that tests everything from the perspective of a human. An example is #2757007: Convert all book web tests to BrowserTestBase and I'm sure we'll find others.
Comment #69
xjmWe should try to get as close to possible to converting the whole test suite in one massive, scheduled patch with a single scope once we have provided as much BC as possible, but it may be a few massive patches (one for the simplest scope to just change which class is extended, another for a specific change throughout core that is impossible to provide a BC layer for, another different change that is impossible to provide a BC layer for, etc). It would be during a beta/RC phase or immediately after a new minor branch is opened. This mitigates the intermittent small disruptions and makes it something we can announce in advance and plan for, once we're sure the documentation and the DrupalCI support and the BC layer and everything else is in really great shape.
There are a number of reasons for this, many outlined in https://www.drupal.org/core/scope. This was also pointed out in #4 on this issue by @dawehner. A few specifics that are of concern for me in this case:
Comment #70
xjm@claudiu.cristea, I crossposted, but hopefully the latest comment clarifies. Thanks!
Comment #71
xjmI'd modify @Mile23's suggestion as follows:
We'd stack a series of a few large but individually conceptually simple issues together as a scheduled conversion, and then possibly work out the stragglers, rather than the other way around.
Comment #72
Mile23@xjm #71.1: If #2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits isn't just exploratory but is supposed to be part of a process it really needs an IS update for how it fits in.
Agreed on stacking large but simple issues, but I'm not sure what the atomic unit is here. We'd want to be able to review each piece without going insane. :-)
If we care that contrib is using our simpletest base classes, then we can make a BTB version of the base classes alongside the WTB ones, with deprecation info. We leave the WTB ones alone and modify the code core uses.
OTOH, there's already a bunch of work done in conversion per-module, so perhaps while the documentation is coming together we could grab those? We could postpone any issue for a module that defines a test base class.
Comment #73
xjmThanks @Mile23!
The work so far in the per module issues is definitely still useful; it gives us diffs for the comprehensive change record/conversion docs and proves BC layers that immediately work across core and not just in that module. I just don't think we should actually commit them individually at this time.
Comment #74
dawehnerPer module patches also help with reviews, as maintainers of the particular modules can review their space.
Could we agree on the following approach maybe? @xjm
This gives quick progress now while still adding the BC layers we might want.
Comment #75
mpdonadioHaven't seen this in any of the related issues. A lot of tests have assertions like this:
Has a precedence been set yet for how to handle this pattern ($this->url isn't in BrowserTestBase)? Or do we need to add $this->url?
Comment #76
neclimdulSeems it would be better to assert before the post that no items in the database matches the posted criteria then load the item using the same criteria afterwards. You can then assert both that the entity was created and you have the id you're looking for to assert the message on the page.
Comment #78
Eric_A CreditAttribution: Eric_A commentedComment #79
xjmComment #80
catchComment #81
klausiLadies and gentlemen, I proudly present: the PHPUnit browser test tutorial doc page! https://www.drupal.org/node/2783189
Please improve as you see fit :)
Comment #82
dawehnerThanks so much klausi++
Comment #83
larowlanThanks @klausi. Made some minor changes. Great work.
Comment #84
klausiFiled #2784263: Move WTB::assertCacheContext() to AssertPageCacheContextsAndTagsTrait.
Comment #85
dawehnerOpened #2784159: Remove CURL timeout in BTB for some better debugging experience
Comment #86
klausiOpened #2784427: Browser tests: Plain page text contains CSS styles and JS settings.
Comment #87
klausiOpened #2784537: Add legacy assertFieldByXPath()/assertNoFieldByXPath() method for browser tests.
Comment #88
dawehnerSmall subissue: #2787923: Add a getDrupalSettings() method to JavascriptTestBase
Comment #89
xjmSo glad to see the handbook page! Thanks @klausi!!
The summary could definitely use an update here, for the handbook page, my comment in #69 and the discussions we had after it, etc.
Comment #90
larowlanFound one that should have been a kernel test, #2791955: Convert \Drupal\node\Tests\NodeAccessTest to a KernelTest - reviews welcome
Comment #91
klausiLabelling this as a core initiative now :-)
@xjm: I think we cannot do one big patch now, because we are still in the phase where we iron out problems with BrowserTestBase. We can only fix problems while we convert smaller parts of Drupal core and actually commit them. For example #2737805: Convert web tests to browser tests for forum module showed that we have random test fails with browser tests, but we would have never uncovered that if we had not made the core commit and reverted it. We cannot avoid this painful phase where we figure out the edge cases and shortcomings of our current browser tests. We have to convert small parts of Drupal core to get it battle tested.
So I propose that we continue with the conversion issues that are open right now, make them ready and commit them to core. Any conversion issue that is opened after 2016-Sept-01 is postponed. Then we make #2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits ready as big patch. There is a risk that we will have to do endless rerolling in that issue and realistically it will not be ready by Oct 2016. So we will have to postpone it to March 2017 (when we are in code freeze again for 8.3). That will frustrate me and I will simply keep working on other postponed conversion issues.
Actually I would prefer to keep going with incremental conversions because people already have to live with 2 test systems in Drupal core. Seeing the conversion work committed sooner to core also motivates contributors.
Anyway - let's plan for the big bang patch approach for now and if we are faster as expected with the preliminary conversions then we can re-plan if necessary.
Comment #92
chx CreditAttribution: chx at Smartsheet, Migrate Rocks commentedIf this is an initiative it surely would be nice if "each test runs in a completely new Drupal instance, which is created from scratch for the test" -- would get an option to not do that. Exercising an existing site is helpful and simpletest 7.x-2.x had an option for that while I know that's contrib, well, there's no place to put that now as simpletest is being removed and many contrib was core'd in D8.
Comment #93
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedWe are already using the feature described in #92 with BTB and JTB for testing client projects by copying the whole setUp method, not calling parent::setUp and omitting anything which installs drupal or assumes a new environment. A very handy feature which would be fantastic if it was made more accessible and easier to get started with.
Comment #94
klausi@chx and @Sam152: that would make sense, can you open a feature request for that and link it here?
Comment #95
chx CreditAttribution: chx at Smartsheet, Migrate Rocks commentedI can't but I am sure @Sam152 can.
Comment #96
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedSure.
Also credit to @larowlan for doing the legwork to make this possible for our internal projects. Probably worth getting your thoughts on how we could achieve this.
Comment #97
dawehnerSmall little other issue: #2793451: Provide a debug helper to output the current HTML page
Comment #98
dawehner@chx
Please next time just open up a new issue, as this kind of stuff derails other discussions. Thank you!
Comment #99
dawehnerAnother related issue #2296635: Evaluate performance impact of limiting test discovery to *Test.php filename suffix
Comment #100
chx CreditAttribution: chx at Smartsheet, Migrate Rocks commentedBefore we ditch simpletest (which was running *.test files until very recently) we need to solve the following: When developing a test, you run
phpunit path/to/test.php
and the test passes but there is no warning the test won't be picked up when running a group of tests because it's not called *Test.php, because it violates PSR0/4 or whatever else it needs.Alternatively we need to ditch phpunit and use a modern framework. Fantasy.
Comment #101
klausi@chx: test discovery will not be a blocker to further adapt PHPUnit. This is also not PHPUnit's fault, if you think our discovery needs improving please look at #2605664: [Needs change record updates] Align TestDiscovery and bootstrap.php's non-permissive loading of PSR-4 namespaces for traits or open a new issue if that one does not match.
PHPUnit is the most widely used test framework in PHP, any particular alternative you have in mind?
Comment #102
dawehnerNote: #2296635: Evaluate performance impact of limiting test discovery to *Test.php filename suffix actually fixes the problem described by chx by failing in case a test class doesn't line up the with the expectations.
Comment #103
dawehnerSo well, can someone please decide the way forward?
IMHO going on with individual issues is still not a bad idea, because, well, we have found a tons of things along the way, while being able to work in parallel. Unlike codestyle issues, where the outcome is sort of predictable, its not on those conversion issues IMHO.
But well, whatever we do, please @xjm, @alexpott decide on something, because this is obviously better than waiting.
Comment #104
Mile23phpunit --filter MyTest
does full discovery and then filters with a regex. It's a bit slower but you can do sanity check with it when you add the test file.Comment #105
neclimdulFor my understanding is this a complaint against phpunit or how Drupal run's tests? The described behaviors seem to be consistent with how tests work in simpletest unless I'm missing something.
Comment #106
catchI've opened #2794285: [meta] Add backwards compatibility layer to browsertestbase to ease conversion from webtestcase to track the bc layer for webtestbase - please add additional child issues to that if you know of them.
Comment #107
klausiYesterday in IRC we discussed a bit with alexpott because he has postponed preliminary phpunit conversion issues until there is agreement on the proposal in the issue summary here.
Note that the issue summary is just the best compromise proposal I know of for now, it was not my intent to override or dismiss the concerns xjm has raised. @xjm: can you agree to commit the handful of preliminary browser test conversions that are currently open? If not we will come up with alternative proposals, just let us know :)
Comment #108
webchickHi there! This is an issue that we'd ideally like to move to the new "Drupal core ideas" queue when/if #2785735: [policy, no patch] Agile process for bigger changes in core (Part A: Ideation) goes through (hoping for the next week or two). If you could read that issue and provide your thoughts on that, that would be great!
Comment #109
klausiHey webchick! I think this is not a core "idea" in the sense that it would need buy-in from the community or core maintainers - we already have their blessing and decided many years ago that we want to go with PHPUnit as a replacement for Simpletest. In fact, most of the core tests are now PHPUnit tests already :-)
What we are discussing here is not the "what" or "why", just the "how". There is no risk in wasted effort where people work on something which later gets rejected - any PHPUnit conversion people work on will sooner or later be committed to Drupal core. It is only a question of when, that's why we are bikeshedding the process here a bit :)
So I would remove the "Drupal core ideas" tag again if that is ok with you?
Comment #110
webchickActually, yeah, good call. Sorry I was just quickly running down the list of meta plans looking for things that seemed to fit.
Still, if you have thoughts, feel free to add them in that issue! :)
Comment #111
dawehnerAnother child issue: #2795037: BTB: Add cronRun function
Comment #112
dawehnerAnother one: #2795041: BrowserTestBase: Add drupalPostWithFormat
Comment #113
dawehnerAnother one: #2795043: Standardize setup methods of all views tests
Comment #114
dawehnerAnother one: #2795045: Make SchemaCheckTestTrait available outside of the config module
Comment #115
dawehnerAnother one: #2795049: Convert web tests to browser tests for history module
Comment #116
dawehnerAnother one: #2795051: Move \Drupal\simpletest\WebTestBase::drupalBuildEntityView into a trait and make it available in BTB
Comment #117
dawehnerAnother one: #2795071: [meta] Tests using raw DOMElement
Comment #118
dawehnerAnother one: #2795073: Add titleNotEquals to WebAssert and a assertNoTitle to AssertLegacyTrait
Comment #119
dawehnerAnother one: #2795085: Add assertNoCacheTag to assertLegacyTrait
Comment #120
dawehnerAnother one: #2795111: WTB to BTB, add getRawContent() in BTB
Comment #121
chx CreditAttribution: chx at Smartsheet, Migrate Rocks commented> that it would need buy-in from the community or core maintainers - we already have their blessing
You left out "Some of".
Comment #122
dawehnerAnother novice task: #2795543: Document that only plain string values are allowed in \Drupal\Tests\WebAssert::buildXPathQuery
Comment #123
dawehnerAnother non novice one: #2795567: Use Symfony's VarDumper for easier test debugging with dump()
Comment #124
dawehnerAnother novice one: #2795579: Adapt assertCacheContexts to not rely on the return value of assertIdentical
Comment #125
jhodgdonI have a question about this issue: Can you still make Verbose output in BrowserTestBase?
The reason I am asking is that we are using the Simpletest UI (which I also understand you want to get rid of, with as far as I can tell no currently viable alternative, which I commented on, on the other issue) to make automated screen shots for the User Guide project.
EDIT: What I meant by "other issue" here was: #2750461: Remove Simpletest UI because we don't want to maintain a graphical test runner
What I did was make a method that works like verbose output, that puts out a cleaner HTML file with some injected JavaScript in it, and then I use a combination of a Greasemonkey script and Image Magick to grab screenshots of these HTML output files and trim them down to nice images for the User Guide.
Will this be possible to do in BrowserTestBase, do you think? So far I have not been able to produce verbose output from the command line at all, and I would hate for the User Guide to die in Drupal 9 due to not being able to keep automating the screen shots.
Comment #126
klausiVerbose output is being implemented in #2763401: PHPunit browser tests should log all Mink requests.
Comment #127
klausi#2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits is ready now, so it would be super helpful to get core committer feedback here or in the other issue if there is still something we can do for the 8.2 release.
We also haven't decided if the proposal in the issue summary is how we want to proceed, so some core committer approval or rejection on that would also be highly appreciated :) There is some confusion what we should work on, for example #2755991: Convert web tests to browser tests for telephone module was postponed although it was opened before 2016-Sept-01.
Comment #128
dawehnerWhen one would ask me, I would just commit it to 8.3.x, also all the other conversions, but keep adding the BC layers / additional assertions to 8.2.x as well.
We certainly killed the momentum completely which we had.
Comment #129
mpdonadioI'd love to see this proceeding, too, so that I can staging refactoring tests / split out kernel/unit tests at the same time.
Comment #130
catch#128 seems like a good idea to me, one caveat is whether git handles the renames when cherry-picking patches between 8.3.x and 8.2.x, if it doesn't that'd be a pain.
Comment #131
klausiThe problem with only committing to 8.3.x is that your tests diverge and makes it harder to provide patches for both branches. We already had problems in the past where we committed the kernel test conversion only to one branch, so people working on security issues had a harder time.
Of course we would leave all test base classes in place and just deprecate them, but otherwise test cases are not part of our API compatibility promise. I think we avoid pain when we have tests in the exact same form on both branches.
Anyway: let's get back momentum in this initiative in the meantime. We have the easy conversion patch ready now at #2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits. Let's un-postpone the harder conversions per module again where we need to tweak the tests a bit. When such an issue is ready we add the "phpunit ready for conversion" tag instead of settings it to RTBC. That way we have lots of conversion patches ready until we set the date here.
Comment #132
claudiu.cristeaAdded related #2801883: Add an empty $modules property in BrowserTestBase.
Comment #133
claudiu.cristeaThis probably needs to be handled after all conversions #2803621: Break BrowserTestBase & children dependency on Simpletest, deprecate stub BC traits
Comment #134
xjm(Linking the issue that apparently fixed the random fails related to the Forum tests, which @dawehner had me find.)
Comment #135
klausiWe had a meeting a Drupalcon Dublin and made a plan to launch this as official Drupal core initiative. #2807237: PHPUnit initiative
Comment #136
Gábor HojtsyMoving to the ideas queue as an active initative as per https://www.drupal.org/core/roadmap
Comment #137
klausiNope, this is just a plan issue to organize stuff. The initiative issue is #2807237: PHPUnit initiative.
Comment #138
Gábor HojtsyOk, this was listed as an initiative issue at https://www.drupal.org/core/roadmap. Also that it is a plan could also put it in the ideas queue, especially if it needs some signoffs, but if you believe this is the best place, let's keep it here.
Comment #139
Gábor HojtsyNote that since that page now links to ideas queue lists, this being in the core queue will decrease the visibility as it will not be listed anymore.
Comment #140
klausi#2807237: PHPUnit initiative is the issue in the idea queue, so we are listed just fine :)
Comment #141
mpdonadioI hope I am wrong about this, but in WTB, assertText() is case sensitive:
\Drupal\simpletest\AssertContentTrait
Note the strpos in the actual assert().
In BTB, assertText is case insensitive. The BC later eventually calls \Behat\Mink\WebAssert
Note the 'ui' modifier on the regex.
If this is true, what does this mean for WTB to BTB conversions or our current BC layer?
EDIT: I traced this out wrong. The deprecated BTB assertText eventually calls the BTB version of assertTextHelper(), which does a strpos. But, the docs say to use the Mink equivalents, which are case insensitive.
Comment #142
mpdonadioMy last comment in demo test form. Note which of the BTB assertions is the first fail, which should be the one on line 28. Just setting NR for a bot run.
Comment #145
jhedstromI couldn't find an existent issue on d.o., but prior to converting all of these, it would be really good to have a solution, or a documented workaround to running xdebug within page requests made from functional tests.
There is a PHPUnit PR from @dawehner to PHPUnit to fix this, but that would need to be pulled into core to utilize.
Comment #146
juampynr CreditAttribution: juampynr at Lullabot commentedInteresting, I can debug both test code and web requests in functional tests with PHPStorm. Isn't this problem solved by increasing the number of connections in the PHPStorm XDebug settings @jhedstrom? If I am misunderstanding you, please post an example where the debugger won't kick in.
Comment #147
jibranYes, I can confirm that xdebug is working for Unit/Kernal/Browser/JavaScript test but only from cli(phpunit) or phpstrom not sure about run-tests.sh. Just to be on the safe side I raised the number of connections to 5.
Comment #148
jhedstrom@juampynr @jibran I've opened #2850891: xdebug breakpoints not working in web requests from BrowserTestBase to discuss further since we are having varying results :)
Comment #149
klausiThe PHPUnit initiative is the parent issue of this.
Comment #150
dawehnerHere is an issue for system module: #2862508: Convert system functional tests to phpunit
Comment #151
dawehnerComment #152
dawehnerComment #153
dawehnerComment #154
mpdonadioComment #155
dawehnerComment #156
LendudeAdded #2863267: Convert web tests of views
Comment #157
nlisgo CreditAttribution: nlisgo commentedAdded #2863268: Convert web tests to browser tests for tracker module
Comment #158
mpdonadioI think one of the recent edits lost some changes.
Comment #159
dagmarAdded #2863372: Convert dblog web tests to BrowserTestBase
Comment #160
nlisgo CreditAttribution: nlisgo commentedAdded #2863416: Convert web tests to browser tests for filter module
Comment #161
nlisgo CreditAttribution: nlisgo commentedAdded #2863597: Convert web tests to browser tests for toolbar module
Comment #162
scuba_flyComment #163
jofitz CreditAttribution: jofitz at ComputerMinds commentedAdded #2863607: Convert WebTestBaseTests of BigPipe to BrowserTestBase.
Comment #164
jofitz CreditAttribution: jofitz at ComputerMinds commentedAdded #2863644: Convert web tests of block.
Comment #165
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedComment #166
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedComment #167
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedComment #168
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedComment #169
dawehnerComment #170
dawehnerComment #171
slv_ CreditAttribution: slv_ commentedComment #172
nlisgo CreditAttribution: nlisgo commentedAdded #2863996: Convert web tests to browser tests for ckeditor module
Comment #173
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedAdd following
#2864005: Convert web tests to browser tests for block_content module
#2863842: Convert web tests to browser tests for search module
#2863969: Convert web tests to browser tests for options module
#2863984: Convert [1/3] web tests to browser tests for responsive_image module
Comment #174
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedAdd #2864035: Convert web tests to browser tests for rdf module
Comment #175
nlisgo CreditAttribution: nlisgo commentedAdded: #2864008: Convert web tests to browser tests for content_moderation module
Comment #176
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedAdd #2864088: Convert web tests to browser tests for shortcut module
Comment #177
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedAdd #2864121: Convert web tests to browser tests for statistics module
Comment #178
mpdonadioI think this only affects the RDF tests, #2864201: XPath in WebTestBase and BrowserTestBase use different roots. Need to see the lang attribute on <html> is tested .
Comment #179
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedStatistics and many modules require the conversion of \Drupal\simpletest\AssertContentTrait::assertNoPattern(). Follow #2864257: Convert web tests AssertNoPattern to Browser Test
Comment #180
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedAdd #2865407: Convert web tests to browser tests for contextual module but waiting after #2795041: BrowserTestBase: Add drupalPostWithFormat
Comment #181
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedAdd #2865413: Move RegisterSerializationClassesCompilerPassTest.php to correct location
Comment #182
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedfix wrong markup list
Comment #183
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedComment #184
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedComment #185
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedComment #186
nlisgo CreditAttribution: nlisgo commentedAdded: #2865537: Convert web tests to browser tests for minimal profile
Comment #187
dawehnerIf I understand this correctly we have like 890 to go:
Comment #188
mpdonadioAdded: #2866513: Convert web tests to browser tests for comment module
Comment #189
quietone CreditAttribution: quietone as a volunteer commentedAdded details for migrate modules.
Comment #190
jofitz CreditAttribution: jofitz at ComputerMinds commentedAdded to IS:
system: #2862508: Convert system functional tests to phpunit
Comment #191
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedAdded note on Wizard tests to IS, separate issue created: #2867777: Convert views WizardTestBase tests to phpunit
Comment #192
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedAdded various issues for module conversions in the issue summary
Comment #193
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedAll module conversion issues created!
Comment #194
dawehnermichielnugter Thanks a lot!
Comment #195
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedLink fix.
All new issues that are postponed contain the tests in the IS that it is postponed on.
Comment #196
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedUpdated issue summary with the current best approach and some hints/tips on common conversions.
Comment #197
dawehnerComment #198
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedAdd sub-issue for language module #2871740: Convert web tests to browser tests LanguageTourTest for language module
Comment #199
dawehnerComment #200
dawehnerWe start to make good progress, see the progress report in the issue queue.
Comment #201
mpdonadioComment #202
mpdonadioMake #2872059: Convert web tests to browser tests for locale module.
Comment #203
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedAdded 'phpunit initiative' tag to this issue and all it's sub-issues. Will add it to every related issue so we can use the tag to track all issues related to the initiative.
Updated IS to state the tag usage.
Comment #204
dawehnerImpressive work, seriously!
Comment #205
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedUpdating the todo list, good progress!
Comment #206
naveenvalechaUpdated IS.
//Naveen
Comment #207
naveenvalechaThis has landed #2747167: Convert first part of web tests of views_ui
Comment #208
naveenvalechaThese landed #2757023: Convert all aggregator web tests to BrowserTestBase and #2867304: Convert web tests to browser tests for migrate_drupal_ui module and #2863372: Convert dblog web tests to BrowserTestBase
Comment #209
naveenvalechaUpdating IS
Comment #210
naveenvalechaTwo more landed today #2870441: Convert web tests to browser tests for content_translation module #2872059: Convert web tests to browser tests for locale module
//Naveen
Comment #211
naveenvalecha#2870459: Convert web tests to browser tests for taxonomy module has landed! Added #2887134: Convert web tests to browser tests for taxonomy module Part -2 to the list.
Comment #212
dawehnerCan I quickly say how impressed I am how many tests we've already converted?
Comment #213
naveenvalecha#2864005: Convert web tests to browser tests for block_content module has landed today. Added follow-up #2887311: Convert BlockContentTypeTest web tests to browser tests for block_content module to the IS
#212,
In 8.4.x latest Head 578 conversions are left. As per IS, in 8.2 we have 1152 tests. So from 8.2, we have converted ~570+ tests so far.
P.S: I'll PM you the link of the PHPUnit initiative website over IRC which @lendude has shared with me. It's a nice one, it shows the progress in graphs.
//Naveen
Comment #214
Lendude@naveenvalecha no need to share, I've just moved it live:
http://simpletest-countdown.org
Want to know how the initiative is progressing? Check the website to see how we are doing! Currently we are taking a fresh datapoint every tagged release of Drupal, so about every month.
The site is a work in progress, so any feedback is appreciated, please just use the contact form on the site or send me a tell on IRC.
Comment #215
naveenvalechaThanks, @lendude!
#2888539: Convert TrackerUserUidTest web tests to browser tests and #2212869: Extend ContactAuthenticatedUserTest for anonymous user landed today. Added them to IS
//Naveen
Comment #216
naveenvalecha#2870464: Convert web tests to browser tests for update module, #2889350: Convert BookRelationshipTest web tests to BrowserTestBase, #2889352: Convert ContactFieldsTest & ContactLinkTest web tests to browser tests for contact module and #2889353: Convert ForumIntegrationTest web tests to browser tests for forum module landed today.
Updated IS accordingly.
//Naveen
Comment #217
naveenvalecha#2870440: Convert web tests to browser tests for config_translation module landed as well. Updated IS accordingly.
//Naveen
Comment #218
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedNo need to state Views and WizardTestBase test shouldn't be converted as both have landed.
Comment #219
LendudeWant to know how we did going from 8.3.3 to 8.3.5? The scores are up on http://simpletest-countdown.org
Really great progress was made, thanks everybody for helping out! Plenty more to do, so lets keep it up :)
Comment #220
Wim Leers#2775553: Convert web tests to browser tests for REST module is no longer blocked. I converted one of the tests — anybody else want to continue? :)
Comment #221
GoZ CreditAttribution: GoZ at Barbe-Rousse commentedList conversions which are blocked grouped by blockers
Comment #222
dawehnerComment #223
andypostFiled #2898437: Convert HistoryTimestampTest to kernel test the only remaining test in history module
Comment #225
Wim Leers#2775553: Convert web tests to browser tests for REST module was committed!
Comment #226
Lendude#2870009: Update: Convert system functional tests to phpunit is in!!! Update tests are not longer blocked and can be converted along with the other tests now!
Comment #227
webchickJust popping by to say that http://simpletest-countdown.org/ is a brilliant visualization of this initiative. Keep up the great work! :D
Comment #228
Mile23New child: #2905470: @deprecated Drupal\system\Tests\Update\UpdatePathTestBase breaks test runs
Basically: If you convert a WTB test that inherits from Drupal\system\Tests\Update\UpdatePathTestBase, run the conversion with PHPUnit locally to make sure you don't break all PHPUnit test runs. run-tests.sh doesn't fail them, but phpunit does.
Comment #229
dawehnerComment #230
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThe "outside_in" module is now the Settings Tray module - #2870456: Convert web tests to browser tests for Settings Tray module
Comment #231
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedUpdated issue summary: #2864088: Convert web tests to browser tests for shortcut module is now blocked by #2863644: Convert web tests of block not #2865336: Add \Drupal\simpletest\WebTestBase::assertBlockAppears to \Drupal\FunctionalTests\AssertLegacyTrait
Comment #232
naveenvalecha#2863644: Convert web tests of block and #2887099: Menu: convert system functional tests to PHPUnit has landed. Also updated the IS
Comment #233
naveenvalecha#2863416: Convert web tests to browser tests for filter module and #2767275: Convert web tests to browser tests for tour module also went in
Comment #234
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedTidied up the issue summary:
Comment #235
LendudeWith the release of 8.4.0-rc1, I've taken a new data point for http://simpletest-countdown.org Nice progress, down to 349 simpletests.
Comment #236
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThree more fixed:
#2863607: Convert WebTestBaseTests of BigPipe to BrowserTestBase
#2864088: Convert web tests to browser tests for shortcut module
#2905627: Part-2: Convert UpdatePathTestBase to BrowserTestBase
Also added some missing issues in 'Conversions blocked by another'
Comment #237
naveenvalecha#2866513: Convert web tests to browser tests for comment module has landed
Comment #238
Mile23Let's deal with drupalPost() #2911915: Add getHttpClient() to BrowserTestBase
Comment #239
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedTidied up the instructions, re-ordered for logical flow, added note on creating follow-up issues for blockers, added note on how to deprecate base and trait files, and creating a change record.
Comment #240
Anonymous (not verified) CreditAttribution: Anonymous commentedLet's also deal with drupalPostFormHack() #2917885: Add drupalPostFormWithInvalidOptions() to BrowserTestBase
Comment #241
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedFour more completed so I have updated the issue summary:
#2887311: Convert BlockContentTypeTest web tests to browser tests for block_content module
#2870439: Convert web tests to browser tests for config module
#2888905: ConvertConfigTranslationUiTest WTB to JTB & BTB for config_translation module
#2887813: Convert web tests to browser tests for content_translation module Part 2
Comment #242
LendudeOpened up #2932909: Convert web tests to browser tests for Simpletest module, this should probably be done last, but opened it to reference it in other issues.
Comment #244
Wim Leerspage_cache
,settings_tray
anduser
are also done!Comment #245
jhedstromThe last
user
test is actually still needing review in #2941494: Deprecate SystemConfigFormTestBase and create kernel test version. It's hidden because when many of the tests were bulk moved, the ones extendingSystemConfigFormTestBase
appeared to have been converted even though that class still extendsWebTestBase
.Comment #246
Mile23Updated #2932909: Convert web tests to browser tests for Simpletest module after some analysis if anyone wants to take it on. :-)
Comment #247
nlisgo CreditAttribution: nlisgo commentedimage
is done!Comment #248
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedUpdated IS for issues blocking others.
Comment #249
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedHid the wrong file. Corrected now.
Comment #250
nlisgo CreditAttribution: nlisgo commentedrdf
is done!Comment #251
nlisgo CreditAttribution: nlisgo commentedmenu_ui
is done!Comment #252
Anonymous (not verified) CreditAttribution: Anonymous commentedDue to fail, when we adding
@trigger_error
to traits in simpletest folders, we can not make a full conversion at least for the next issues:To solve this problem, we need to fix #2296635: Evaluate performance impact of limiting test discovery to *Test.php filename suffix.
Edit: see also #100 / #102
Comment #253
Mile23Added a new child issue: #2977105: Incomplete functional conversion for NodeCacheTagsTest
Also, re: #252:
The blocker of deprecated traits is fixed in #2949363: Impossible to make trigger_error in some files without test fails and #2973127: Exclude *TestBase.php, *Trait.php and *Interface.php files from test discovery reflection
Comment #254
Mile23New child: #2978952: Deprecate Drupal\simpletest\InstallerTestBase, convert children to BTB
Comment #255
Mile23New child: #2981678: Fail PHPUnit-based tests which still inherit from WTB/TB.
Comment #256
LendudeI've updated simpletest-countdown.org to the latest count in 8.6.x (145 to go) and also added a list of remaining simpletests
Shows some nice outliers we could easily have overlooked like
- Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
- Drupal\image\Tests\Update\ScaleAndCropAddAnchorUpdateTest
Comment #257
nlisgo CreditAttribution: nlisgo commentededitor
andfile
are doneComment #258
LendudeWe are down to 102, double digits are in sight.
Simpletest countdown
Comment #259
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commented#2863842: Convert web tests to browser tests for search module has been completed, so I've removed it from the 'blocker / is blocking' list.
Regarding #257, are we still maintaining the 'completed' list in the issue summary? If we are, then 'editor' and 'file' need to be added. But I suggest as this completed list is getting very long (hurray) then provided the issue is in the 'child issue' sidebox we no longer need the separate 'completed' list. Either it needs to be maintained up-to-date or deleted.
Comment #260
Lendude@jonathan1055 yeah that makes sense. Did a bit of a clean up on the IS. Removed the 'fixed' part. Added a link to the remaining simpletests which might be the goto resource for 'what to do' once the module wide conversions have been done.
Thanks everybody for all the help in making that 'fixed' list too long to maintain! Awesome work.
Comment #261
LendudeWe have just gone under 100 Simpletests remaining in core!
Simpletest
98
PHPUnit-Functional
1404
PHPUnit-FunctionalJavascript
78
PHPUnit-Kernel
1000
PHPUnit-Unit
671
Comment #262
larowlanoh yeah!
Comment #264
nlisgo CreditAttribution: nlisgo commented#2865407: Convert web tests to browser tests for contextual module is done!
Comment #265
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedAccording to #2870462-7: Convert web tests to browser tests for text module the issue #2870444: Convert web tests to browser tests for field module is no longer a blocker, hence updating issue summary above.
Comment #266
nlisgo CreditAttribution: nlisgo commented#2870444: Convert web tests to browser tests for field module is done.
Comment #267
Mile23New child: #2996030: Convert web tests to browser tests for node module - round 2
Comment #268
Mile23New child: #2996789: Deprecate Drupal\field\Tests\EntityReference\EntityReferenceTestTrait
Comment #269
LendudeI've updated the IS to contain all remaining 36(!!) tests and the issues they belong to.
Lets get this done!
Comment #270
LendudeAdded #3008109: Convert ResponsiveImageFieldDisplayTest to BrowserTestBase for the last remaining test not covered by an issue.
Comment #271
Wim Leers🎉
Comment #272
Lendudeupdated the remaining tests list, 32 to go
Comment #273
LendudeSplit off #3011079: Convert \Drupal\system\Tests\Session\SessionHttpsTest to PHPUnit because that is a nasty one
Comment #274
Lendudestuff landed, updated the list.
Comment #275
Lendudedown to 19!
Comment #276
Lendudeupdated the list of issues
Comment #277
larowlanCommitters discussed our priorities for D9 and it was unanimous that we don't want to support WebTestBase in D9. Raising this to major and adding the @deprecated tag.
Comment #278
Mile23@larowlan Ossum. Maybe update #2866082: [Plan] Roadmap for Simpletest and/or children?
Comment #279
jibranCreated #3027952: [Plan] Remove the usage of deprecated methods in tests as a next logical step.
Comment #280
LendudeUpdated the remaining test, down to 4 that need converting
Comment #281
FeuerwagenRemaining: 3 …
Comment #282
volegerThe last one
Comment #283
jibran@alexpott just committed #2809503: Convert AJAX part of \Drupal\file\Tests\FileFieldWidgetTest to JavascriptTestBase so we can close this now. Thanks, all for all the help and support.
Comment #284
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThought I would grab this screen shot before it changes to zero.
Great work everyone.
Comment #285
LendudeAgain, a big thank you to all involved, your contributions have been amazing.
Comment #286
alexpottI've credited everyone who made constructive comments or helped with the issue summary.
I've not credited comments that we only about the countdown or seemed more like support requests.
So nice to see this fixed.
Comment #287
naveenvalechaThank you, everyone, to get this closed.
Comment #288
heddnThank you and congrats to everyone on this huge milestone.
Comment #289
quietone CreditAttribution: quietone as a volunteer commentedCongratulations to all and thank you.