Problem/Motivation
This is in part a bug report, a documentation requires, and a rant.
I've been busy with other stuff the last few months, and am discovering that the grand mix of fixes and improvements mean I can no longer get a simple test run of the module to work.
And I'm a *$(R*& maintainer, supposedly.
My general opinion of many of these changes isn't exactly a secret. But since they've been done: documentation needs to get fixed to make these fixes and improvements actually fix or improve anything.
At a minimum, the following work is required:
- What needs to get installed for set up MUST be documented. My sense is that it likely includes phantomjs (no, INSTALL.md does not suggest this). Some links to how phpunit.xml needs to get edited is also essential. If there's some other doohinky required, yeah, that too.
- The EXACT call to run-tests.sh needed to test the module. INSTALL.md is vague, and points to links which do not answer this question.
My major criticism of the changes made to the test system was that the changes were very literally a waste of time. As in: it made testing modules more difficult for people working in contrib, and required more time to get less accomplished. Hopefully it saved time for the core folk, because if not: WTF???
I'm going to start going through this and see what needs to get changed. But if you folks already know, then it would be good if we get these docs in before we worry any more about coding standards etc.
Yeah, it's a rant. But admit it: IT'S A RIGHTEOUS RANT.
Proposed resolution
Add a d.o page about all the new testing stuff so that we can not lose our minds. Link to it from TESTING.md
.
Remaining tasks
Add testing example showing how to organize all the different types of tests.
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#15 | 2833290_15.patch | 5.35 KB | navneet0693 |
| |||
#15 | interdiff-7-15.txt | 2.12 KB | navneet0693 |
#12 | interdiff-12.txt | 1016 bytes | navneet0693 |
#12 | 2833290_12.patch | 11.13 KB | navneet0693 |
| |||
#10 | interdiff.txt | 2.14 KB | Mile23 |
Comments
Comment #2
Mile23Rant on! :-)
The right place to document how to test a module (or project or whatever) would be at some d.o page where anyone who needs it can find it more easily, for any project.
TESTING.md
links to https://www.drupal.org/node/645286 but there really should be a more specific how-to-test-your-d.o-project page.The way to get around the phantomjs stuff is to either learn to use a local testbot (too much to ask, really, but it does set up phantomjs on a VM), or to use the
--types
argument torun-tests.sh
, and include all the types except PHPUnit-FunctionalJavascript. You might ask: Where is the list of test types? The answer: There isn't a documented one, but there's the phpunit.xml.dist here: http://cgit.drupalcode.org/drupal/tree/core/phpunit.xml.distThe PHPUnit test suites are: unit, kernel, functional, and functional-javascript. This means you can do
./vendor/bin/phpunit -c core/ --testsuite unit
and run only unit tests without kernel, functional or js tests. Unfortunately you can't run all of them except one, so you can't just exclude the js tests. Also you can't run simpletest-based tests from PHPUnit.You map these suites to
run-tests.sh
types by prepending PHPUnit-. Sophp ./core/scripts/run-tests.sh --types 'Simpletest,PHPUnit-Unit,PHPUnit-Kernel,PHPUnit-Functional'
runs all of them except js.The reason for doing this is to manage dependencies for tests, and to manage which tool runs the test. The jury is still out on how successful this has been. :-)
There are plenty of places to improve documentation in core and here as well. The main thing is that simpletest is essentially on its way out, so documenting now might be a moving target, but it's also kind of important.
Comment #3
Mile23Comment #4
Torenware CreditAttribution: Torenware as a volunteer commentedThis is a reasonable program. I'll start looking at this.
I'd also agree that running a local test bot is too high a bar; the setup is not only tweaky, it's highly platform dependent. If someone's done a virtual with it, we should point to it, since a good chunk of developers use Macs, and right now, Docker is not very well behaved on Sierra.
Comment #5
Mile23The
--directory
argument was added so the testbot could test contrib. :-)Comment #6
eojthebraveThis change record looks like it contains some potentially useful information https://www.drupal.org/node/2469723
Comment #7
Mile23Added a step-by-step for how to run tests in Drupal.
Also changed some phrasing general editing in TESTING.md and STANDARDS.md.
Comment #8
Mile23Oh, just realized I forgot to add info about which version of core to track.
Comment #9
eojthebraveShould this also include information about running tests via the UI? Not that I would ever really wish that upon someone. :P
Otherwise, this looks like a nice addition. And the final example worked well for me to copy/paste and change a couple of values relative to my installation. Something that took me a while to figure out before. So +1.
Comment #10
Mile23Added info about which core branch to use, and how to use the UI to test.
Comment #11
eojthebraveThat was quick. Nice.
I found this sentence to be a bit confusing. I think maybe adding, "to the dev branch" would help.
Otherwise, this looks good to me and I would be fine with calling it RTBC with that change.
Comment #12
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedLet's not leave any stones unturned :)
Comment #13
Mile23The patch in #12 has a ton of out-of-scope changes. Maybe do a rebase?
Comment #14
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commented@Mile23 I had a close look at patch in #10.It deletes certain file, as per my understand, that's somehow by a mistake :). I will work further on patch in #7 Please correct me if I am wrong :)
Comment #15
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedComment #16
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedComment #17
Mile23If you look at the patch in #12, you'll see that it changes a lot of files other than the testing instructions. Those changes are out of scope.
If you look at the interdiff in #15, it's some of the changes I made in #10.
I'm not sure what to review here, because you seem to have started with #7 and then applied my changes from #10. Did you make any changes in #15?
Comment #18
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commented@Mile23 This one is to let everyone as we have already cleared the confusion on this on IRC. So, yes I should have been more clear in comments. Patch in #10 removes certain files, so I started from patch in #7 and applied changes of #10 and included recommendation by eojthebrave in #11. So, actually nothing is changed in #15, it is just I removed the deleted files from patch.
I will change status once again to needs review :)
Comment #20
Mile23Sorry about the mix-up. I should be more careful with my patches.
Fixed some 80-char wrap issues in TESTING.md on commit.
Fixed, committed, pushed.
Thanks, folks.
As always: Please file another documentation issue if there's a documentation issue. :-)