47
edits
(Update section on setting up the development environment. Add more explicit instructions on submitting a patch.) |
(--log-mach-verbose is not really documented anywhere (https://bugzilla.mozilla.org/show_bug.cgi?id=1656513 ). Add it here, along with other tips for testing.) |
||
Line 47: | Line 47: | ||
** mobile/android/components/extensions/test/mochitest ([https://searchfox.org/mozilla-central/source/mobile/android/components/extensions/test/mochitest Searchfox link]) | ** mobile/android/components/extensions/test/mochitest ([https://searchfox.org/mozilla-central/source/mobile/android/components/extensions/test/mochitest Searchfox link]) | ||
These tests can be run with the | === Running tests === | ||
Sometimes | These tests can be run with the <code>mach test</code> command. To run specific test(s), pass the name of the test file or directory to <code>mach test</code>. | ||
Sometimes <code>mach test</code> has bugs (e.g. [https://bugzilla.mozilla.org/show_bug.cgi?id=1498636 bug 1498636] and [https://bugzilla.mozilla.org/show_bug.cgi?id=1495311 bug 1495311]); in that case use <code>mach xpcshell-test</code> or <code>mach mochitest</code> instead of <code>mach test</code> to run the test. | |||
<code>mach test</code> has minimal output by default. To debug test failures, increase the verbosity of the logs with the <code>--verbose --log-mach-verbose</code> flags. The <code>--sequential</code> flag is not required, but allows for easier debugging because only one test is run at a time (instead of multiple in parallel). Al together, the command to run tests and get maximum debug output is: | |||
<code>mach test --verbose --log-mach-verbose --sequential [paths to test files]</code> | |||
=== Adding new tests === | |||
Add your test to an existing file when it is small and fits in that test. Otherwise, create a new test file, and register the test file in one of the .ini files in the same directory as your test, usually browser-common.ini or xpcshell-common.ini. | Add your test to an existing file when it is small and fits in that test. Otherwise, create a new test file, and register the test file in one of the .ini files in the same directory as your test, usually browser-common.ini or xpcshell-common.ini. | ||
After creating a new test file, run <code>mach build</code> before running tests. It is not necessary to rebuild if you are changing an existing test file. | |||
A test consists of multiple subtasks, which are defined in the test files via add_task(...). | A test consists of multiple subtasks, which are defined in the test files via add_task(...). |
edits