Last Update: 9/28/2016

TestHttpClient2_2

This API is in private preview and subject to change.

Module path: TFS/TestManagement/RestClient

Initialization sample

  import RestClient = require("TFS/TestManagement/RestClient");

  // Get an instance of the client
  var client = RestClient.getClient();

  // Call a method on the client
  // e.g. client.getResource(...).then(...);

Methods

addCustomFields()

Syntax

 IPromise<Contracts.CustomTestFieldDefinition[]> addCustomFields(newFields, project)

Parameters

Returns

addTestCasesToSuite()

Syntax

 IPromise<Contracts.SuiteTestCase[]> addTestCasesToSuite(project, planId, suiteId, testCaseIds)

Parameters

  • project: string. Project ID or project name
  • planId: number.
  • suiteId: number.
  • testCaseIds: string.

Returns

addTestResultsToTestRun()

Syntax

 IPromise<Contracts.TestCaseResult[]> addTestResultsToTestRun(resultCreateModels, project, runId)

Parameters

Returns

bulkUpdateTestResults()

Syntax

 IPromise<Contracts.TestCaseResult[]> bulkUpdateTestResults(resultUpdateModel, project, runId, resultIds)

Parameters

Returns

cloneTestPlan()

Syntax

 IPromise<Contracts.CloneOperationInformation> cloneTestPlan(cloneRequestBody, project, sourcePlanId)

Parameters

Returns

cloneTestSuite()

Syntax

 IPromise<Contracts.CloneOperationInformation> cloneTestSuite(cloneRequestBody, project, sourceSuiteId, planId)

Parameters

Returns

createResultRetentionSettings()

Syntax

 IPromise<Contracts.ResultRetentionSettings> createResultRetentionSettings(retentionSettings, project)

Parameters

Returns

createTestConfiguration()

Syntax

 IPromise<Contracts.TestConfiguration> createTestConfiguration(testConfiguration, project)

Parameters

Returns

createTestPlan()

Syntax

 IPromise<Contracts.TestPlan> createTestPlan(testPlan, project)

Parameters

Returns

createTestResultAttachment()

Syntax

 IPromise<Contracts.TestAttachmentReference> createTestResultAttachment(attachmentRequestModel, project, runId, testCaseResultId)

Parameters

Returns

createTestRun()

Syntax

 IPromise<Contracts.TestRun> createTestRun(testRun, project)

Parameters

Returns

createTestRunAttachment()

Syntax

 IPromise<Contracts.TestAttachmentReference> createTestRunAttachment(attachmentRequestModel, project, runId)

Parameters

Returns

createTestSettings()

Syntax

 IPromise<number> createTestSettings(testSettings, project)

Parameters

Returns

createTestSuite()

Syntax

 IPromise<Contracts.TestSuite[]> createTestSuite(testSuite, project, planId, suiteId)

Parameters

Returns

createTestSession()

Syntax

 IPromise<Contracts.TestSession> createTestSession(testSession, teamContext)

Parameters

Returns

createTestVariable()

Syntax

 IPromise<Contracts.TestVariable> createTestVariable(testVariable, project)

Parameters

Returns

deleteResultRetentionSettings()

Syntax

 IPromise<void> deleteResultRetentionSettings(project)

Parameters

  • project: string. Project ID or project name

Returns

deleteTestConfiguration()

Syntax

 IPromise<void> deleteTestConfiguration(project, testConfigurationId)

Parameters

  • project: string. Project ID or project name
  • testConfigurationId: number.

Returns

deleteTestRun()

Syntax

 IPromise<void> deleteTestRun(project, runId)

Parameters

  • project: string. Project ID or project name
  • runId: number.

Returns

deleteTestSettings()

Syntax

 IPromise<void> deleteTestSettings(project, testSettingsId)

Parameters

  • project: string. Project ID or project name
  • testSettingsId: number.

Returns

deleteTestSuite()

Syntax

 IPromise<void> deleteTestSuite(project, planId, suiteId)

Parameters

  • project: string. Project ID or project name
  • planId: number.
  • suiteId: number.

Returns

deleteTestVariable()

Syntax

 IPromise<void> deleteTestVariable(project, testVariableId)

Parameters

  • project: string. Project ID or project name
  • testVariableId: number.

Returns

getActionResults()

Syntax

 IPromise<Contracts.TestActionResultModel[]> getActionResults(project, runId, testCaseResultId, iterationId, actionPath)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • testCaseResultId: number.
  • iterationId: number.
  • actionPath: string. Optional.

Returns

getBugsLinkedToTestResult()

Syntax

 IPromise<Contracts.WorkItemReference[]> getBugsLinkedToTestResult(project, runId, testCaseResultId)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • testCaseResultId: number.

Returns

getBuildCodeCoverage()

Syntax

 IPromise<Contracts.BuildCoverage[]> getBuildCodeCoverage(project, buildId, flags)

Parameters

  • project: string. Project ID or project name
  • buildId: number.
  • flags: number.

Returns

getCodeCoverageSummary()

Syntax

 IPromise<Contracts.CodeCoverageSummary> getCodeCoverageSummary(project, buildId, deltaBuildId)

Parameters

  • project: string. Project ID or project name
  • buildId: number.
  • deltaBuildId: number. Optional.

Returns

getPlanById()

Syntax

 IPromise<Contracts.TestPlan> getPlanById(project, planId)

Parameters

  • project: string. Project ID or project name
  • planId: number.

Returns

getPlanCloneInformation()

Syntax

 IPromise<Contracts.CloneOperationInformation> getPlanCloneInformation(project, operationId, includeDetails)

Parameters

  • project: string. Project ID or project name
  • operationId: number.
  • includeDetails: boolean. Optional.

Returns

getPlans()

Syntax

 IPromise<Contracts.TestPlan[]> getPlans(project, owner, skip, top, includePlanDetails, filterActivePlans)

Parameters

  • project: string. Project ID or project name
  • owner: string. Optional.
  • skip: number. Optional.
  • top: number. Optional.
  • includePlanDetails: boolean. Optional.
  • filterActivePlans: boolean. Optional.

Returns

getPoint()

Syntax

 IPromise<Contracts.TestPoint> getPoint(project, planId, suiteId, pointIds, witFields)

Parameters

  • project: string. Project ID or project name
  • planId: number.
  • suiteId: number.
  • pointIds: number.
  • witFields: string. Optional.

Returns

getPoints()

Syntax

 IPromise<Contracts.TestPoint[]> getPoints(project, planId, suiteId, witFields, configurationId, testCaseId, testPointIds, includePointDetails, skip, top)

Parameters

  • project: string. Project ID or project name
  • planId: number.
  • suiteId: number.
  • witFields: string. Optional.
  • configurationId: string. Optional.
  • testCaseId: string. Optional.
  • testPointIds: string. Optional.
  • includePointDetails: boolean. Optional.
  • skip: number. Optional.
  • top: number. Optional.

Returns

getResultParameters()

Syntax

 IPromise<Contracts.TestResultParameterModel[]> getResultParameters(project, runId, testCaseResultId, iterationId, paramName)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • testCaseResultId: number.
  • iterationId: number.
  • paramName: string. Optional.

Returns

getResultRetentionSettings()

Syntax

 IPromise<Contracts.ResultRetentionSettings> getResultRetentionSettings(project)

Parameters

  • project: string. Project ID or project name

Returns

getSuiteCloneInformation()

Syntax

 IPromise<Contracts.CloneOperationInformation> getSuiteCloneInformation(project, operationId, includeDetails)

Parameters

  • project: string. Project ID or project name
  • operationId: number.
  • includeDetails: boolean. Optional.

Returns

getSuiteEntries()

Syntax

 IPromise<Contracts.SuiteEntry[]> getSuiteEntries(project, suiteId)

Parameters

  • project: string. Project ID or project name
  • suiteId: number.

Returns

getSuitesByTestCaseId()

Syntax

 IPromise<Contracts.TestSuite[]> getSuitesByTestCaseId(testCaseId)

Parameters

  • testCaseId: number.

Returns

getTestCaseById()

Syntax

 IPromise<Contracts.SuiteTestCase> getTestCaseById(project, planId, suiteId, testCaseIds)

Parameters

  • project: string. Project ID or project name
  • planId: number.
  • suiteId: number.
  • testCaseIds: number.

Returns

getTestCaseResultById()

Syntax

 IPromise<Contracts.TestCaseResult> getTestCaseResultById(project, runId, testCaseResultId, includeIterationDetails, includeAssociatedBugs)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • testCaseResultId: number.
  • includeIterationDetails: boolean.
  • includeAssociatedBugs: boolean. Optional.

Returns

getTestCaseResults()

Syntax

 IPromise<Contracts.TestCaseResult[]> getTestCaseResults(project, runId, includeIterationDetails)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • includeIterationDetails: boolean.

Returns

getTestCases()

Syntax

 IPromise<Contracts.SuiteTestCase[]> getTestCases(project, planId, suiteId)

Parameters

  • project: string. Project ID or project name
  • planId: number.
  • suiteId: number.

Returns

getTestConfigurationById()

Syntax

 IPromise<Contracts.TestConfiguration> getTestConfigurationById(project, testConfigurationId)

Parameters

  • project: string. Project ID or project name
  • testConfigurationId: number.

Returns

getTestConfigurations()

Syntax

 IPromise<Contracts.TestConfiguration[]> getTestConfigurations(project, skip, top)

Parameters

  • project: string. Project ID or project name
  • skip: number. Optional.
  • top: number. Optional.

Returns

getTestIteration()

Syntax

 IPromise<Contracts.TestIterationDetailsModel> getTestIteration(project, runId, testCaseResultId, iterationId, includeActionResults)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • testCaseResultId: number.
  • iterationId: number.
  • includeActionResults: boolean. Optional.

Returns

getTestIterations()

Syntax

 IPromise<Contracts.TestIterationDetailsModel[]> getTestIterations(project, runId, testCaseResultId, includeActionResults)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • testCaseResultId: number.
  • includeActionResults: boolean. Optional.

Returns

getTestResultAttachmentContent()

Returns a test result attachment

Syntax

 IPromise<ArrayBuffer> getTestResultAttachmentContent(project, runId, testCaseResultId, attachmentId)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • testCaseResultId: number.
  • attachmentId: number.

Returns

getTestResultAttachmentZip()

Returns a test result attachment

Syntax

 IPromise<ArrayBuffer> getTestResultAttachmentZip(project, runId, testCaseResultId, attachmentId)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • testCaseResultId: number.
  • attachmentId: number.

Returns

getTestResultById()

Syntax

 IPromise<Contracts.TestCaseResult[]> getTestResultById(project, runId, testCaseResultId, detailsToInclude)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • testCaseResultId: number.
  • detailsToInclude: Contracts.ResultDetails. Optional.

Returns

getTestResultDetailsForBuild()

Syntax

 IPromise<Contracts.AggregatedResultsWithDetails> getTestResultDetailsForBuild(project, buildId, sourceWorkflow, groupBy, filter)

Parameters

  • project: string. Project ID or project name
  • buildId: number.
  • sourceWorkflow: string.
  • groupBy: string. Optional.
  • filter: string. Optional.

Returns

getTestResults()

Syntax

 IPromise<Contracts.TestCaseResult[]> getTestResults(project, runId, detailsToInclude, skip, top)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • detailsToInclude: Contracts.ResultDetails. Optional.
  • skip: number. Optional.
  • top: number. Optional.

Returns

getTestResultsByIds()

Syntax

 IPromise<Contracts.TestCaseResult[]> getTestResultsByIds(ids, project, fields)

Parameters

Returns

getTestResultsByQuery()

Syntax

 IPromise<Contracts.TestCaseResult[]> getTestResultsByQuery(query, project, includeResultDetails, includeIterationDetails, skip, top)

Parameters

  • query: Contracts.QueryModel.
  • project: string.
  • includeResultDetails: boolean. Optional.
  • includeIterationDetails: boolean. Optional.
  • skip: number. Optional.
  • top: number. Optional.

Returns

getTestRunAttachmentContent()

Returns a test run attachment

Syntax

 IPromise<ArrayBuffer> getTestRunAttachmentContent(project, runId, attachmentId)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • attachmentId: number.

Returns

getTestRunAttachmentZip()

Returns a test run attachment

Syntax

 IPromise<ArrayBuffer> getTestRunAttachmentZip(project, runId, attachmentId)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • attachmentId: number.

Returns

getTestRunById()

Syntax

 IPromise<Contracts.TestRun> getTestRunById(project, runId)

Parameters

  • project: string. Project ID or project name
  • runId: number.

Returns

getTestRunCodeCoverage()

Syntax

 IPromise<Contracts.TestRunCoverage[]> getTestRunCodeCoverage(project, runId, flags)

Parameters

  • project: string. Project ID or project name
  • runId: number.
  • flags: number.

Returns

getTestRunLogs()

Syntax

 IPromise<Contracts.TestMessageLogDetails[]> getTestRunLogs(project, runId)

Parameters

  • project: string. Project ID or project name
  • runId: number.

Returns

getTestRuns()

Syntax

 IPromise<Contracts.TestRun[]> getTestRuns(project, buildUri, owner, tmiRunId, planId, includeRunDetails, automated, skip, top)

Parameters

  • project: string. Project ID or project name
  • buildUri: string. Optional.
  • owner: string. Optional.
  • tmiRunId: string. Optional.
  • planId: number. Optional.
  • includeRunDetails: boolean. Optional.
  • automated: boolean. Optional.
  • skip: number. Optional.
  • top: number. Optional.

Returns

getTestRunsByQuery()

Syntax

 IPromise<Contracts.TestRun[]> getTestRunsByQuery(query, project, includeRunDetails, skip, top)

Parameters

  • query: Contracts.QueryModel.
  • project: string.
  • includeRunDetails: boolean. Optional.
  • skip: number. Optional.
  • top: number. Optional.

Returns

getTestRunStatistics()

Syntax

 IPromise<Contracts.TestRunStatistic> getTestRunStatistics(project, runId)

Parameters

  • project: string. Project ID or project name
  • runId: number.

Returns

getTestSettingsById()

Syntax

 IPromise<Contracts.TestSettings> getTestSettingsById(project, testSettingsId)

Parameters

  • project: string. Project ID or project name
  • testSettingsId: number.

Returns

getTestSuiteById()

Syntax

 IPromise<Contracts.TestSuite> getTestSuiteById(project, planId, suiteId, includeChildSuites)

Parameters

  • project: string. Project ID or project name
  • planId: number.
  • suiteId: number.
  • includeChildSuites: boolean. Optional.

Returns

getTestSuitesForPlan()

Syntax

 IPromise<Contracts.TestSuite[]> getTestSuitesForPlan(project, planId, includeSuites, skip, top, asTreeView)

Parameters

  • project: string. Project ID or project name
  • planId: number.
  • includeSuites: boolean. Optional.
  • skip: number. Optional.
  • top: number. Optional.
  • asTreeView: boolean. Optional.

Returns

getTestSessions()

Syntax

 IPromise<Contracts.TestSessions[]> getTestSessions(teamContext, period, allSessions, includeAllProperties, source, includeOnlyCompletedSessions)

Parameters

  • teamContext: string. Project ID or project name
  • period: number. Optional.
  • allSessions: boolean. Optional.
  • includeAllProperties: boolean. Optional.
  • source: Contracts.TestSessionSource[]. Optional.
  • includeOnlyCompletedSessions: boolean. Optional.

Returns

getTestVariable()

Syntax

 IPromise<Contracts.TestVariable> getTestVariable(project, testVariableId)

Parameters

  • project: string. Project ID or project name
  • testVariableId: number.

Returns

getTestVariables()

Syntax

 IPromise<Contracts.TestVariable[]> getTestVariables(project, skip, top)

Parameters

  • project: string. Project ID or project name
  • skip: number. Optional.
  • top: number. Optional.

Returns

queryCustomFields()

Syntax

 IPromise<Contracts.CustomTestFieldDefinition[]> queryCustomFields(project, scopeFilter)

Parameters

Returns

queryFailureDetailsForBuild()

Syntax

 IPromise<Contracts.TestFailuresAnalysis> queryFailureDetailsForBuild(build, project, sourceWorkflow, buildToCompare)

Parameters

Returns

queryFailureDetailsForTestRun()

Syntax

 IPromise<Contracts.TestFailuresAnalysis> queryFailureDetailsForTestRun(project, testRunId)

Parameters

  • project: string. Project ID or project name
  • testRunId: number.

Returns

queryReportForBuild()

Syntax

 IPromise<Contracts.TestReport> queryReportForBuild(project, buildId, sourceWorkflow, includeFailureDetails, buildToCompare)

Parameters

  • project: string. Project ID or project name
  • buildId: number.
  • sourceWorkflow: string.
  • includeFailureDetails: boolean.
  • buildToCompare: Contracts.BuildReference.

Returns

queryResultTrendForBuild()

Syntax

 IPromise<Contracts.AggregatedResultsForBuild[]> queryResultTrendForBuild(filter, project, buildCount)

Parameters

Returns

queryTestResultRecentBugs()

Syntax

 IPromise<Contracts.WorkItemReference[]> queryTestResultRecentBugs(project, testRunId, testResultId, recentDays)

Parameters

  • project: string. Project ID or project name
  • testRunId: number.
  • testResultId: number.
  • recentDays: number. Optional.

Returns

queryTestResultTrendReport()

Syntax

 IPromise<Contracts.TestCaseResult[]> queryTestResultTrendReport(project, testRunId, testResultId, historyDays, top)

Parameters

  • project: string. Project ID or project name
  • testRunId: number.
  • testResultId: number.
  • historyDays: number. Optional.
  • top: number. Optional.

Returns

removeTestCasesFromSuiteUrl()

Syntax

 IPromise<void> removeTestCasesFromSuiteUrl(project, planId, suiteId, testCaseIds)

Parameters

  • project: string. Project ID or project name
  • planId: number.
  • suiteId: number.
  • testCaseIds: string.

Returns

reorderSuiteEntries()

Syntax

 IPromise<Contracts.SuiteEntry[]> reorderSuiteEntries(suiteEntries, project, suiteId)

Parameters

Returns

updateCodeCoverageSummary()

http://(tfsserver):8080/tfs/DefaultCollection/_apis/test/CodeCoverage?buildId=10 Request: Json of code coverage summary

Syntax

 IPromise<void> updateCodeCoverageSummary(coverageData, project, buildId)

Parameters

Returns

updateResultRetentionSettings()

Syntax

 IPromise<Contracts.ResultRetentionSettings> updateResultRetentionSettings(retentionSettings, project)

Parameters

Returns

updateTestConfiguration()

Syntax

 IPromise<Contracts.TestConfiguration> updateTestConfiguration(testConfiguration, project, testConfigurationId)

Parameters

Returns

updateTestPlan()

Syntax

 IPromise<Contracts.TestPlan> updateTestPlan(planUpdateModel, project, planId)

Parameters

Returns

updateTestPoints()

Syntax

 IPromise<Contracts.TestPoint[]> updateTestPoints(pointUpdateModel, project, planId, suiteId, pointIds)

Parameters

Returns

updateTestResults()

Syntax

 IPromise<Contracts.TestCaseResult[]> updateTestResults(resultUpdateModels, project, runId)

Parameters

Returns

updateTestRun()

Syntax

 IPromise<Contracts.TestRun> updateTestRun(runUpdateModel, project, runId)

Parameters

Returns

updateTestSuite()

Syntax

 IPromise<Contracts.TestSuite> updateTestSuite(suiteUpdateModel, project, planId, suiteId)

Parameters

Returns

updateTestSession()

Syntax

 IPromise<Contracts.TestSession> updateTestSession(testSession, teamContext)

Parameters

Returns

updateTestVariable()

Syntax

 IPromise<Contracts.TestVariable> updateTestVariable(testVariable, project, testVariableId)

Parameters

Returns