SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    get list of test files from QC path with vbscript

    Does anyone know if a way to get a list of files in a QC directory using VBScript?

    I tried using the FileSetObject, but it does not recognise the QC directory path.


    ultimately, I want get the list of files, loop through the files, open them, get each action name and descripton and print them to a file. I've got the part getting each action name and description, but I can't get the list of filenames/paths to loop through.

    Alternately, if any one knows of a better way to generate a documentation of all actions and their descriptions, I'd love to hear it (kind of like Javadocs)

    thanks!

  2. #2
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: get list of test files from QC path with vbscr

    'Here is the code to get list of files and it's names.
    Set testList = QCutil.QCConnection.TreeManager.NodeByPath("Subjec t\xxxxxx").TestFactory.NewList("SELECT * FROM TEST")
    For testListItem = 1 To testList.Count
    Print testList.Item(testListItem).Name
    Print testList.Item(testListItem).Type
    Print "........................................."
    Next

    But I have no idea how to open them.

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: get list of test files from QC path with vbscr

    Thanks so much! That was it, although I had to change the testList object slightly since I could not access QCUtil object from my script:

    qtapp.TDConnection.TDOTA.TreeManager.NodeByPath(fi lePath).TestFactory.NewList("SELECT * FROM TEST")

    After much trial and error, QTP Help searching and googling here is the full script to open all the files in a QC directory and extract the Action Names and descriptions

    =========================
    Option Explicit


    Dim qtApp 'As QuickTest.Application ' Declare the Application object variable

    Dim objFSO 'File System Object
    Dim arrFiles'test case file list
    Dim eachFile ' each test case file
    Dim objFile 'File object
    Dim i 'counter
    Dim filePath 'test case file path

    ' Open QuickTest
    Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
    qtApp.Launch ' Launch QuickTest
    qtApp.Visible = True ' Set QuickTest to be visible


    'create file system object
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'create a new file
    Set objFile = objFSO.CreateTextFile("C:\Temp\Docs.txt",True)


    filePath = "Subject\ActionHelpers\TimeAndAttendance"
    Set arrFiles =qtapp.TDConnection.TDOTA.TreeManager.NodeByPath(f ilePath).TestFactory.NewList("SELECT * FROM TEST")
    '
    For eachFile = 1 To arrFiles.Count

    'open the helper file
    qtApp.Open "[QualityCenter] "& filePath & "\" & arrFiles.Item(eachFile).Name, False, False ' Open a test

    'loop through the test and get each action information
    For i=1 to qtApp.Test.Actions.count
    objFile.WriteLine qtApp.Test.Actions(i).Name & "," & qtApp.Test.Actions(i).Description'
    Next

    Next

    'Close QuickTest
    qtApp.Quit ' Quit QuickTest

    Set qtApp = Nothing ' Release the Application object

    msgbox "done"

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 09:53 PM.

Copyright BetaSoft Inc.