[wp-trac] [WordPress Trac] #42282: Execute PHPUnit continuously over watched files in local environments

WordPress Trac noreply at wordpress.org
Thu Oct 19 19:37:58 UTC 2017


#42282: Execute PHPUnit continuously over watched files in local environments
----------------------------------------+------------------------------
 Reporter:  iandunn                     |       Owner:
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Build/Test Tools            |     Version:  trunk
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:
----------------------------------------+------------------------------
Description changed by iandunn:

Old description:

> Currently, PHPUnit tests have to be ran manually when working on a patch.
> To me, this feels tedious and means that I usually only run them when I
> reach a "milestone" in the process.
>
> Automatically the executing of tests when files are saved would encourage
> test-driven development, make problems in the changes obvious
> immediately, and generally make the developer experience smoother.
>
> There are a lot of solutions for devs to setup that automation
> independently (`inotifywait`, `watchman`, PhpStorm file watchers, etc)
> but they all require manual setup, and vary in quality.
>
> We already have `grunt watch` available in our environment, so we can use
> it to provide a simple command like `grunt watch:phpunit`, making it easy
> to run the tests automatically.
>
> By default, it could watch all PHP files and execute all tests in the
> `phpunit:default` task, but I think it'd be necessary to have options for
> specifying the watch target, test groups, and PHPUnit config (AJAX,
> Multisite, etc).
>
> [attachment:42282.diff] is a very rough proof of concept that runs the
> `community-events` test group when changes are made inside `wp-
> admin/includes`.

New description:

 Currently, PHPUnit tests have to be ran manually when working on a patch.
 To me, this feels tedious and means that I usually only run them when I
 reach a "milestone" in the process.

 Automatically the executing of tests when files are saved would encourage
 test-driven development, make problems in the changes obvious immediately,
 and generally make the developer experience smoother.

 There are a lot of solutions for devs to setup that automation
 independently (`inotifywait`, `watchman`, PhpStorm file watchers, etc) but
 they all require manual setup, and vary in quality.

 We already have `grunt watch` available in our environment, so we can use
 it to provide a simple command like `grunt watch:phpunit`, making it easy
 to run the tests automatically.

 By default, it could watch all PHP files and execute all tests in the
 `phpunit:default` task, but I think it'd be necessary to have options for
 specifying the watch target, test groups, and PHPUnit config (AJAX,
 Multisite, etc).

 [attachment:42282.diff] is a very rough proof of concept that runs the
 `community-events` test group when changes are made inside `wp-
 admin/includes`.

 If this is eventually committed, we should update
 [https://make.wordpress.org/core/handbook/testing/automated-
 testing/phpunit/ the documentation] to show examples of using the
 different options.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42282#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list