Highlighted
ShashiKanth1 Contributor.
Contributor.
984 views

Need a way to extract all the tests under ALM test plan with complete path using VB script?

I am working on a way to extract all the tests including folder paths in HP ALM using VB script, I have got most of the code but missing a small peice where my code misses to find some tests: 

Here is my code: 

 

ALMTestList "Subject\Automation\QTP\Scripts"
Public Function ALMTestList(ByVal MAINFOLDER)
	'Specify Array to contain all nodes of subject tree.

	Dim objTreeManager, FocusFolder
	Set TDConnection = QCUtil.TDConnection
	Set objTreeManager = TDConnection.TreeManager
	Set FocusFolder = objTreeManager.NodeByPath(MAINFOLDER)

	For i = 1 To FocusFolder.Count
		'If current node has a child then get path on child nodes too.
		If FocusFolder.Child(i).Count >= 1 Then
			Dim FocusFolderTemp
			FocusFolderTemp = ALMTestList(FocusFolder.Child(i).Path)
		Else
			Set oTestList = FocusFolder.Child(i).FindTests("")
			If TypeName(oTestList) <> "Nothing" Then
				For Each oTest in oTestList
					Report FocusFolder.Child(i).Path & "\" & oTest.Name
				Next
			Else 
				Report "Empty Folder in Test Plan : " & FocusFolder.Child(i).Path		
			End If
		End If
	Next


	' Cleanup objects
	Set FocusFolder = Nothing 
	Set objTreeManager = Nothing
	Set TDConnection = Nothing 
		
End Function

Missing Peice of code: 

 

This code will grab all the tests under the Test plan going through all the subfolders and returns the Full Path of the tests, but it misses the tests that are under the childfolders, which have both tests and childfolder(s).  Can someone help to fix this borken peice? 

Thanks.


 

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.