Jeff Webster
unread,Jul 20, 2009, 1:39:38 PM7/20/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to MozLab
We think MozUnit will really help us test our new XULRunner
application. However, as of right now I am unable to successfully
import any of our javascript code modules into our MozUnit tests. As
just suggested, we have our javascript code broken into modules,
loadable by the Components.utils.import function. We wish to unit
test those modules.
Our first minor issue was in actually attaching the MozUnit test
script file to one of our code modules directly using the
Components.utils.import function, but ran into two problems:
1) MozUnit is not part of our application, and as such has no concept
of the resource bindings defined in our application's chrome manifest
file.
2) The Components.utils.import function seems to not be available at
all, given by the following error in MozUnit:
Run failed. [Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXPCComponents_Utils.import]" nsresult:
"0x80040111 (NS_ERROR_NOT_AVAILABLE)" location "JS frame ::
chrome://mozunit/content/ui.js -> file:///irrelevant/path/test/mozUnit.js
:: <TOP_LEVEL> :: line 4" data: no]
We were able to get around this by using the loadSubScript
functionality, but it's not ideal since it hard-codes the path to the
code module instead of using chrome's url mapping capability already
defined in our manifest.
Our major issue is related. Once we actually had the code module
imported using loadSubScript, we immediately recognized it was
unusable as is in MozUnit because our code modules import each other
as necessary. Upon running, MozUnit reported the following error:
Run failed. [Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXPCComponents_Utils.import]" nsresult:
"0x80040111 (NS_ERROR_NOT_AVAILABLE)" location "JS frame ::
chrome://mozunit/content/ui.js -> file:///irrelevant/path/test/mozUnit.js
-> file:///irrelevant/path/chrome/modules/config.js :: <TOP_LEVEL> ::
line 11" data: no]
Our question is how do we get MozUnit to read our code modules which
use Components.utils.import to load each other?
Thanks, and we love what we so far -- we just hope we'll be able to
use it!
--Jeff