User:IHurbainPalatin (WMF)/Useful core test shortcuts for pre-push
Appearance
Problem
[edit]- Shipping things to CI without running tests locally adds time to the ideal feedback loop
- Running ALL THE TESTS on core takes a fairly long time
- Running ALL THE TESTS on core tends to interact the with local dev environments, which may or may not be up-to-date on all skins, extensions, etc.
Objective
[edit]Knowing how to locally run a "reasonably covering" set of "tests that have a higher chance to break with my current set of changes" (assuming said set is known).
HOWTO
[edit]Run tests in a single directory or file
[edit]$ composer phpunit -- <path>
Useful suites
[edit]# core parser tests
$ composer phpunit -- tests/phpunit/suites/CoreParserTestSuite.phpunit
# core unit tests (beware: this probably runs less things than you think it does)
$ composer run phpunit -- --testsuite=core:unit
# all parser tests, including installed extensions
$ composer phpunit -- --testsuite=parsertests
Run with a non-default LocalSettings.php
[edit]# If no extensions are defined in this config file, this is equivalent to running
# CoreParserTestSuite.php as above; otherwise it also runs parserTests in extensions
$ MW_CONFIG_FILE=LocalSettings-stripped.php composer run phpunit -- --testsuite=parsertests