-
Notifications
You must be signed in to change notification settings - Fork 7
Effective unit and functional test delineation for phpunit #14
Comments
This is good on one hand, but it doesn't separate unit/functional tests. We could use --group=theme if that's possible.
path should be |
Core documents how contributed/custom modules should write phpunit tests. This is compatible with the default phpunit.xml configuration. The configuration that we're using is the base configuration file with a suite added for our customisations. I vaguely remember being able to use groups with the default configuration to run tests from specific modules (albeit we'd need multiple groups), so it would end up looking something like:
Perhaps we can look to leverage groups a little more and define some standard groups that will allow us to continue using the Core provided configuration. I think we will want to differentiate between kernel and unit tests, Drupal provides test suites for that already, Kernel gives us full stack (including DB connections) and unit is more limited aimed at just code testing. So if we look for a standard group we could invoke phpunit like
|
Ok. So to do this I think we'd have to:
Yeah that includes functional/integration tests. |
I think the solution should be agnostic to any groups for clients:
This is because any type of grouping is not reliable - developers may write a test and forget to tag it with the group. Also, note that This approach is already successfully working on several projects. |
fwiw, I disagree agree with using core's /app/docroot/core/phpunit.xml.dist file because it's out of our control and a different use case. |
ok, looks like changing the contents of the config file + using groups should be an accepted solution
This is now ready to be submitted as a PR. |
I love that approach |
In phpunit configuration we see
We don't need core testsuites, that is outside scope of the project. We also need to delineate between non-bootstrapped and bootstrapped tests.
Remember that for a project that is not using behat properly, phpunit functional (bootstrapped) tests are recommended, but this is a very different setup in CI compared to static tests.
Something that is client-oriented might look like this:
As speculation for pure static unit tests - ie testing a class with everything injected and mocked - there are a few generic places we might expect these to live.
I think this is possible as a sane default, but I need to check syntax.
The text was updated successfully, but these errors were encountered: