Firebug Test Bot Database

From FirebugWiki
Revision as of 06:10, 28 November 2012 by Honza (Talk | contribs)

Jump to: navigation, search

Firebug Test Bot is using CouchDB for storing all test results.


Test Results DB

Test results produced by running Firebug test suite are stored into a CouchDB (document-oriented database). The database is available online and all test results (stored as documents) can be accessed using XHR.

Testbot results are stored as documents and there are currently following types of docs.

  • header this document represents a single test-bot run.
  • result represents a test result (one Firebug test executed). The relation between header and result documents is one-to-many. There are many results for one test-bot run (the number of results corresponds to number of tests in the used test list). The relation is made through a headerid filed that is part of each result doc.

The database contains also test-results reported by users who run automated tests manually using Firebug Test Console (FBTest). These results use following doc types.

  • user-header represents a user test launch.
  • user-results represents a user test result.

Test Results UI

Summary of testbot results is available online. This page displays both (a) testbot and (b) user results as two separate lists. Source code of this application is available.

Custom CouchDB can be passed through URL as follows:

Setup New DB

As soon as CouchDB is installed you can create databases. Firebug test-results database uses specific schema that the defined in design-documents. These documents are JSON based, just like any other doc in the database.

Database schema (design documents) are described here.


Following instructions are using as an existing CouchDB installation.

Create New Database

Open and click Create Database and provide a name. This scenario is using Template, but you need to provide your own name of course.

Open The Database

The new database should be available here:

Create New Temporary View

Pick Temporary view... option from the View Field.


Create New Design Document

Click Save As... button at the bottom and provide allfailures for the Design Document and test for the view. The View name is not important now, it'll be changed later as we copy the template JSON document.


Open Design Document

Click the list of Views again (you should see a new entry: allfailures). Pick the Design Documents option to open list of all design documents (we have one at this moment).


Edit Design Document

Click on the only displayed entry (there is one design document) and consequently double-click on the source-content (JSON) to start editing.


Define 'allfailures' Views

The selected part on the previous screenshot needs to be replaced by the following definition:

"views": {
       "allfailures": {
           "map": "function(doc)\n{\n if (doc.type == \"result\" && doc.result == \"TEST-UNEXPECTED-FAIL\")\n emit(doc.file, doc);\n}",
           "reduce": "function(keys, values, rereduce) {\n var output = {\n count: 0,\n file: null,\n };\n\n if (rereduce)\n {\n for (idx in values)\n {\n var doc = values[idx];\n if (doc.count !== undefined)\n output.count += doc.count;\n }\n }\n else\n {\n for (idx in values)\n {\n var doc = values[idx];\n output.count += 1;\n output.file = doc.file;\n }\n }\n return output;\n}"

Click Save Document at the top to save the changes.

Define 'resultviews' Views

Now go to the list of Design Documents by clicking on the Template (name of your database) at the top. Create a new Temporary View and save it. Design Document: resultviews View Name: test (again, will be redefined)