Using MozMill to Test Standalone XUL Applications

As a follow-up to this question , I'm trying MozMill to test stand-alone XUL applications (not Firefox extensions). However, I have not yet "understood" - more precisely, how to test an application based on XULRunner.

Consider this application , for example. At the moment, I can run it from the command line, more or less this way:

$ /path/to/xulrunner /full/path/to/mozmillexample/application.ini 

I would like to write Mozmill scripts to test it. For example, I would like to write a test, such as this, that has a β€œtaste” of unit testing:

  Components.utils.import("chrome://mozmillexample/content/example.js", example); var setupModule = function(module) { module.controller = mozmill.getBrowserController(); // Or what? } var testEquals = function() { jumlib.assertEqual(example.exHello(), "Hello, World!", "Should be equal"); } 

I would also like to write some functional tests:

  Components.utils.import("chrome://mozmillexample/content/example.js", example); var setupModule = function(module) { module.controller = mozmill.getBrowserController(); // Or what? } var testAlerts = function() { var button = findElement.Elem(document.getElementById('button')); button.click(); controller.window.assertAlert(); // I bet it does not exist but it gives the idea... } 

Unfortunately, however, I did not find any documentation on testing stand-alone applications, at least not explaining the basic steps to anyone. So I ask: is it possible to write tests like these? How can I do this if possible?

0
javascript unit-testing tdd xul mozmill
source share
1 answer

I got it to work with the MozMill extension; unzip the extension and edit the following files:

  • add this to install.rdf in the right place:

     <em:targetApplication> <Description> <em:id>mozmill@example.com</em:id> <em:minVersion>0.9</em:minVersion> <em:maxVersion>1.1</em:maxVersion> </Description> </em:targetApplication>` 
  • create the "extensions" folder in the root of the application (where the application.ini and "chrome" and "defaults" files are indicated); insert the unpacked mammilla extension.

  • Enable extension manager as described in MDC

  • paste the MozMill extension code into your XULRunner application: <script src="chrome://mozmill/content/overlay.js"/>

  • Enable extension by adding or modifying %appdata%\Adam Brandizzi\MozMill Example\Profiles\123455.default\extensions.ini: [ExtensionDirs] Extension0=C:\Users\John\Desktop\myXULApp\extensions\mozmill

    • Use the following JS code to open MozMill: MozMill.onMenuItemCommand(event);
+3
source share

All Articles