Testopia:Documentation:XMLRPC:Query Examples

From MozillaWiki
Revision as of 17:19, 2 October 2006 by Ghendricks (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Back to Testopia:Documentation:XMLRPC

Query Examples

Overview

Queries are based on Bugzilla's advanced searching using boolean charts.

This type of query can be found near the bottom of the "Advanced Search" tab on http://company.com/bugzilla/query.cgi

Charts are simple tables with rows and columns.

Each row has three columns:

  • Attribute
  • Operation
  • Value


Simple queries for a TestPlan might be:

Attribute Operation Value
plan_id equals 1
name anywords "Second"


Multiple rows are combined with a logical AND operation.

Advanced: Multiple charts are combined with a logical OR operation.

Attributes

  • Attributes are used to represent the lefthand-side (LHS) of given query operation
  • Attributes are the available public field names for any given object
    • See the API Object documentation for a list of attributes of each object
  • Currently there are two attribute data types: integers and strings

Values

  • Values are used to represent the righthand-side (RHS) of a given query operation
  • Values must be match their respective attribute's datatype

Operations

  • equals
  • notequals
  • isnull
  • isnotnull
  • lessthan
  • greaterhthan
  • regexp
  • noteregexp
  • anywords
  • allwords
  • nowords

Coding

In Bugzilla:

  • Attributes are called fields
  • Operations are called types

The keywords, field, type, and value are appended with "chart#-row#-column#" to create keys for the hashmap passed as our query.

The first row in chart 0 would have the following columns:

field0-0-0
type0-0-0
value0-0-0

Perl

%query = {
          field0-0-0 => "plan_id",
          type0-0-0  => "equals",
          value0-0-0 => 1
         };

Java

HashMap<String, Object> query = new HashMap<String, Object>();
query.put("field0-0-0", "name");
query.put("type0-0-0",  "anywords");
query.put("value0-0-0", "Second");




Back to the Testopia Main Page