Auto-tools/Projects/CrossWeave: Difference between revisions

 
Line 1: Line 1:
This page is obsolete, documentation for TPS (formerly Crossweave) may now be found at https://developer.mozilla.org/en/TPS
This page is obsolete, documentation for TPS (formerly Crossweave) may now be found at https://developer.mozilla.org/en/TPS
== How it works ==
CrossWeave consists of a Firefox extension of the same name, along with a python test runner.  The python test runner will read a test file (in JSON format), setup a Firefox profile with the necessary extensions and preferences, then launch Firefox and pass the test file to the CrossWeave extension.  The extension will read the test file and perform a series of actions specified therein, such as populating a set of bookmarks, syncing to the weave server, making bookmark modifications, etc.
A test file may contain an arbitrary number of sections, each involving the same or different profiles, so that one test file may be used to test the effect of syncing and modifying a common set of data (from a single Weave account) over a series of different events and clients.
The easiest way to understand this is to look at a simple CrossWeave test file.
setup:
  profiles:
    * profile1
    * profile2
bookmark-list-1:
  menu:
    * uri: http://www.google.com
      title: google.com
      changes:
        title: Google
    * folder: foldera
    * folder: folderb
  menu/foldera:
    * uri: http://www.yahoo.com
      title: testing Yahoo
      changes:
        location: menu/folderb
bookmark-list-2:
  menu:
    * uri: http://www.google.com
      title: Google
    * folder: foldera
    * folder: folderb
  menu/folderb:
    * uri: http://www.yahoo.com
      title: testing Yahoo
phase1:
  profile: profile1
  actions:
    * add:
        bookmarks: bookmark-list-1
    * sync: all
      wipe-server: true
phase2:
  profile: profile2
  actions:
    * sync: all
    * verify:
        bookmarks: bookmark-list-1
    * modify:
        bookmarks: bookmark-list-1
    * sync: all
phase3:
  profile: profile1
    actions:
      * sync: all
      * verify:
          bookmarks: bookmark-list-2
The effects of this test file will be:
# Firefox is launched with profile1, the CrossWeave extension adds the two bookmarks specified in the "bookmarks-initial" array, then they are synced to the Weave server.  The "wipe-server" property causes CrossWeave to set the firstSync=wipeServer pref, in case the Weave account already contains data.  Firefox closes.
# Firefox is launched with profile2, and all data is synced from the Weave server.  The CrossWeave extension verifies that all bookmarks in the "bookmarks-list-1" list are present.  Then it modifies those bookmarks by applying the "changes" property to each of them.  E.g., the title of the first bookmark is changed from "google.com" to "Google".  Next, the changes are synced to the Weave server.  Finally, Firefox closes.
# Firefox is launched with profile1 again, and data is synced from the Weave server.  The CrossWeave extension verifies that the bookmarks in "bookmarks-list-2" list are present; i.e., all the changes performed in profile2 have successfully been synced to profile1.  Lastly, Firefox closes and the tests ends.
This is a simple case, but CrossWeave will support tests of greater complexity, involving an arbitrary number of phases, actions and clients.  Test actions will allow interaction with all types of data supported by Weave.
For a more complex example, see: http://hg.mozilla.org/automation/crossweave/file/f35c4dd23dea/sync.test
Confirmed users
1,905

edits