C# Class Meyn.TestLink.TestLink

this is the proxy class to connect to TestLink. It provides a list of functions that map straight into the Tstlink API as it stands at V 1.9.2
This class makes use of XML-RPC.NET Copyright (c) 2006 Charles Cook
Inheritance: ITestLinkExtra
显示文件 Open project: apetrovskiy/STUPS Class Usage Examples

Public Methods

Method Description
CreateBuild ( int testplanid, string buildname, string buildnotes ) : GeneralResult

create a build for a testplan

CreateProject ( string projectname, string testcasePrefix, string notes = "" ) : GeneralResult

create a new project

CreateTestCase ( string authorLogin, int testsuiteid, string testcasename, int testprojectid, string summary, TestStep steps, string keywords, int order, bool checkduplicatedname, ActionOnDuplicatedName actiononduplicatedname, int executiontype, int importance ) : GeneralResult

Create a new Test Case

CreateTestCase ( string authorLogin, int testsuiteid, string testcasename, int testprojectid, string summary, string keywords, int order, bool checkduplicatedname, ActionOnDuplicatedName actiononduplicatedname, int executiontype, int importance ) : GeneralResult

create a new Testcase without having to specify test steps

Create a new Test Case

CreateTestPlan ( string testplanname, string testProjectName, string notes = "", bool active = true ) : GeneralResult

create a new Testplan

CreateTestSuite ( int testprojectid, string testsuitename, string details, int parentId, int order, bool checkduplicatedname = true ) : GeneralResult

create a new test suite

DeleteExecution ( int executionid ) : GeneralResult

delete an execution. Current status this API is not fully functioning as it is not clear how to configure testlink to allow this to happen

DoesUserExist ( string username ) : bool

check for user id to see whether it exists

GetBuildsForTestPlan ( int testplanid ) : List

get a list of all builds for a testplan

GetFirstLevelTestSuitesForTestProject ( int testprojectid ) : List

get all top level test suites for a test project

GetLastExecutionResult ( int testplanid, int testcaseid ) : ExecutionResult

get the last execution result

GetLatestBuildForTestPlan ( int tplanid ) : Build

get the newest build for a test plan

GetProject ( string projectname ) : TestProject

get a single Project

GetProjectTestPlans ( int projectid ) : List

get a list of all testplans for a project

GetProjects ( ) : List

get a list of all projects

GetTestCase ( int testcaseid, int versionId ) : TestCase

get a test case by its id

GetTestCaseAttachments ( int testCaseId ) : List

retrieve the attachments for a test case

GetTestCaseIDByName ( string testcasename ) : List

get a list of test case ids with this name.

GetTestCaseIDByName ( string testcasename, int testSuiteId ) : List

get a test cases by this name

GetTestCaseIDByName ( string testcasename, string testsuitename ) : List

ask for a test case by name.

Searching is case sensitive.

GetTestCaseIdsForTestSuite ( int testSuiteid, bool deep ) : List

get a list of testcase ids of test cases contained in a test suite

GetTestCasesForTestPlan ( int testplanid ) : List

get all test cases for a test plan

GetTestCasesForTestPlan ( int testplanid, int testcaseid ) : List

get all test cases for a test plan .

The same test case id can show up multiple times, once per platform.

GetTestCasesForTestPlan ( int testplanid, int testcaseid, int buildid ) : List

get all test cases for a test plan .

The same test case id can show up multiple times, once per platform.

GetTestCasesForTestPlan ( int testplanid, int testcaseid, int buildid, int keywordid ) : List

get all test cases for a test plan .

The same test case id can show up multiple times, once per platform.

GetTestCasesForTestPlan ( int testplanid, int testcaseid, int buildid, int keywordid, bool executed ) : List

get all test cases for a test plan .

The same test case id can show up multiple times, once per platform.

GetTestCasesForTestPlan ( int testplanid, int testcaseid, int buildid, int keywordid, bool executed, int assignedTo ) : List

get all test cases for a test plan .

The same test case id can show up multiple times, once per platform.

GetTestCasesForTestPlan ( int testplanid, int testcaseid, int buildid, int keywordid, bool executed, int assignedTo, string executedstatus ) : List

get all test cases for a test plan .

The same test case id can show up multiple times, once per platform.

GetTestCasesForTestSuite ( int testSuiteid, bool deep ) : List

get test cases contained in a test suite

GetTestPlanPlatforms ( int testplanid ) : List

get a list of all platforms for a test plan.

Throws an exception of type Testlink Exception

GetTestSuiteById ( int id ) : TestSuite

get a test suite by its id

GetTestSuitesForTestPlan ( int testplanid ) : List

get test suites for a test plan

GetTestSuitesForTestSuite ( int testsuiteid ) : List
GetTotalsForTestPlan ( int testplanid ) : List

get totals for a testplan

If a test plan has no executions to it you will still get a list iwth a single item. That item will have zeros in its totals

ReportTCResult ( int testcaseid, int testplanid, TestCaseResultStatus status, int platformId, string platformName = null, bool overwrite = false, bool guess = true, string notes = "", int buildid, int bugid ) : GeneralResult

Record the outcome of a test case execution

SayHello ( ) : string

basic Ping

TestLink ( string apiKey, string url ) : System

default constructor

TestLink ( string apiKey, string url, bool log ) : System

constructor with debug key

constructor with URL and log flag

UploadExecutionAttachment ( int executionId, string filename, string fileType, byte content, string title = "", string description = "" ) : AttachmentRequestResponse

Uploads an attachment for an execution.

The attachment content must be Base64 encoded by the client before sending it.

UploadTestCaseAttachment ( int testcaseid, string filename, string fileType, byte content, string title, string description ) : AttachmentRequestResponse

upload an attachment for a test case

UploadTestProjectAttachment ( int executionId, string filename, string fileType, byte content, string title = "", string description = "" ) : AttachmentRequestResponse

upload an attachment to a test project

UploadTestSuiteAttachment ( int testsuiteid, string filename, string fileType, byte content, string title, string description ) : AttachmentRequestResponse

upload an attachment for a test case

about ( ) : string

Gets info about the API

addTestCaseToTestPlan ( int testprojectid, int testplanid, string testcaseexternalid, int version, int platformid ) : int

add a test case to a test plan (no way of removing one)

this testExternalid is a string and a concatenation of the test project prefix and the externalid that is reported in the test case creation.

checkDevKey ( string devkey ) : bool

check if Developer Key exists

getTestPlanByName ( string projectname, string planName ) : TestPlan

get a test plan for a project

Private Methods

Method Description
decodeErrors ( IEnumerable messageList ) : List

internal. try to conver the struct to an error message. Return null if it wasn't one

decodeErrors ( object messageList ) : List
decodeSingleError ( CookComputing.XmlRpc.XmlRpcStruct message ) : TLErrorMessage
handleErrorMessage ( object errorMessage ) : bool

process the response object returned by the Tstlink API for error messages. if it finds one or more error messages it throws a TLINK Exception ///

handleErrorMessage ( object errorMessage, int exceptedErrorCodes ) : bool

process the response object returned by the Tstlink API for error messages. if it finds one or more error messages it throws a TLINK Exception ///

handleReportTCResult ( object response ) : GeneralResult
myHandler ( object sender, CookComputing.XmlRpc.XmlRpcRequestEventArgs args ) : void
processTestCaseId ( object response ) : List
proxy_ResponseEvent ( object sender, CookComputing.XmlRpc.XmlRpcResponseEventArgs args ) : void
stateIsValid ( ) : void

check that the state of the interface

Method Details

CreateBuild() public method

create a build for a testplan
public CreateBuild ( int testplanid, string buildname, string buildnotes ) : GeneralResult
testplanid int id of the test plan
buildname string name of the build
buildnotes string notes
return GeneralResult

CreateProject() public method

create a new project
public CreateProject ( string projectname, string testcasePrefix, string notes = "" ) : GeneralResult
projectname string
testcasePrefix string prefix for test case ids
notes string
return GeneralResult

CreateTestCase() public method

Create a new Test Case
public CreateTestCase ( string authorLogin, int testsuiteid, string testcasename, int testprojectid, string summary, TestStep steps, string keywords, int order, bool checkduplicatedname, ActionOnDuplicatedName actiononduplicatedname, int executiontype, int importance ) : GeneralResult
authorLogin string login id of test case author
testsuiteid int Id of test suite
testcasename string name of test case
testprojectid int id of test project
summary string summary of result
steps TestStep Array of test steps
keywords string
order int defaultOrder = 0, otherwise location in sequence to other testcases
checkduplicatedname bool 1=yes, 0=no
actiononduplicatedname ActionOnDuplicatedName one of block, generate_new, create_new_version
executiontype int manual:1, automated: 2,
importance int Importance of test case
return GeneralResult

CreateTestCase() public method

create a new Testcase without having to specify test steps Create a new Test Case
public CreateTestCase ( string authorLogin, int testsuiteid, string testcasename, int testprojectid, string summary, string keywords, int order, bool checkduplicatedname, ActionOnDuplicatedName actiononduplicatedname, int executiontype, int importance ) : GeneralResult
authorLogin string login id of test case author
testsuiteid int Id of test suite
testcasename string name of test case
testprojectid int id of test project
summary string summary of result
keywords string
order int defaultOrder = 0, otherwise location in sequence to other testcases
checkduplicatedname bool 1=yes, 0=no
actiononduplicatedname ActionOnDuplicatedName one of block, generate_new, create_new_version
executiontype int manual:1, automated: 2,
importance int Importance of test case
return GeneralResult

CreateTestPlan() public method

create a new Testplan
public CreateTestPlan ( string testplanname, string testProjectName, string notes = "", bool active = true ) : GeneralResult
testplanname string the name of the plan
testProjectName string the name of the test project that contains the test plan
notes string
active bool whether this plan is currently active
return GeneralResult

CreateTestSuite() public method

create a new test suite
public CreateTestSuite ( int testprojectid, string testsuitename, string details, int parentId, int order, bool checkduplicatedname = true ) : GeneralResult
testprojectid int id of test project
testsuitename string Name of this test suite
details string
parentId int parent test suite id. Optional
order int display order with sibling test suites. Optional
checkduplicatedname bool if true, throw an error of a duplicate name exists. Optional, default=true
return GeneralResult

DeleteExecution() public method

delete an execution. Current status this API is not fully functioning as it is not clear how to configure testlink to allow this to happen
public DeleteExecution ( int executionid ) : GeneralResult
executionid int the id of the test case execution
return GeneralResult

DoesUserExist() public method

check for user id to see whether it exists
public DoesUserExist ( string username ) : bool
username string
return bool

GetBuildsForTestPlan() public method

get a list of all builds for a testplan
public GetBuildsForTestPlan ( int testplanid ) : List
testplanid int the id of the testplan
return List

GetFirstLevelTestSuitesForTestProject() public method

get all top level test suites for a test project
public GetFirstLevelTestSuitesForTestProject ( int testprojectid ) : List
testprojectid int
return List

GetLastExecutionResult() public method

get the last execution result
public GetLastExecutionResult ( int testplanid, int testcaseid ) : ExecutionResult
testplanid int id of the test plan
testcaseid int id of test case
return ExecutionResult

GetLatestBuildForTestPlan() public method

get the newest build for a test plan
public GetLatestBuildForTestPlan ( int tplanid ) : Build
tplanid int id of testplan
return Build

GetProject() public method

get a single Project
public GetProject ( string projectname ) : TestProject
projectname string
return TestProject

GetProjectTestPlans() public method

get a list of all testplans for a project
public GetProjectTestPlans ( int projectid ) : List
projectid int
return List

GetProjects() public method

get a list of all projects
public GetProjects ( ) : List
return List

GetTestCase() public method

get a test case by its id
public GetTestCase ( int testcaseid, int versionId ) : TestCase
testcaseid int Id of the test case
versionId int (optional) the version id. If not given the latest version is returned
return TestCase

GetTestCaseAttachments() public method

retrieve the attachments for a test case
public GetTestCaseAttachments ( int testCaseId ) : List
testCaseId int
return List

GetTestCaseIDByName() public method

get a list of test case ids with this name.
public GetTestCaseIDByName ( string testcasename ) : List
testcasename string name of the test case (case sensitive)
return List

GetTestCaseIDByName() public method

get a test cases by this name
public GetTestCaseIDByName ( string testcasename, int testSuiteId ) : List
testcasename string name of the test case (case sensitive)
testSuiteId int name of test suite
return List

GetTestCaseIDByName() public method

ask for a test case by name.
Searching is case sensitive.
public GetTestCaseIDByName ( string testcasename, string testsuitename ) : List
testcasename string the name of the test case
testsuitename string the name of the test suite
return List

GetTestCaseIdsForTestSuite() public method

get a list of testcase ids of test cases contained in a test suite
public GetTestCaseIdsForTestSuite ( int testSuiteid, bool deep ) : List
testSuiteid int id of the test suite
deep bool Set the deep flag to false if you only want test cases in the test suite provided and no child test cases.
return List

GetTestCasesForTestPlan() public method

get all test cases for a test plan
public GetTestCasesForTestPlan ( int testplanid ) : List
testplanid int
return List

GetTestCasesForTestPlan() public method

get all test cases for a test plan .
The same test case id can show up multiple times, once per platform.
public GetTestCasesForTestPlan ( int testplanid, int testcaseid ) : List
testplanid int
testcaseid int
return List

GetTestCasesForTestPlan() public method

get all test cases for a test plan .
The same test case id can show up multiple times, once per platform.
public GetTestCasesForTestPlan ( int testplanid, int testcaseid, int buildid ) : List
testplanid int
testcaseid int
buildid int
return List

GetTestCasesForTestPlan() public method

get all test cases for a test plan .
The same test case id can show up multiple times, once per platform.
public GetTestCasesForTestPlan ( int testplanid, int testcaseid, int buildid, int keywordid ) : List
testplanid int
testcaseid int
buildid int
keywordid int
return List

GetTestCasesForTestPlan() public method

get all test cases for a test plan .
The same test case id can show up multiple times, once per platform.
public GetTestCasesForTestPlan ( int testplanid, int testcaseid, int buildid, int keywordid, bool executed ) : List
testplanid int
testcaseid int
buildid int
keywordid int
executed bool
return List

GetTestCasesForTestPlan() public method

get all test cases for a test plan .
The same test case id can show up multiple times, once per platform.
public GetTestCasesForTestPlan ( int testplanid, int testcaseid, int buildid, int keywordid, bool executed, int assignedTo ) : List
testplanid int
testcaseid int
buildid int
keywordid int
executed bool
assignedTo int
return List

GetTestCasesForTestPlan() public method

get all test cases for a test plan .
The same test case id can show up multiple times, once per platform.
public GetTestCasesForTestPlan ( int testplanid, int testcaseid, int buildid, int keywordid, bool executed, int assignedTo, string executedstatus ) : List
testplanid int
testcaseid int
buildid int
keywordid int
executed bool
assignedTo int
executedstatus string
return List

GetTestCasesForTestSuite() public method

get test cases contained in a test suite
public GetTestCasesForTestSuite ( int testSuiteid, bool deep ) : List
testSuiteid int id of the test suite
deep bool Set the deep flag to false if you only want test cases in the test suite provided and no child test cases.
return List

GetTestPlanPlatforms() public method

get a list of all platforms for a test plan.
Throws an exception of type Testlink Exception
public GetTestPlanPlatforms ( int testplanid ) : List
testplanid int
return List

GetTestSuiteById() public method

get a test suite by its id
public GetTestSuiteById ( int id ) : TestSuite
id int
return TestSuite

GetTestSuitesForTestPlan() public method

get test suites for a test plan
public GetTestSuitesForTestPlan ( int testplanid ) : List
testplanid int
return List

GetTestSuitesForTestSuite() public method

public GetTestSuitesForTestSuite ( int testsuiteid ) : List
testsuiteid int
return List

GetTotalsForTestPlan() public method

get totals for a testplan
If a test plan has no executions to it you will still get a list iwth a single item. That item will have zeros in its totals
public GetTotalsForTestPlan ( int testplanid ) : List
testplanid int
return List

ReportTCResult() public method

Record the outcome of a test case execution
public ReportTCResult ( int testcaseid, int testplanid, TestCaseResultStatus status, int platformId, string platformName = null, bool overwrite = false, bool guess = true, string notes = "", int buildid, int bugid ) : GeneralResult
testcaseid int Id of test case
testplanid int Id of test plan
status TestCaseResultStatus The result of the test (pass, fail or blocked)
platformId int Id of the platform. Optional if platform name is given
platformName string name of the platform. Optional if the platform id is given
overwrite bool if true, then last execution for (testcase,testplan,build,platform) will be overwritten.
guess bool (assumed to be true) defining whether to guess optinal params or require them explicitly default is true
notes string any notes or info to be added to the description field
buildid int If not given, then highest build id willl be used
bugid int Id for a bug if used in conjunction with a defect tracker
return GeneralResult

SayHello() public method

basic Ping
public SayHello ( ) : string
return string

TestLink() public method

default constructor
public TestLink ( string apiKey, string url ) : System
apiKey string developer key as provided by testlink
url string url of testlink API. Something like http://localhost/testlink/lib/api/xmlrpc.php
return System

TestLink() public method

constructor with debug key constructor with URL and log flag
public TestLink ( string apiKey, string url, bool log ) : System
apiKey string
url string url of testlink API. Something like http://localhost/testlink/lib/api/xmlrpc.php
log bool if true then keep last request and last response
return System

UploadExecutionAttachment() public method

Uploads an attachment for an execution.
The attachment content must be Base64 encoded by the client before sending it.
public UploadExecutionAttachment ( int executionId, string filename, string fileType, byte content, string title = "", string description = "" ) : AttachmentRequestResponse
executionId int
filename string The file name of the Attachment (e.g.:notes.txt)
fileType string The file type of the Attachment (e.g.: text/plain)
content byte The content (Base64 encoded) of the Attachment
title string The title of the Attachment
description string The description of the Attachment
return AttachmentRequestResponse

UploadTestCaseAttachment() public method

upload an attachment for a test case
public UploadTestCaseAttachment ( int testcaseid, string filename, string fileType, byte content, string title, string description ) : AttachmentRequestResponse
testcaseid int
filename string
fileType string
content byte
title string
description string
return AttachmentRequestResponse

UploadTestProjectAttachment() public method

upload an attachment to a test project
public UploadTestProjectAttachment ( int executionId, string filename, string fileType, byte content, string title = "", string description = "" ) : AttachmentRequestResponse
executionId int
filename string
fileType string
content byte
title string
description string
return AttachmentRequestResponse

UploadTestSuiteAttachment() public method

upload an attachment for a test case
public UploadTestSuiteAttachment ( int testsuiteid, string filename, string fileType, byte content, string title, string description ) : AttachmentRequestResponse
testsuiteid int
filename string
fileType string
content byte
title string
description string
return AttachmentRequestResponse

about() public method

Gets info about the API
public about ( ) : string
return string

addTestCaseToTestPlan() public method

add a test case to a test plan (no way of removing one)
this testExternalid is a string and a concatenation of the test project prefix and the externalid that is reported in the test case creation.
public addTestCaseToTestPlan ( int testprojectid, int testplanid, string testcaseexternalid, int version, int platformid ) : int
testprojectid int
testplanid int
testcaseexternalid string the id that is displayed on the GUI
version int
platformid int
return int

checkDevKey() public method

check if Developer Key exists
public checkDevKey ( string devkey ) : bool
devkey string
return bool

getTestPlanByName() public method

get a test plan for a project
public getTestPlanByName ( string projectname, string planName ) : TestPlan
projectname string the name of the owning project
planName string
return TestPlan