Running unit tests of JavaScript code from XUL - what and how

强颜欢笑 提交于 2019-12-03 03:16:52

You could try to have a look at Mozmill. It is an addon that can be used for testing all Gecko based applications.
You can use it to test UI interface of your application.
The documentation is quite ok and if you have any question you can try the dedicated mailing list.

I am successfully using Mochitest for an add-on, it should be usable in a XULRunner application in mostly the same way. You need the files under http://hg.mozilla.org/mozilla-central/file/tip/testing/mochitest/, use the "zip" link to download the directory contents. Put these files somewhere in your project and map this directory to chrome://mochitest/content/. Put your tests into the chrome/ subdirectory, there is extensive documentation on writing these tests. You could use runtests.py with --chrome command line options to start the tests but I doubt that this will be possible without tweaking the script. Opening chrome://mochitest/content/harness.xul in your application (as a XUL dialog or by specifying -chrome chrome://mochitest/content/harness.xul on the command line) should do as well.

Edit: I was wrong, the "zip" link downloads the entire repository. I don't know of any way to get a particular directory from the repository then, fastest solution should be running hg clone http://hg.mozilla.org/mozilla-central/ from the command line to get a copy of the entire repository.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!