david_quick
11 years agoOccasional Contributor
Setting Project Test Items Count via Script
Is there a way to programmatically set a project test item's count?
The TestItem Object only provides access to the property values, not set them.
Here's the VB script I am running:
sub sub_SetTestItemCount '(strTestItemName) <-- commented out while debuging
' Setup Temp value for Debuging
strTestItemName = "Expected Project Test Item Name"
' Loop through each of the project test items
For intFirstLevelTestItems = 0 To Project.TestItems.ItemCount-1
' If the name of the test item is the same as the passed in value
if LCase(Trim(Project.TestItems.TestItem(intFirstLevelTestItems).Name)) = LCase(strTestItemName) Then
' Update the Test Item Count to a new value
Project.TestItems.TestItem(intFirstLevelTestItems).Count = 5
' Code fails on above line as Read/Get only NOT Write/Set
End If
Next
The TestItem Object only provides access to the property values, not set them.
Here's the VB script I am running:
sub sub_SetTestItemCount '(strTestItemName) <-- commented out while debuging
' Setup Temp value for Debuging
strTestItemName = "Expected Project Test Item Name"
' Loop through each of the project test items
For intFirstLevelTestItems = 0 To Project.TestItems.ItemCount-1
' If the name of the test item is the same as the passed in value
if LCase(Trim(Project.TestItems.TestItem(intFirstLevelTestItems).Name)) = LCase(strTestItemName) Then
' Update the Test Item Count to a new value
Project.TestItems.TestItem(intFirstLevelTestItems).Count = 5
' Code fails on above line as Read/Get only NOT Write/Set
End If
Next
Hi David,
I found the same support ticket you submitted to our TestComplete Support Team. Let me quote their reply here so that other community members are aware of this:
Currently, the TestItem.Count property is actually read-only. However, we have a suggestion to implement the ability to modify this property from the test in our database, and your message has increased its rating. Thank you.
In the meantime, to accomplish the task, you can implement the loop that will control how many times a test item will be executed. I hope this will help.