Access Keys:
Skip to content (Access Key - 0)
Log in (Access Key - 5)



Toggle Sidebar

Commandline

Contents:


Start Molybdenum from command line

Molybdenum test execution can be started via commandline by starting firefox with some additional parameters.
All paths in the examples are Unix paths but Windows paths will work as well.

Assuming the firefox executable is on the path it's looking like that:

firefox -mo

This will work only, if no Firefox is running already. If you want to start an additional firefox instance for testing, you have to do two things:

  • create and use an extra profile
  • start firefox with --no-remote option

Information how to deal with Firefox profiles can be found here.
Why we have to create an extra profile? Because each firefox instance has to have its own profile. Two instances can never run on the same profile.
The option --no-remote is telling Firefox to not to use an already running instance.
Now we are putting these things together:

firefox --no-remote -P mytestprofile -mo

...where mytestprofile is a newly created profile for our test runs.

This will start Firefox with Molybdenum window opened immediately.

Executing a single testsuite or a schedule containing multiple suites

Thats nice but doesn't help so much for test automation. So we will load a testsuite automatically by passing the url or path as command line option as well.

firefox
  --no-remote
  -P mytestprofile
  -mo mytestsuite.xml

The argument right after the -mo option can be an url or path of a test suite or a schedule. Molybdenum will load that file automatically, executing the tests and exiting.

Writing an XML / HTML report after testrun

Now we want to write a report about the test execution.

firefox
  --no-remote
  -P mytestprofile
  -mo mytestsuite.xml
  -report /home/johndo/mytestsuite.html

The path after -report has to be an absolute path.

Speeding up test execution

If Molybdenum is executed automatically by a CI server, the test execution can be speed up by switching off some UI activity of Molybdenum.

firefox
  --no-remote
  -P mytestprofile
  -mo mytestsuite.xml
  -report /home/johndo/mytestsuite.html
  -headless
  • If you have thousands of testcases and molybdenum needs a while to load these, Adjust firefox properties dom.max_chrome_script_run_time and dom.max_script_run_time to your needs. This has to be done in user.js in your firefox profile or by calling the URL about:config in firefox.

The "autostart" argument

Finally we can pass an autostart argument to parameterize our testscripts:

firefox
  --no-remote
  -P mytestprofile
  -mo mytestsuite.xml
  -report /home/johndo/mytestsuite.html
  -headless
  -autostartarg myvarvalue

Find out more about Parameterization.

Redirecting Firefox error console to system out / logfile

To enable logging set firefox property browser.dom.window.dump.enabled to true. This has to be done in user.js in your firefox profile or by calling the URL about:config in firefox. Afterwards redirect the output when starting firefox by using a pipe:

firefox
  --no-remote
  -P mytestprofile
  -mo mytestsuite
  -X 
   > /redirect/to/file.log

Redirecting System Out does not work under Windows. Use "-console" instead.

The optional parameter -X will add any entries in your firefox error console like Javascript or CSS errors or warnings.
Output should look similar to this:

cmdline args:
 autostartArgument=http://websvnurl/config/trunk.xml
 testUri=http://websvnurl/testcases/schedule-all.xml
 autostartReportPath=/home/www/htdocs/trunk/report.html
 autostartHeadless=true
 errorConsoleInclusion=null
 errorConsoleExclusion=null
Loading testcase (1 of 454) http://websvnurl/testcases/ABC/molybdenum.xml ...
Loading testcase (2 of 454) http://websvnurl/testcases/DEF/molybdenum.xml ...
Loading testcase (3 of 454) http://websvnurl/testcases/GHI/molybdenum.xml ...
Loading testcase (4 of 454) http://websvnurl/testcases/JKL/molybdenum.xml ...
Loading testcase (5 of 454) http://websvnurl/testcases/MNO/molybdenum.xml ...
Loading testcase (6 of 454) http://websvnurl/testcases/PQR/molybdenum.xml ...
...
Running all testcases Mon Sep 15 2008 05:10:17 GMT+0200 (CEST)...
Testcase: My Simple Test (http://websvnurl/testcases/ABC/molybdenum.xml)

 URL loaded: chrome://molybdenum/content/opener.html
...
  [console] JavaScriptError: error in abc.js ...

You can further filter your outputs by using

-include=[jswarning|jserror]
-exclude=[jswarning|jserror]

Because normally you don't want to see "warnings" in your logfile, just errors.
This concept will be extended further to allow real patterns to be matched.

last edited on Jun 17, 2009 17:23
Adaptavist Theme Builder Powered by Atlassian Confluence