|
|
| Line 143: |
Line 143: |
| = DevTools Automated Tests = | | = DevTools Automated Tests = |
|
| |
|
| We use three suites of tests:
| | The contents of this section have been moved to https://dxr.mozilla.org/mozilla-central/source/devtools/docs/tests/README.md and other files in https://dxr.mozilla.org/mozilla-central/source/devtools/docs/tests/ |
| | |
| * '''xpcshell''': Unit-test style of tests. No browser window, just a JavaScript shell. Mostly testing APIs directly.
| |
| * '''mochitest-chrome''': Unit-test style of tests, but with a browser window. Mostly testing APIs that interact with the DOM directly.
| |
| * '''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]
| |
| | |
| == Running DevTools Tests ==
| |
| | |
| To run all DevTools tests, regardless of suite type:
| |
| | |
| $ ./mach test devtools/*
| |
| | |
| The following sections show more specific commands for running only a single suite or single test in a suite.
| |
| | |
| === xpcshell Tests ===
| |
| | |
| To run all of the xpcshell tests:
| |
| | |
| $ ./mach xpcshell-test --tag devtools
| |
| | |
| To run a specific xpcshell test:
| |
| | |
| $ ./mach xpcshell-test devtools/path/to/the/test_you_want_to_run.js
| |
| | |
| === Chrome Mochitests ===
| |
| | |
| To run the whole suite of chrome mochitests for DevTools:
| |
| | |
| $ ./mach mochitest -f chrome --tag devtools
| |
| | |
| To run a specific chrome mochitest:
| |
| | |
| $ ./mach mochitest devtools/path/to/the/test_you_want_to_run.html
| |
| | |
| === DevTools Mochitests ===
| |
| | |
| To run the whole suite of browser mochitests for DevTools (sit back and relax):
| |
| | |
| $ ./mach mochitest --subsuite devtools --tag devtools
| |
| | |
| To run a specific tool's suite of browser mochitests:
| |
| | |
| $ ./mach mochitest devtools/client/<tool>
| |
| | |
| For example, run all of the debugger browser mochitests:
| |
| | |
| $ ./mach mochitest devtools/client/debugger
| |
| | |
| To run a specific DevTools mochitest:
| |
| | |
| $ ./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].
| |
|
| |
|
| == Debugging Intermittent Test Failures == | | == Debugging Intermittent Test Failures == |