Req object

A Req object represents a requirement.

You get a Req object from a ReqFactory object.

Public methods

This object supports the following methods.

Method Description
AddCoverage

Assigns a test to cover the current requirement.

Syntax: AddCoverage(testId)

Parameters:

  • testId. A number that represents the ID of the test assigned to cover the requirement.

AddCoverageEx

Assigns all tests in the specified test folder to cover the current requirement.

Syntax: AddCoverage(subjectId)

Parameters:

  • subjectId. A number that represents the ID of the test folder.

GetCoverageTestConfigs

Returns the list of test configurations that cover the current requirement and, optionally, cover its children that match the requirement filter.

Syntax: GetCoverageTestConfigs(recursive)

Parameters:

  • recursive. A Boolean that indicates whether to check coverage for descendants of this requirement. If true, returns the test configurations that cover the current requirement and its children. If false, returns the test configurations that cover the current requirement only.

GetCoverageTestConfigsByTestIds

Returns the list of test configurations that cover the current requirement with filtered tests, and optionally, cover its descendents that match the requirement filter.

Syntax: GetCoverageTestConfigs(testId, recursive)

Parameters:

  • testId. A string that represents a list of test IDs, separated by commas.

  • recursive. A Boolean that indicates whether to check coverage for descendants of this requirement. If true, returns the filtered test configurations that cover the current requirement and its children. If false, returns the filtered test configurations that cover the current requirement only.

GetCoverageTestsByReqFilter

Returns the list of tests that cover the current requirement and, optionally, cover its children that match the requirement filter.

Syntax: GetCoverageTestsByReqFilter(reqFilter, recursive)

Parameters:

  • reqFilter. A TDFilter.Text string that specifies which descendent requirements to include. To retrieve all tests that cover this requirement, either set the filter yo an empty string or use the GetCoverList method.

  • recursive. A Boolean that indicates whether to check coverage for descendants of this requirement. If true, the filter is applied to this requirement and its descendents. If false, the filter is only applied to this requirement.

GetCoverList

Gets a list of the tests that cover this requirement.

Syntax: GetCoverList(recursive)

Parameters:

  • recursive. A Boolean that indicates whether to check coverage for descendants of this requirement. If true, this method returns a list of tests that cover this requirement and its children. If false, it returns tests that cover this requirement only.

GetCoverListByFilter

Gets the list of all tests that cover the current requirement and match the filter.

Syntax: GetCoverList(testFilter, recursive)

Parameters:

  • testFilter. A TDFilter.Text string that specifies which tests to include.

  • recursive. A Boolean that indicates whether to check coverage for descendants of this requirement. If true, this method returns a list of filtered tests that cover this requirement and its children. If false, it returns filtered tests that cover this requirement only.

LockObject

Locks the object. Returns True if the object has been changed on the server.

For details, see LockObject.

Mail

Mails a list of items.

For details, see Mail.

Move

Moves a requirement to be a child of a specified father in the requirements tree.

Syntax: Move(newFatherId, newOrder)

Parameters:

  • newFatherId. A number that represents the ID of the designated new father requirement.

  • newOrder. A number that represents the position of the requirement under the new parent. Accepted values are:

    • A number representing the position.

    • tagTDAPI_POS_ORDER.TDPOSITION_LAST - Indicates that the requirement is inserted last.

In addition to moving the requirement, the Move property also unlocks the requirement if it is set to auto-unlock.

PopulateTargetCycleToChildren

Assigns the target cycle of the requirement as the target cycle of all child requirements, recursively down the folder tree.

Syntax: PopulateTargetCycleToChildren()

PopulateTargetReleaseToChildren

Assigns the target release of the requirement as the target release of all child requirements, recursively down the folder tree.

Syntax: PopulateTargetReleaseToChildren()

Post

Posts all changed values into database.

For details, see  Post.

Refresh

Reads saved values, overwriting values in memory.

For details, see  Refresh.

RemoveCoverage

Removes a test from the list of tests that cover this requirement.

Syntax: RemoveCoverage(vTest, recursive)

Parameters:

  • recursive. A Boolean that indicates whether the test coverage is removed for the current requirement and all its child requirements. If true, the test coverage is removed for all the child requirements. If false, the test coverage is removed only for the current requirement.

Undo

Undoes changes to field values that have not been posted.

For details, see  Undo.

UnLockObject

Unlocks the object.

For details, see UnLockObject.

Public properties

This object supports the following properties.

Property R/W Type Description

Attachments

R Object

The attachment factory for the object. See AttachmentFactory object.

Author

R/W String

The name of the requirement author.

AutoPost

R/W Boolean

If true, the database is updated immediately when the field value changes.

AutoUnlock

R/W Boolean

Indicates whether to make the item changeable to other users automatically after a Refresh or Post.

Comment

R/W String

The comment associated with this requirement.

Count

R Number

The number of direct children.

Field

R/W Any

The value of the specified field.

Syntax: Req.Field[fieldName]

where fieldName is the name of the field in the project database. Use all upper case.

An attempt to get or set the value of a field not applicable to requirements of this type causes an exception.

FieldMultiValue

R/W Object

The MultiValue object of the specified field. See MultiValue object.

Syntax: Req.FieldMultiValue[fieldName]

where fieldName is the name of the field in the project database. Use all upper case.

HasAttachment

R Boolean

Checks if the object has one or more attachments.

HasCoverage

R Boolean

The requirement is covered by at least one test.

HasLinkage

R Boolean

Checks if the current object has at least one associated Bug.

HasRichContent

R Boolean

Checks if the object has rich content.

ID

R Number

The item ID.

IsLocked

R Boolean

Checks if object is locked for editing.

IsLocked is set by the LockObject method and is reset by the UnlockObject method.

If the object has an AutoUnlock property and the property is set to True, IsLocked is also reset by a Post or Refresh operation.

Modified

R Boolean

Checks if the item has been modified since last refresh or post operation. If true, the field properties on the server side are not up to date.

Name

R/W String

The Requirement name as seen in the tree.

ParentId

R/W Number

The Requirement's parent ID.

Set this property to place the requirement under another requirement in the hierarchy.

The default is -1, indicating a top-level requirement.

Priority

R/W String

The requirement priority.

Product

R/W String

The product name for which the requirement is set.

ReqCoverageFactory R Object Gets a ReqCoverage factory object. See ReqCoverageFactory object.
RequirementType R Object Gets the requirement types. See ReqType object.

Reviewed

R/W String

The review status.

The review status can be any value configured in the project. Typical examples are Changed, Not Reviewed, and Reviewed.

RnDEstimatedEffortInHours

R/W Number

The R&D effort.

Status

R String

The status of the tests that cover this requirement.

The statuses of the covering tests are: Failed, No Run, Not Completed, or Passed.

If no tests cover this requirement, the value is Not Covered.

It can also be any custom status defined by your project admin.

Type R/W String The name of the requirement type.

TypeId

R/W String

The requirement's type ID.

TypeName

R String

The field's type.

Virtual

R Boolean

Checks if this is a virtual item, that is, an item that does not have a corresponding database record.

Example

Example: Move requirements

Example: Get coverage tests that have not run

Back to top