Skip to content
vesse edited this page Jun 26, 2012 · 29 revisions

QA Reports has two RESTful HTTP APIs for programmatically importing test reports, and updating the test cases of a existed report.

Personal Authentication Token is required for operating with the API. The token can be fetched via QA Reports web UI, by clicking the user name link at the upper right center of the page while logged in.

The API key is shown at the bottom of the User Preferences page:

/api/import

Description: Import test results Method: POST [encoding multipart/form-data]

Parameters:

Parameter name Description Values
auth_token Personal authentication token
release_version Release version 1.0, 1.1, 1.2
target Target profile Core, Handset, Netbook, IVI
testtype Test type Sanity, Acceptance, Basic Feature Testing etc
tested_at Timestamp of the test in format yyyy-mm-dd Optional. If not given, current date is used.
Example value: 2010-12-14
hwproduct Hardware Ia-Russellville, N900, Pinetrail etc
report, report.[1..n] Report file in XML format
attachment, attachment.[1..n] Files to be attached with the report: Screenshots, logs etc Optional
title Report title Optional. Default: value generated from other information if user defined title is not given.
objective_txt Test objective. Web UI markup can be used. Optional. Default: value is set from previous report if it exists.
build_txt Build (image) section content. Web UI markup can be used. Optional. Default: value is set from previous report if it exists.
environment_txt Test environment. Web UI markup can be used. Optional. Default: hwproduct name
qa_summary_txt Quality summary. Web UI markup can be used. Optional. Default: value is set from previous report if it exists.
issue_summary_txt Issue summary. Web UI markup can be used. Optional. Default: value is set from previous report if it exists.

The input can contain multiple report and attachment files. If multiple files are given, an unique field name have to be given for each file. Unique file names are created by giving a sequence number for each file starting from number 1, for example attachment.1, attachment.2 etc. If only on file is given, field can be used without sequence number, for example attachment.

Because multiple files can be uploaded, HTTP POST with multipart/form-encoding is used.

An example using Curl for testing the API:

curl --form report.1=@sim.xml  --form report.2=@bluetooth.xml --form attachment.1=coredump http://<server>/api/import?auth_token=<token>\&release_version=1.2\&target=Core\&testtype=Acceptance\&hwproduct=N900

The operation results status code in JSON format. If the operation proceeds successfully, key value pair "ok" = 1 is returned.

{"ok":"1"}

In case of error, ok values is 0, and an additional field errors describing the problem is returned

{"ok":"0","errors":"unknown attribute: foobar"}

/api/update/<Report_ID>

Description: Update the test cases of an existing report Method: POST [encoding multipart/form-data]

Parameters:

Parameter name Description
auth_token Personal authentication token
result_files[] Report file in XML or CSV format.
Report_ID The ID of the target report

The ID of the target report can be fetched from the URL of the corresponding report page, as shown in the picture below:

The input can contain multiple report files. If multiple report files are given, an unique report name have to be given for each file. Unique file names are created by giving a sequence number for each file starting from number 1, for example report.1, report.2 etc. If only one file is given, field can be used without sequence number, for example report.

Because multiple files can be uploaded, HTTP POST with multipart/form-encoding is used.

An example using Curl for testing the API:

curl --form report.1=@sim.xml  --form report.2=@bluetooth.xml http://<Server_Domain_Name>/api/update/<Report_ID>?auth_token=<token>

The operation results status code in [http://en.wikipedia.org/wiki/JSON JSON] format. If the operation proceeds successfully, key value pair "ok" = 1 is returned.

{"ok":"1"}

In case of error, ok values is 0, and an additional field errors describing the problem is returned

{"ok":"0","errors":"Request contained invalid files: ..."}

/api/merge/<Report_ID>

Description: Merge new result files to an existing report Method: POST [encoding multipart/form-data]

Parameters:

Parameter name Description
auth_token Personal authentication token
result_files[] Report file in XML or CSV format.
Report_ID The ID of the target report

The input can contain multiple report files. If multiple report files are given, simply set the result_files[] parameter several times, once for each file, e.g.

curl -F result_files[]=@sim.xml  -F result_files[]=@bluetooth.xml http://<Server_Domain_Name>/api/merge/<Report_ID>?auth_token=<token>

Because multiple files can be uploaded, HTTP POST with multipart/form-encoding is used.

The operation responds with a standard HTTP status code. In particular 200 for success and 422 when the files could not be processed.

Response Description Data
200 Success -
403 Invalid authentication token Error message in JSON format: {"errors": "<message>"}
404 Report not found -
422 Invalid result files Error message in JSON format: {"errors": "<message>"}

Clone this wiki locally