If I want to add Test ID to the test lab available columns in the Quality Center Test lab, how do I do that?

  • Questions
  • If I want to add Test ID to the test lab available columns in the Quality Center Test lab, how do I do that?
Question ID: 104062
0
0

We want to be able to add the TestID column to the grid in the test lab so that we can sort the test in the test sets by testID. If I want to add Test ID to the test lab available columns, where do I do that?

Marked as spam
Posted by (Questions: 36, Answers: 3)
Asked on March 17, 2010 7:16 pm
39 views
Answers (3)
1
Private answer

First you would need to add a User Defined Field for the Test ID:

  • Go to Tools - Customization.
  • Click Project Entities on the left.
  • Expand Test Instance on the right.
  • Highlight the User Fields and click the New Field button.
  • Give the field a label and set field type as String. (Make note of the Field Name)

Place This In The Common Script

'Replace TC_USER_01 with the actual field name that you added as TestID to the testinstance entity.

Sub CopyTestIDs
On Error Resume Next
Dim TestSetFact
Dim TSTestFact
Dim theTestSet
Dim theTSTest
Dim TestSetTestsList

Set tdc= TDConnection
Set TestSetFact = TestSetFactory
Set TSTestFact = TSTestFactory
Set theTestSet = TestSet
Set theTSTest = TSTest
Set TestSetTestsList = list

'Get the TestSetFactory object

Set TestSetFact = tdc.TestSetFactory

'Get the current Test Set by the Test Set ID
Set theTestSet = TestSetFact.Item(TestSet_Fields(''CY_CYCLE_ID'').Value)

'Get the TSTest factory and list of TSTests
Set TSTestFact = theTestSet.TSTestFactory

'Get the list of all the test cases present in the Test Set
Set TestSetTestsList = TSTestFact.NewList('''')

'Copy the test case id from Test Plan into the Test ID field in every Test Instance
For Each theTSTest In TestSetTestsList

theTSTest.Field(''TC_USER_01'') = theTSTest.TestId ' TC_USER_10 is the Test Instance user created field called Test ID to hold the ids from test plan

Next
On Error GoTo 0

End Sub

Place This In the TestSetTests_MoveTo

Call CopyTestIDs

example:
Sub TestSetTests_MoveTo
On Error Resume Next
Call CopyTestIDs

On Error GoTo 0
End Sub

Now add the TestID column to the Test Lab grid in Quality Center.

Marked as spam
Posted by (Questions: 15, Answers: 10)
Answered on March 17, 2010 8:23 pm
1
Private answer

It appears that in order to get the Live Analysis to show the changes immediately, the fields will need to be populated at the folder level. The below will populate the TestID field when you click on the Test Set's folder (in order to get to the Live Analysis).

Try this solution instead:

Sub CopyTestIDs

Dim TSFolderID, TestInstID

'Get the Test Set Folder ID of the current folder'
TSFolderID = TestSetFolder_Fields.Field(''CF_ITEM_ID'').Value

'Get the TestSetTreeManager object to manage test set folders'
Set tsTree = TDConnection.TestSetTreeManager

'Get the current folder / node level in the Test Set Tree by the TSFolderID'
Set tsFolder = tsTree.NodeByID(TSFolderID)

'Create a list of Test Sets under the current folder / node level'
Set tsList = tsFolder.FindTestSets('''')

'Iterate (outer loop) through the Test Sets in the list'
For Each ts in tsList

'Set the TestSetID to the ID of the current Test Set'
TestSetID = ts.ID

'TestSet (the object for the specific Test Set)'
Set TSObj = TDConnection.TestSetFactory.Item(TestSetID)

'TSTestFactory (Collection of Test Instanaces objects in the Test Set)'
Set TSTestFact = TSObj.TSTestFactory

'List of Test Instances (List of TSTestFactory items)'
Set TSTestList = TSTestFact.NewList('''')

'Iterate (inner loop) through the TSTestList list of Test Instances'
For Each TSTestObj in TSTestList

'Populate the user defined field with the Test ID from the Test Instance'
TSTestObj.Field(''TC_USER_01'') = TSTestObj.Testid

'Post the field change population'
TSTestObj.Post

'increment the inner loop'
Next

'Destroy the objects used in the outter loop'
Set TSTestList = Nothing
Set TSTestFact = Nothing
Set TSObj = Nothing

'increment the outer loop'
Next

'Destroy the objects created prior to the iteration / loop'
Set tsList = Nothing
Set tsFolder = Nothing
Set tsTree = Nothing

'Refresh the display of the module to show the changes in the GUI'
Actions.Action(''ExecutionGrid.RefreshAllExecGrid'').Execute

End Sub

Then move the ''Call CopyTestIDs'' from *TestSetTests_MoveTo* to **TestSetFolder_MoveTo** instead.

Marked as spam
Posted by (Questions: 3, Answers: 168)
Answered on July 31, 2014 5:05 pm
0
Private answer

We were able to add TestID to Test Lab following your answer. However, looks like when running a Live Analysis in Test Lab, the Drill Down Result table does not fill TestID values unless you select each of the Test Instances in Test Lab first. Is this a known issue? Does it have some solution? Thanks,

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on July 30, 2014 11:45 am