Created attachment 661629 [details] Pull request 575 There is a bunch of features that we do not test, or it is really difficult, for the sole reason that our test framework doesn't allow to do so. For example, localization, we added an hack in cfx in order to avoid shipping test locale files from addon-kit that are here just for tests. We do not test simple-prefs for real as we can't execute tests on a real addon. Tests are run against test-harness addon so that we can test properly any feature related to package.json without writing some python tests. At the end, we need a simple way to run test on a regular addon, without the test-harness thing or any non-regular startup process or environnement. In the following pull request, here is the implementation of what I had in mind long time ago while discussing in bug 730776: - Introduce a new folder in the SDK, here `/test-addons` at SDK root (but we can move it somewhere less visible) - in this folder, we put a set of tests addons with custom package.json, data files, modules, ... - we process each of these addons and just run them, exactly like `cfx run` - the main module of each addon has the responsability to run test, so that they have to include some piece of code to execute test. Similar to what is done for CommonJS module `require('api-utils/test').run(exports);`. But here they have to call this instead: require("test-harness/run-tests").runTestsFromModule(module); (we can tweak that, especially naming) This pull request allows to properly fix bug 730776. Will enable us to write proper tests against simple prefs and help me working on bug 786681 (content-permission attribute in package.json)
Irakli, you had some concerns when we discussed about such feature in bug 730776. I hope that this final solution addressed them. As it is a non-naive addition and might have some connection with packageless/new layout work, can you bless this patch (that has already been r+ by Erik).
(In reply to Alexandre Poirot (:ochameau) from comment #1) > Irakli, you had some concerns when we discussed about such feature in bug > 730776. > I hope that this final solution addressed them. > As it is a non-naive addition and might have some connection with > packageless/new layout work, can you bless this patch (that has already been > r+ by Erik). Looks good to me. I'd just suggest changing location from addon-sdk/test-addons to addon-sdk/test/addons since all the new tests in a future will be moving to addon-sdk/test/ so have test addons there would make more sense.
Commit pushed to master at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/57ca4fe43dd7058d6bd275f82e8714f8d132a6d7 Merge pull request #575 from ochameau/tests-addons Bug 791577: Support "test addons". r=@gozala
Oops, put the wrong r= on revision, all credits goes to Erik ;)