Changes

Jump to: navigation, search

WebExtensions/Contribution Onramp

1,802 bytes added, 19:45, 10 September 2018
Testing: 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.
1,698
edits

Navigation menu