In order to give at least the appearance of test-driven development, we should port the existing D7 SimpleTest tests to D8.
Each module has tests, and these tests should be ported as directly as possible, without changing them.
Note that these tests will fail. :-) The point of this exercise is to write tests that fail.
The issues listed here will be marked fixed when they run without fatal code errors.
In order to build the tests, you will also need to generate the file structure of the module in question.
One thing to keep in mind is that SimpleTest shows you a stack trace for fails, as if they were errors. This is the most annoying part of porting tests; they look like they're broken when they're really not.
Steps to take:
- Pick a module.
- Assign the issue to yourself.
- Generate a module skeleton.
- Convert tests.
- Run tests.
- More conversion if necessary.
- Submit a patch.
Resources:
A tool to generate a module skeleton: https://drupal.org/sandbox/mile23/2230027
Test conversion notes: https://drupal.org/node/2166895
How to run tests:
- In Drupal: https://drupal.org/documentation/modules/simpletest
- From the command line: https://drupal.org/node/645286
Modules:
action_example
#2277603: Port D7 Tests To D8 for action_exampleajax_example
#2277605: Port D7 Tests To D8 for ajax_examplebatch_example
#2277607: Port D7 Tests To D8 for batch_examplecontextual_links_example
#2277609: Port D7 Tests To D8 for contextual_links_examplecron_example
#2277611: Port D7 Tests To D8 for cron_examplefield_example
#2277613: Port D7 Tests To D8 for field_examplefield_permission_example
#2277615: Port D7 Tests To D8 for field_permission_examplefile_example
#2277625: Port D7 Tests To D8 for file_examplefilter_example
#2277629: Add filter exampleform_example
#2277631: Port D7 Tests To D8 for form_exampleimage_example
#2277633: Port D7 Tests To D8 for image_examplemenu_example
#2277667: Port D7 Tests To D8 for menu_examplenode_access_example
#2277669: Port D7 Tests To D8 for node_access_examplepager_example
#2277673: Port D7 Tests To D8 for pager_examplequeue_example
#2277675: Port D7 Tests To D8 for queue_examplerdf_example
#2277707: Port D7 Tests To D8 for rdf_examplerender_example
#2277709: Port D7 Tests To D8 for render_example
Comments
Comment #1
Mile23Comment #2
Mile23Comment #3
Mile23Comment #4
Mile23Comment #5
Mile23Comment #6
KarenS CreditAttribution: KarenS at Lullabot commentedSince core is now using PHPUnit tests (https://www.drupal.org/phpunit), shouldn't the example modules use that instead wherever it could apply? I see there is a single example of PHPUnit testing, so just wondering if it is still appropriate to have a simpletest for every example. Module developers may deduce that simpletest is the expectation or standard.
Comment #7
KarenS CreditAttribution: KarenS at Lullabot commentedAlso it's not self-evident why the tests are supposed to fail. Some explanation of that would help.
Comment #8
Mile23Mothballing this issue because clearly no one gets it. :-) Also it's hard to manage in a patch-oriented process.
Not closing it because there are still child issues being worked on, and we don't want to lose that effort.
Comment #9
Mile23All the child issues are closed or rescoped.
Thanks everyone for trying. :-)