views:

480

answers:

2

I have my QTP Scripts in Test Scripts Tab and datasheets in the Attachment Tab of TestPlan of QC. I import these datasheets to Datatable (Global) of QTP and use the data in my application using the QTP Script Parameterization and then Script updates this Global Datatable with auto generated values from application.

Now, the issue is when I export the Global Datatable using Export / ExportSheet function back to the Test Data sheets in attachments tab of QC, I don't find the them being updated.

How can I achieve this export of Global Datatable from QTP to Quality Center?

I would like to either save the entire DataTable as a new file or update the DataTable I have in attachments already.

Saving it in the "Test Resources" tab would also be ok.

Actually, any way I could get in into Quality Center make me happy.

Using QTP 10.0 and QC 10.0

Detailed Example:

I have a test that will check the calculated tax for customers buying stuff at a website. And I want to save the result for each row
So I have data table that looks like this

Customer   Item   Expected_Tax   Actual_Tax  Pass_Fail
normal     apple  25             
normal     pear   10             
manager    apple  12             

As I run my tests QTP fill the blanks in the data table

Customer   Item   Expected_Tax   Actual_Tax  Pass_Fail
normal     apple  25             25          pass
normal     pear   10             25          fail              
manager    apple  12             25          fail

Now I want to save this data table, but when the test ends it the data is lost. So I want to save it. I know I can save it locally on my machine. But I want so save it in QC so we can retrive it later.

Update

Turns out that the data table actually is saved and you can find it if you open Test Lab and look at a test run. But I would still like to know how to save the Data Table as a Test Resource or Attachment

A: 

Finally found the answer to this one. It's possible to use the QC OTA APIs to export it to QC.

I made a function for this

Function SaveToQC(ResourceName)
    '' Connection To QC
    Set qcc = QCUtil.QCConnection

    '' Setting Temp Folder
    TempFolder = environment("SystemTempDir") 

    Set ResourceFactory = qcc.QCResourceFactory
    Set ResourceList = ResourceFactory.NewList("")
    Set Resource = Nothing
    iTotalItems = ResourceList.Count
    For ItemCtr = 1 To iTotalItems
    CurItem = ResourceList.Item(ItemCtr).Name
    If UCase(CurItem) = UCase(ResourceName) Then
        Set Resource = ResourceList.Item(ItemCtr)
    End If
    Next
    Set ResourceFactory = Nothing
    Set ResourceList = Nothing

    '' Export Datatable to Temp Directory
    Datatable.Export TempFolder & "\" & Resource.Filename

    Resource.Post

    Resource.UploadResource TempFolder, True
End Function
Jonas Söderström
Hmm, the color coding seems to be a bit of here, but it works for me.
Jonas Söderström
A: 

Hi Can you please tell me what is the value of REsourceName to be passed. I am bit confused here. It would be good ifyou can give some explanation along with the code.

thanks Ravindra

Ravindra