1,698
edits
Caitmuenster (talk | contribs) (created page) |
Caitmuenster (talk | contribs) (→Testing: testing) |
||
Line 17: | Line 17: | ||
== Testing == | == Testing == | ||
In order to land code in Firefox, you will need to create tests for your patches. For an overview of the different test systems Firefox uses, please see this [https://developer.mozilla.org/en-US/docs/Mozilla/QA/Automated_testing overview of automated testing]. In the WebExtension API code, most tests are either [https://developer.mozilla.org/en-US/docs/Mozilla/QA/Writing_xpcshell-based_unit_tests xpcshell tests] or [https://developer.mozilla.org/en-US/docs/Mozilla/Browser_chrome_tests browser chrome tests]. Xpcshell tests are preferred because of the lower overhead. Browser tests need to be written when a test interfaces with browser UI, such as tabs or context menus. | |||
The easiest way to get started with tests is to look at existing tests: | |||
* Xpcshell tests: | |||
** toolkit/components/extensions/test/xpcshell/ ([https://searchfox.org/mozilla-central/source/toolkit/components/extensions/test/xpcshell Searchfox link]) | |||
** browser/components/extensions/test/xpcshell/ ([https://searchfox.org/mozilla-central/source/browser/components/extensions/test/xpcshell Searchfox link]) | |||
* Browser-chrome tests: | |||
** toolkit/components/extensions/test/browser/ ([https://searchfox.org/mozilla-central/source/toolkit/components/extensions/test/browser Searchfox link]) | |||
** browser/components/extensions/test/browser/ ([https://searchfox.org/mozilla-central/source/browser/components/extensions/test/browser Searchfox link]) | |||
These tests can be run with the “mach test” command. To run a specific test, use “mach test [paths to test files or directories]”. | |||
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. |
edits