In order to give at least the appearance of test-driven development, we should port the existing menu_example D7 SimpleTest tests to D8.
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.
This issue 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.
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:
- 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
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | examples-menu-example-test-2277667-28-8.x.patch | 5.05 KB | mimran |
Comments
Comment #1
mile23A test! It fails!
See also: https://drupal.org/node/1452896#comment-8843605
Comment #2
mile23Comment #4
mimran commentedComment #5
mimran commentedComment #6
mimran commentedComment #7
mimran commentedUpdated the patch with some changes and attached the test results as well for the review purpose.
Comment #8
mimran commentedComment #10
joshi.rohit100wrong hook_help() implementation
Now not required
Comment #11
joshi.rohit100wrong hook_help() implementation
Now not required
Comment #12
mimran commentedHi @joshi,
Thanks for your reply and i have updated the patch as per your comment
Comment #13
mimran commentedOnly intention of this was to create test cases for the menu_example module so i'm gonna work on other parts of the code in a separate issue
Comment #14
chx commentedThanks for working on this! As far as I can see this looks good.
Comment #15
mimran commented@chx thanks for the review
Comment #16
mimran commentedComment #18
mile23This needs
@groupannotation, or else it causes an exception:So add
@group menu_exampleand we're good.Comment #19
mimran commentedComment #20
mimran commentedUpdated the patch with@group annotation
Comment #21
mimran commentedComment #23
snehi commentedUpload without space.
Comment #25
mimran commented@snehi i don't see any code changes on your commit over my previous one, attached the interdiff for the reviewers
Comment #26
snehi commentedHere was the extra space. Please check. I corrected it.
let me know if it is ok.
Comment #27
mimran commented@snehi still i dont see your change please refer the interdiff of your patch and my previous patch
Comment #28
mimran commentedUpdated the patch by removing the space in EOF
Comment #29
mimran commentedComment #31
mile23I think we're good here. :-)
I'm moving the patch to #1883724: Port menu_example to D8 where we can continue filling in the blanks and make the tests pass.
Also I'm making a note over there of proper git attribution for all the work here.
Thanks. :-)