Micro Focus QTP (UFT) Forums
QC OTA Run Only one script and How to import DataTable during run time - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Interview Questions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Interview-Questions)
+--- Thread: QC OTA Run Only one script and How to import DataTable during run time (/Thread-QC-OTA-Run-Only-one-script-and-How-to-import-DataTable-during-run-time)



QC OTA Run Only one script and How to import DataTable during run time - Gurushankar - 01-02-2012

Hi All,

I have to write a VBscript that will run a particular testscript from testset (Test Lab) in QC. Also, I have to dynamically import a datasheet for the test in QC.

I implemented the first one.
It is running the whole testset instead of the ID i specified.
I have no idea how to import DataTable for a test that is run from QC TestLab.

Please Help me :'(


RE: QC OTA Run Only one script and How to import DataTable during run time - ravi.gajul - 01-02-2012

Please try the below code
Code:
Public Function Func_DownloadAttachement_FromQC(pvt_QC_Folders_NodeName, pvt_LocalFolderPathWhereFileshaveTobeDownloaded)
Set tdc=TDUtil.TDConnection
Set gTreeManager = tdc.TreeManager
Set root=gTreeManager.TreeRoot("Subject")
set gSysTreeNode = gTreeManager.NodeByPath(pvt_QC_Folders_NodeName)
Set fact=gSysTreeNode.Attachments
Set alist = fact.NewList("")

'Find the right attachment and download it to the temp folder
For Each att In alist
Set ext = att.AttachmentStorage
attname = att.DirectLink   'other functionality att.id,  att.filename
Out_file_Name = Replace(attname, gSysTreeNode.NodeID,"")

    ext.Load attname, True
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set MyFile = fso.GetFile(ext.ClientPath & "\" & attname)
    MyFile.Copy ( pvt_LocalFolderPathWhereFileshaveTobeDownloaded & "\" & Out_file_Name)
    Set fso = Nothing
    Set MyFile = Nothing
    
Next
End Function



RE: QC OTA Run Only one script and How to import DataTable during run time - Gurushankar - 01-03-2012

Hi Ravi,

I tried to get the attachment associated with my testscript.
There is no attachment with the script.

I used the below code:

Code:
Set PlanTestFactory = QCConn.TestFactory
Set PlanTestFilter = PlanTestFactory.Filter
PlanTestFilter.Filter("TS_NAME") = "Google_Search"
PlanTestFilter.Filter("TS_SUBJECT") = Chr(34) & "Subject\Release11\QTP-Dummy" & Chr(34)
Set PlanTest = PlanTestFactory.NewList(PlanTestFilter.Text)
Set TSTObjToRun = PlanTest(1)
Set AttachmentObj = TSTObjToRun.Attachments
'----------------------------------------------------> It does not enter for loop
For Each attname In AttList
        attActName = attname.DirectLink
        MsgBox attActName
Next

Additional Information:
I saved the Test script in QC using SaveAs option in QTP.
In QC, i did not find any attachments for for the test script.
How do i import a new file during run time.

Also can you pls help me to execute only one script in a test set.
I have written code, but it is executiong the whole testset despite providing the id of the test instance.
Ex., Scheduler.Run ID


RE: QC OTA Run Only one script and How to import DataTable during run time - sshukla12 - 01-03-2012

Hi,

Please find the attachment for executing a particular test from QC.
test u want to execute , pass it under
qtp_test(0)= "VPP - Primary IP ADSL without BackUp Creation"
and for the next part of ur query to import the datasheet, u can create a function and call it in your test scripts that will load the datasheet from QC with respect to ur test case.

Hope this helps u.

regards,
Sankalp


RE: QC OTA Run Only one script and How to import DataTable during run time - Gurushankar - 01-05-2012

Thanks You so much Shukla & Ravi

One more query:

I want to download the test results from QC or save it in local machine after run.
Is there anyway i can do that using OTA?


I have tried to save Results while saving QC with following Code:
But it did not work:

qtResultsOpt.ResultsLocation = "D:\ResultFolder\CP_Emp_CP" & RanNameVal

Thanks,
Guru


RE: QC OTA Run Only one script and How to import DataTable during run time - sshukla12 - 01-05-2012

Hi,

Instead of downloading the result u can create a txt file storing the result of each test case that u want to run( if this suits ur requirement)

Regards,
Sankalp


RE: QC OTA Run Only one script and How to import DataTable during run time - Gurushankar - 01-05-2012

Okay.. i want to download the result
If there is a way it will be really helpful