TestService API

Use this web service to create test documentation, run tests, and record test results. The service is available after authorization. Every service method takes, as its first parameter, the key obtained after authorization.


Protocol: SOAP, WebService

Link: http://<host>/api/testservice

WSDL description (document/literal): http://<host>/api/testservice?wsdl

WSDL description (rpc/encoded): http://<host>/api/testservice?wsdl&style=rpc&use=encoded

Methods

Name Return value Purpose

Create (string token.Key, TestScenario object)

TestScenario

Creates a new test documentation section attached to the root node of the test documentation. Attributes of the new section are passed in the object parameter. Returns an object that describes the created test section.

Find (string token.Key, TestScenario object)

TestScenario

Loads attributes of a test documentation section by the parameters specified in object. If object.Id is set, the method searches by test section identifier. If object.Caption is set, it finds the section by name. Returns an object that describes the test section that was found.

Append (string token.Key, TestScenario parent, TestScenario object)

TestScenario

Creates a new test documentation subsection in an existing section identified by parent. Returns an object that describes the created test subsection.

Run (string token.Key, TestScenario object, string version, Environment environment)

TestExecution

Starts testing of the test documentation section passed as object. If that section has child sections, the test includes all child sections. When creating the test you can specify the version of the application under test and the environment where testing is performed. The environment is identified by environment.Caption. Configure the environment lookup in the project in advance. The method returns an object that describes the test.

ReportResult(string token.Key, TestExecution execution, TestScenario object, TestExecutionResult result)


Records the test result for a test section (object) within a test (execution). The result is identified by result.ReferenceName.

ReportIssue (string token.Key, TestExecution execution, TestScenario object, Request request)

Request

Registers a defect in the project found while testing a section (object) within a test (execution). Defect parameters, such as name, content, and so on, are set in the attributes of request. The method returns a Request object that describes the created Issue.

ReportFile (string token.Key, TestExecution execution, TestScenario object, Attachment file)


Uploads a file to the project related to the test results of a section (object) within a test (execution). You can upload a screenshot, a dump, or a log file related to the result.

GetResult (string token.Key, TestExecution execution)

TestExecutionResult

Returns the current test execution result as a TestExecutionResult object.

Classes

Name Attribute Purpose

TestScenario

Id

Object identifier


Caption

Test section name


Content

Test section content


ParentPage

Identifier of the parent test section

Environment

Id

Object identifier


Caption

Environment name, a unique value used to identify the environment

TestExecutionResult

Id

Object identifier


Caption

Display name of the result


ReferenceName

Code name of the result, a unique value used to identify the result type

Request

Id

Object identifier


Caption

Issue/defect name


Description

Issue/defect description

Attachment

Id

Object identifier


FilePath

File name that will be displayed in the project


FileExt

File MIME type


File

A base64binary text field that contains the file body in base64 encoding

Examples (C#)

 // авторизуемся в проекте
 security.SecurityService api = new security.SecurityService() { 
      Url = 'http://<host>/api/securityservice'
 };
 
 security.Token _token = api.login("guest", "guest", "development");
 
 // создаем тестовый раздел документации
 testing.TestService _api = new testing.TestService() { 
      Url = 'http://<host>/api/testservice'
 };
 
 testing.testscenario root = new testing.testscenario { Caption = "Название 1"};
 root = _api.Create(_token.Key, root);
 
 // добавляем дочерний раздел
 testing.testscenario child = new testing.testscenario { Caption = "Название 2", Content = "Содержание 2" };
 child = _api.Append(_token.Key, root, child);
 
 // запускаем тест на выполнение
 testing.testexecution execution =
      _api.Run(_token.Key, root, "1.1", new testing.environment { Caption = "Windows XP" } );
 
 // устанавливаем результат тестирования по дочернему разделу
 _api.ReportResult(_token.Key, execution, child,
      new testing.testexecutionresult { ReferenceName = "failed" });
 
 // регистрируем ошибку
 testing.request bug = new testing.request { Caption = "Ошибка в тесте 2" };
 bug = _api.ReportIssue(_token.Key, execution, child, bug);
 
 // загружаем файл, например, дамп
 string fileName = Environment.GetEnvironmentVariable("windir") + "\\notepad.exe";
 FileStream fs = File.Open(fileName, FileMode.Open, FileAccess.Read);
 
 byte[] fileBytes = new byte[fs.Length];
 fs.Read(fileBytes, 0, (int)fs.Length);
 fs.Close();
 
 testing.attachment file = testing.attachment
 {
     FilePath = "notepad.exe",
     FileExt = (new FileInfo(fileName)).Extension,
     File = fileBytes
 };
 
 _api.ReportFile(_token.Key, execution, child, file);