Closed (fixed)
Project:
DrupalCI: Drupal.org Testing Infrastructure
Component:
User interface
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
20 Jul 2016 at 04:40 UTC
Updated:
25 Mar 2018 at 07:49 UTC
Jump to comment: Most recent
Comments
Comment #2
dawehnerAre you sure it is not possible to add tests to themes? Just from reading
\Drupal\simpletest\TestDiscovery::getExtensionsI would assume it doesComment #3
MixologicI think what he means is that there is no 'automated testing' tab on project_theme types on drupal.org, and he'd like there to be one. Can you test themes with run-tests.sh? because, right now, that is the only currently supported mechanism. We'll be adding new test types soon, but we're not running phpunit (unless via run-tests.sh).
I.e. does bootstrap have any tests we can check this with?
Comment #4
markhalliwellThat's promising.
Correct.
To be quite honest, tests aren't my thing, but I know they're important. I really haven't put a whole lot of effort into something that isn't actively supported yet. I know last time I went down this route, there was an issue where the full path wasn't used in
--fileproperly (see related issue).Not currently, no. I haven't even begun to put effort into creating tests because there hasn't been any support of it. That being said, there is a mountain of things that could be tested now that the entire codebase is OO.
The closest I have come to this issue are the related issues, which was before or rather superseded by DrupalCI.
Comment #5
markhalliwellI was able to successfully run the test using the patch at #2138693-7: Provide UnitTests for theme and the following CLI:
sudo -u _www php ./core/scripts/run-tests.sh --sqlite /tmp/d8.dev-sqlite --directory themes/bootstrap --verbose---
That being said, I'm not entirely sure if using
--directoryqualifies. I tried using the--class, but it couldn't find it.Comment #6
markhalliwellOk, so I think it wasn't finding the class because the
@groupannotation was missing. Fixed that in #2138693-8: Provide UnitTests for theme.The following seems to be working now:
sudo -u _www php ./core/scripts/run-tests.sh --class "Drupal\bootstrap\Tests\BootstrapUnitTest"Comment #7
technikh commentedAlso allow distributions to be testable.
This Drupal commons distribution patch on https://www.drupal.org/node/2315729 doesn't show test results
Comment #8
MixologicDistributions are another thing entirely. I've opened a new issue for that: #2779227: [Policy] Distribution testing
Comment #9
markhalliwellBump... should this be moved back to Drupal CI?
Comment #10
drummDependencies of themes are currently not parsed by project_dependency. I’m not sure there’s much of a reason not to do that, other than potential for adding noise - themes or subthemes with colliding names being chosen for non-namespaced dependencies. However, that’s planned to be replaced with Composer for DrupalCI’s dependency resolution. project_dependency will still be used for Drupal.org’s Composer shim and for showing dependencies on Drupal.org.
I think the next best steps are
Comment #11
markhalliwellI'm really not sure what composer has to do with this...
This is, primarily, about adding (re-enabling, it was removed a while back) the "Automated testing" tab on theme project pages.
I honestly could care less about "dependency" issues at this moment. That can be handled in future issues.
Getting a project (base theme), that has no dependencies, to be "testable" is a massive win IMO... especially for 8.x where there is autoloading/discoverability of test classes.
Comment #12
MixologicIt's more complicated than that. Adding the option back to the automated testing tab isn't going to make your theme testable.
In order to test anything we have to construct a codebase to test. For modules this means drupal core, and any other module dependencies that are required. We're currently using project_dependency to make that happen, but we're working to get away from that entirely and use composer to build out the codebase, hence why its important that we can install your theme using composer.
Additionally, for themes, we'll need to know what additional build process we might need to support. Do we need to run bower? npm? Do we need to download additional assets or libraries? What do we have to do to get it into a *testable* state. How many themes on d.o. even *need* additional build process support? Obviously bootstrap doesn't need much of anything besides a copy of core lying around.
For that matter what other *types* of tests should we support for themes, is there demand for javascript tests?
So yeah, this is probably a drupalci issue right now, and its really a meta of "what do we need to do to support theme testing, and whats the roadmap to get us there?"
Comment #13
markhalliwellOk. I added the necessary composer.json file to the base theme. It needed to get done anyway, was just confused as to why it was needed here, thanks for clearing that up.
Ideally, yes, it would be fantastic if Drupal CI could execute
npm installandnpm test. TBH, however, that is an entirely separate issue/feature.As it stands now, there are simply a multitude of normal OO PHP code that could currently be unit tested in the base theme: http://drupal-bootstrap.org/api/bootstrap/classes. That is primarily what I'm discussing here.
Similar to above. Yes, it'd be nice to have other JS based testing suites available. That's one of the huge advantages of hosting code on GH. I think implementing a file like
.travis.ymlthat specifies the environment requirements would be preferable. Whether or not that is open ended to allow before/after scripts (to install other tools), I'm not sure about.For now, I think simply opening up the ability to unit test PHP code and [potentially] nodejs/npm testing would be fine.
Comment #14
markhalliwellBump... stable releases have
composer.jsonnow. What's next?Comment #15
markhalliwellBump... again...
Comment #16
MixologicWe can do this, but we need PIFT to talk to us better first.
Postponing on https://www.drupal.org/project/project_issue_file_test/issues/2853889
Comment #17
MixologicComment #18
markhalliwellComment #19
markhalliwellComment #20
Mixologichttps://www.drupal.org/node/259843/qa can now be configured.
We havent really ran this through a full test because we dont have something exactly to test with, but its probably better to hand it to you to see if it works.
Comment #21
markhalliwellw00t! Testing now (well, queued hehe)!
Comment #22
markhalliwellI've created the following branch tests:
https://www.drupal.org/node/259843/qa
How does one remove a test? I accidentally created one for 8.x-4.x.
#2138693: Provide UnitTests for theme cannot seem to get patch validation:
https://dispatcher.drupalci.org/job/drupal8_contrib_patches/24672/console
7.x-3.x says it doesn't have a composer.json file, even though it does:
http://cgit.drupalcode.org/bootstrap/tree/composer.json?h=7.x-3.x
Seems to be using https://packages.drupal.org/8... even though the test is configured for 7.x. Not sure if that has anything to do with it.
Comment #23
markhalliwellTurns out you have to wait for the test to complete and then an “edit” link appears which lets you then delete from there. Not very intuitive, just FYI.
Comment #24
MixologicYeah, that whole UI has kinda been a lot of little incremental things, and could probably, someday, be more intuitive.
The 7.x test was breaking because I was setting some wrong keys, and have since redeployed to take that into account. The branch tests were also running *all of core* which they werent supposed to.
So, sorry to announce this to you before I'd finished ironing out the new deployment kinks. I've requeued some branch tests to see where we're at now.
Comment #25
markhalliwellNo need to apologize :D I was just a bit confused as I don't typically go this area of a project that much.
I'm just very happy that this is finally starting to happen! This is like an early Christmas present lol
It seems the branches are now "passing" https://www.drupal.org/node/259843/qa
They seem to correctly indicate now that the current branch code doesn't have any tests to run.
Tried to retest #2138693: Provide UnitTests for theme, but it does seem there needs a little bit more work there.
Comment #26
MixologicOkay, I've found a few spots in both pift and drupalci that are expecting 'module' vs a more generic extension. but now we've got a nice build.yml file we can test with that should help out.
Comment #27
MixologicFixed all those spots, themes seem to be testable again.
Comment #28
markhalliwellAwesome!!! Thank you again @Mixologic for putting so much love into this! This is absolutely fantastic work!