Priyotosh_ganguly Valued Contributor.
Valued Contributor.
128 views

How to determine folder level in Test Lab

Jump to solution

We maintain below folder structure in ALM Test Lab:

Root->Release->Test Level->Requirement

example:

Root->Release 1903->SIT->Functional_Requirement_Name_01

Requirement is:

When user creates any new folder on Test Level (like SIT) or inside that, selection of target Cycle should be mandatory.

I can make Target Cycle as required when user creates a new Folder in Test Lab by using below code:

======================================================================

Sub TestSetFolder_New

TestSetFolder_Fields.Field("CF_ASSIGN_RCYC").IsRequired=true

End Sub

======================================================================

But I need to identify level of the new folder which are being created (considering root as 0, Release folders as 1, Test Phases folder as 2)

So whenever any folder that is getting created, having level 2 or above, Target Cycle should be a namdate, otherwise not.

Can you please help.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Knowledge Partner
Knowledge Partner

Re: How to determine folder level in Test Lab

Jump to solution

Hi Priyotosh_Ganguly,

Tried as below, please validate and check if it is helpful for your case.

Sub TestSetFolder_New
 ' On Error Resume Next
  My_Flag = False
  CharacterCount = 0
  ' Fetch the depth level at which this test set folder is being created
  'Msgbox TestSetFolder_Fields.Field("CF_FATHER_ID").Value
  Set Parent_Test_Set_Folder = TDConnection.TestLabFolderFactory.Item(TestSetFolder_Fields.Field("CF_FATHER_ID").Value)
  'Msgbox Parent_Test_Set_Folder.ID
  'Msgbox Parent_Test_Set_Folder.Path
  'CharacterCount = Len(Parent_Test_Set_Folder.Path) - Len(Replace(Parent_Test_Set_Folder.Path, "\", ""))

  If Len("\") Then
      CharacterCount = UBound(Split(Parent_Test_Set_Folder.Path, "\"))
  End If

  'Msgbox CharacterCount
  If Cint(CharacterCount) >= 2 Then
       My_Flag = True
  Else
       My_Flag = False
  End IF

  If My_Flag = True Then
     TestSetFolder_Fields.Field("CF_ASSIGN_RCYC").IsRequired = True
  Else
     TestSetFolder_Fields.Field("CF_ASSIGN_RCYC").IsRequired = False
  End IF
 ' On Error GoTo 0
End Sub

 

 

Regards,Srihari

0 Likes
2 Replies
Highlighted
Knowledge Partner
Knowledge Partner

Re: How to determine folder level in Test Lab

Jump to solution

Hi Priyotosh_Ganguly,

Tried as below, please validate and check if it is helpful for your case.

Sub TestSetFolder_New
 ' On Error Resume Next
  My_Flag = False
  CharacterCount = 0
  ' Fetch the depth level at which this test set folder is being created
  'Msgbox TestSetFolder_Fields.Field("CF_FATHER_ID").Value
  Set Parent_Test_Set_Folder = TDConnection.TestLabFolderFactory.Item(TestSetFolder_Fields.Field("CF_FATHER_ID").Value)
  'Msgbox Parent_Test_Set_Folder.ID
  'Msgbox Parent_Test_Set_Folder.Path
  'CharacterCount = Len(Parent_Test_Set_Folder.Path) - Len(Replace(Parent_Test_Set_Folder.Path, "\", ""))

  If Len("\") Then
      CharacterCount = UBound(Split(Parent_Test_Set_Folder.Path, "\"))
  End If

  'Msgbox CharacterCount
  If Cint(CharacterCount) >= 2 Then
       My_Flag = True
  Else
       My_Flag = False
  End IF

  If My_Flag = True Then
     TestSetFolder_Fields.Field("CF_ASSIGN_RCYC").IsRequired = True
  Else
     TestSetFolder_Fields.Field("CF_ASSIGN_RCYC").IsRequired = False
  End IF
 ' On Error GoTo 0
End Sub

 

 

Regards,Srihari

0 Likes
Priyotosh_ganguly Valued Contributor.
Valued Contributor.

Re: How to determine folder level in Test Lab

Jump to solution

Thank you very much Srihari. This is precisely what I am looking for.

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.