130
edits
(Renamed section to resource types) |
(Added a section about writing tests) |
||
| Line 295: | Line 295: | ||
Once you have a patch file, add it as an attachment to the Bugzilla ticket you are working on and add the '''feedback?''' or '''review?''' flag depending on if you just want feedback and confirmation you're doing the right thing or if you think the patch is ready to land respectively. Read more about [https://developer.mozilla.org/en-US/docs/Developer_Guide/How_to_Submit_a_Patch how to submit a patch and the Bugzilla review cycle here]. | Once you have a patch file, add it as an attachment to the Bugzilla ticket you are working on and add the '''feedback?''' or '''review?''' flag depending on if you just want feedback and confirmation you're doing the right thing or if you think the patch is ready to land respectively. Read more about [https://developer.mozilla.org/en-US/docs/Developer_Guide/How_to_Submit_a_Patch how to submit a patch and the Bugzilla review cycle here]. | ||
= | = DevTools Automated Tests = | ||
We use three suites of tests: | We use three suites of tests: | ||
* '''xpcshell''': | * '''xpcshell''': Unit-test style of tests. No browser window, just a JavaScript shell. Mostly testing APIs directly. | ||
* '''mochitest-chrome''': | * '''mochitest-chrome''': Unit-test style of tests, but with a browser window. Mostly testing APIs that interact with the DOM directly. | ||
* '''mochitest-devtools''': | * '''mochitest-devtools''': Integration style of tests. Fires up a whole browser window with every test and you can test clicking on buttons, etc. | ||
More information about the different types of tests can be found on the [https://developer.mozilla.org/en-US/docs/Mozilla/QA/Automated_testing MDN automated testing page] | More information about the different types of tests can be found on the [https://developer.mozilla.org/en-US/docs/Mozilla/QA/Automated_testing MDN automated testing page] | ||
== Running DevTools Tests == | |||
To run all DevTools tests, regardless of suite type: | To run all DevTools tests, regardless of suite type: | ||
| Line 311: | Line 313: | ||
The following sections show more specific commands for running only a single suite or single test in a suite. | The following sections show more specific commands for running only a single suite or single test in a suite. | ||
== xpcshell Tests == | === xpcshell Tests === | ||
To run all of the xpcshell tests: | To run all of the xpcshell tests: | ||
| Line 321: | Line 323: | ||
$ ./mach xpcshell-test devtools/path/to/the/test_you_want_to_run.js | $ ./mach xpcshell-test devtools/path/to/the/test_you_want_to_run.js | ||
== Chrome Mochitests == | === Chrome Mochitests === | ||
To run the whole suite of chrome mochitests for DevTools: | To run the whole suite of chrome mochitests for DevTools: | ||
| Line 331: | Line 333: | ||
$ ./mach mochitest devtools/path/to/the/test_you_want_to_run.html | $ ./mach mochitest devtools/path/to/the/test_you_want_to_run.html | ||
== DevTools Mochitests == | === DevTools Mochitests === | ||
To run the whole suite of browser mochitests for DevTools (sit back and relax): | To run the whole suite of browser mochitests for DevTools (sit back and relax): | ||
| Line 348: | Line 350: | ||
$ ./mach mochitest devtools/client/path/to/the/test_you_want_to_run.js | $ ./mach mochitest devtools/client/path/to/the/test_you_want_to_run.js | ||
Note that the mochitests '''must''' have focus while running. | |||
== Writing Tests == | |||
When working on a patch for DevTools, there's almost never a reason not to add a new test. If you are fixing a bug, you probably should write a new test to prevent this bug from occurring again. If you're implementing a new feature, you probably should write many new tests to cover the various aspects of this new feature. | |||
You should ask yourself: | |||
* Are there enough tests for my patch? | |||
* Are they the right types of tests? | |||
To help with writing nice, maintainable and consistent DevTools mochitests, please follow our [https://wiki.mozilla.org/DevTools/mochitests_coding_standards DevTools mochitests coding guide]. | To help with writing nice, maintainable and consistent DevTools mochitests, please follow our [https://wiki.mozilla.org/DevTools/mochitests_coding_standards DevTools mochitests coding guide]. | ||
= Coding Standards = | = Coding Standards = | ||
edits