[wp-trac] [WordPress Trac] #57844: Tests/Script Loader: Run build step in PHP Unit test actions.
WordPress Trac
noreply at wordpress.org
Sun May 21 10:21:10 UTC 2023
#57844: Tests/Script Loader: Run build step in PHP Unit test actions.
------------------------------------+---------------------
Reporter: peterwilsoncc | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.3
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: has-patch close commit | Focuses:
------------------------------------+---------------------
Comment (by SergeyBiryukov):
Replying to [comment:13 azaozz]:
> Replying to [comment:12 SergeyBiryukov]:
> > #51734 had some good arguments for running PHPUnit tests from `src`
instead of `build`
> > ...
> > I find it very helpful that the build step is currently not required
for that, saves a lot of time :)
>
> Yep, I agree, PHPUnit testing in `/src` is faster and more convenient
for developers. But it also has one big problem: testing from `/src` does
not test some of the production (built) files. That makes it unreliable.
>
> So perhaps running PHPUnit tests from `/src` may be considered
"developer convenience" but imho should not be considered acceptable for
production testing of WordPress. I.e. tests that run after a commit should
probably be testing the production files, not the "development (partial)
build" in /src.
Should testing of the production files perhaps be considered integration
or e2e testing (and be a part of the e2e test suite, for example), rather
than unit testing?
My understanding is that unit tests are supposed to be mostly focused on
individual functions or classes:
* [https://circleci.com/blog/unit-testing-vs-integration-testing/ Unit
testing vs integration testing]
* [https://martinfowler.com/articles/practical-test-pyramid.html The
Practical Test Pyramid]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57844#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list