SoftwareTesting:Tools:SimpleXulTestHarness: Difference between revisions

Jump to navigation Jump to search
Massaged and prettied-up
(Massaged and prettied-up)
Line 1: Line 1:
= description =
= Description =
davel used this set of scripts to help verify that the default search engine plugins bundled with localised builds of firefox 2.0b2 were as expected.
davel used this set of scripts to help verify that the default search engine plugins bundled with localized builds of Firefox 2.0b2 work as expected.


The wrapper script extract_search.sh expects paths to firefox dmg files on the command line.  It installs firefox from each dmg, creates a new profile, runs the "test" to list the search engine stuff, then deletes the profile and that instance of firefox.
The wrapper script <tt>extract_search.sh</tt> expects paths to Firefox disk image (<tt>.dmg</tt>) files on the command line.  It installs Firefox from each disk image, creates a new profile, runs the "test" to list the search engine stuff, then deletes the profile and that instance of Firefox.


The wrapper script has the following assumptions:
The wrapper script makes the following assumptions:
* running on a mac
* Running on Mac OS X
* APP_DATA_DIR set to ~/Library/Application Support/Firefox
* <code>APP_DATA_DIR</code> set to ~/Library/Application Support/Firefox
** on my machine, I have a symlink to that dir from my home dir
** davel keeps a symlink to that directory from his home directory
* SEARCHTEST_DIR set to directory containing all these files
* <code>SEARCHTEST_DIR</code> set to directory containing all these files
* WORK_DIR set to a writable directory, use to install firefox and hold the newly-created profile
* <code>WORK_DIR</code> set to a writable directory, use to install Firefox and hold the newly-created profile
* tests.manifest contains a file: url link to the SEARCHTEST_DIR directory
* <tt>tests.manifest</tt> contains a file: url link to the <code>SEARCHTEST_DIR</code> directory
** hmm, we could make extract_search.sh edit the manifest file on the fly . . .
** A possible future improvement: we could make <tt>extract_search.sh</tt> edit the manifest file on the fly
* nothing is creating or deleting profiles while this script is running
* Nothing is creating or deleting profiles while this script is running
** changes to profiles.ini made by other things while this script is running will be clobbered.
** Changes to <tt>profiles.ini</tt> made by other things while this script is running will be removed


= how to run =
= How to run the test =
# download contents of [http://people.mozilla.com/~davel/scripts/ this directory] to a directory on your mac
# Download the contents of [http://people.mozilla.com/~davel/scripts/ this directory] to a directory on your Macintosh
# edit extract_search.sh and tests.manifest, replacing paths with the ones on your machine
# Edit <tt>extract_search.sh</tt> and <tt>tests.manifest</tt>, replacing paths with the ones on your machine
# download firefox .dmg files you want to "test"
# Download the Firefox disk image files you want to "test"
# invoke extract_search.sh
# Invoke <tt>extract_search.sh</tt>


==example==
==Example==
   <code>./extract_search.sh "en-US/Firefox 2.0 Beta 2.dmg" "en-GB/Firefox 2.0 Beta 2.dmg"</code>
   <pre>./extract_search.sh "en-US/Firefox 2.0 Beta 2.dmg" "en-GB/Firefox 2.0 Beta 2.dmg"</pre>
== output from above example ==
 
  <code><pre>
=== Output ===
<pre>
en-US/Firefox 2.0 Beta 2.dmg
en-US/Firefox 2.0 Beta 2.dmg
Agree Y/N? "disk1" unmounted.
Agree Y/N? "disk1" unmounted.
"disk1" ejected.
"disk1" ejected.
Success: created profile 'sbtestprofile /tmp/profile'
Success: created profile 'sbtestprofile /tmp/profile'
1|Google|http://www.google.com/search?q=foofoo&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a
1|Google|http://www.google.com/search?q=foofoo&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=Firefox-a
2|Yahoo|http://search.yahoo.com/search?p=foofoo&ei=UTF-8&fr=moz2
2|Yahoo|http://search.yahoo.com/search?p=foofoo&ei=UTF-8&fr=moz2
3|Amazon.com|http://www.amazon.com/s/002-3363096-7452819?ie=UTF8&tag=mozilla-20&index=blended&link%5Fcode=qs&field-keywords=foofoo&sourceid=Mozilla-search
3|Amazon.com|http://www.amazon.com/s/002-3363096-7452819?ie=UTF8&tag=mozilla-20&index=blended&link%5Fcode=qs&field-keywords=foofoo&sourceid=Mozilla-search
Line 42: Line 43:
"disk1" ejected.
"disk1" ejected.
Success: created profile 'sbtestprofile /tmp/profile'
Success: created profile 'sbtestprofile /tmp/profile'
1|Google|http://www.google.com/search?q=foofoo&ie=utf-8&oe=utf-8&rls=org.mozilla:en-GB:official&client=firefox-a
1|Google|http://www.google.com/search?q=foofoo&ie=utf-8&oe=utf-8&rls=org.mozilla:en-GB:official&client=Firefox-a
2|Yahoo.co.uk|http://uk.search.yahoo.com/search?p=foofoo&ei=UTF-8&fr=moz2
2|Yahoo.co.uk|http://uk.search.yahoo.com/search?p=foofoo&ei=UTF-8&fr=moz2
3|Amazon.co.uk|http://www.amazon.co.uk/s/202-2144193-3391812?ie=UTF8&tag=firefox-uk-21&index=blended&link%5Fcode=qs&field-keywords=foofoo&sourceid=Mozilla-search
3|Amazon.co.uk|http://www.amazon.co.uk/s/202-2144193-3391812?ie=UTF8&tag=Firefox-uk-21&index=blended&link%5Fcode=qs&field-keywords=foofoo&sourceid=Mozilla-search
### MRJPlugin:  getPluginBundle() here. ###
### MRJPlugin:  getPluginBundle() here. ###
### MRJPlugin:  CFBundleGetBundleWithIdentifier() succeeded. ###
### MRJPlugin:  CFBundleGetBundleWithIdentifier() succeeded. ###
Line 52: Line 53:
6|Creative Commons|http://search.creativecommons.org/?q=foofoo&sourceid=Mozilla-search
6|Creative Commons|http://search.creativecommons.org/?q=foofoo&sourceid=Mozilla-search
7|eBay.co.uk|http://search.ebay.co.uk/foofoo_W0QQfrppZ50QQfsopZ1QQmaxrecordsreturnedZ300
7|eBay.co.uk|http://search.ebay.co.uk/foofoo_W0QQfrppZ50QQfsopZ1QQmaxrecordsreturnedZ300
</pre></code>
</pre>
= comments =
 
* in the example, extract_search.sh demonstrates how to create a profile
= Comments =
** 2 steps - CreateProfile makes the directory and prefs.js file, and the first run populates the profile directory with all the other stuff
In the example, <tt>extract_search.sh</tt> demonstrates how to create a profile.  This takes two steps:
* the sleep 5 is necessary because firefox (on mac at least) restarts itself during the first-run process. probably extension manager checking for stuff
 
* installing an extension is not covered by this example
# <code>CreateProfile</code> makes the directory and <tt>prefs.js</tt> file.
= to do list =
# The first run populates the profile directory with all the other data.
* factor out the generic harness bits from the search engine lister bits
 
* figure out where/how to check this in to the tree
The sleep 5 is necessary because Firefox (at least on the Mac) restarts itself during the first-run process when the Extension Manager checks things out.
** as an extension, to populate chrome://tests/ ?
 
** how can test stuff from other parts of the tree get installed into chrome://tests/
In addition, this example doesn't cover installing an extension.
* add invocation hooks
 
** what test to run
= To do list =
** auto-discovery of tests?
* Factor out the generic harness bits from the search engine lister bits
** command -line pointer to test manifest file, like layout reftest?
* Figure out where/how to check this in to the tree
* add test result reporting
** As an extension, to populate <tt>chrome://tests/</tt>?
** simple dump statements
** How can test stuff from other parts of the tree get installed into <tt>chrome://tests/</tt>
** maybe a chrome test runner with progress bar, like jsunit's test runner
* Add invocation hooks
* make this work for already-installed firefox
** What test to run
* make this work on windows and linux
** Auto-discovery of tests?
* clean up output of search engine lister bits
** Command-line pointer to test manifest file, like layout reftest?
* Add test result reporting
** Simple dump statements
** Maybe a chrome test runner with progress bar, like jsunit's test runner
* Make this work for already-installed Firefox
* Make this work on Windows and Linux
* Clean up output of search engine lister bits
Confirmed users, Bureaucrats and Sysops emeriti
1,057

edits

Navigation menu