UFT API – How to Data Drive Scripts Using ALM Resource

PerfectoTopAd

How do I data drive a UFT script with ALM Resource?

I'm often asked the question “How do I data drive my UFT script using a resource stored in ALM“? I decided to finally create a simple example to explain the steps needed to do this. Hope it helps.

1. Create an Excel file

First let's create two Excel spreadsheets that will use in our example:

  • In Excel create a new Blank workbook and enter the following:


  • Save as ALMDEBUG1.xlsx
  • In Excel create another workbook and enter the following:


  • Save as ALMDEBUG2.xlsx

2. Create a UFT API script

  • Under the UFT menu click on the ALM>ALM Connection
  • Under the HP ALM Connection enter your ALM info
  • Create a new UFT API script named ALMTable and save it in ALM
  • In the new UFT API test drag a Math>Add activity on your main canvas area


  • From the UFT menu click View>Data
  • Click on the New Data Source and select Excel from the menu


  • In the New Excel Data Source's
    Excel file path point to the ALMDEBUG1 excel file we created earlier.
  • Make sure that you select the Allow other tools to override the data option. Click OK


  • Next we will point the values of the Add activity to the values in our ALMDEBUG excel file
  • Click on the Add activity's Properties Input/Checkpoints icon.
  • Under Add Input click on the Link to data source link for the A & B properties and the Result checkpoints. For each one in the Select Link Source click on the Data source column and select the input's corresponding value:


  • Save the script and close UFT

Now that we have the script ready let's set up the ALM piece.

3. Create a Resource in ALM

  • Click on the Test Resources area in ALM
  • Click on the New Resource icon


  • In the New Resource dialog box enter the following:
    • Name: ALMTABLE
    • Type: Data table


  • Click on the Resource's Resource Viewer and select the Upload File to point to the ALMDEBUG2.xlsx (this one that has the 10 + 10 row) excel file we created in the first step


  • Next click on the ALM Test Plan
  • Navigate to the folder where you saved the ALMTable API script we created earlier.
  • Click on the ALMTable script's Parameters tab


  • Click on the Data Resource dropdown menu and select the ALMTABLE resource we created


  • Then click on the Map Parameters button and map the Resource Parameters Names with the Test Parameters Names


  • Click OK
  • Click on the Test Configuration Tab
  • Click the Data tab
  • Under the Data Tab enter:
    • Select Dynamic
    • Click the Overide test data resource checkbox
    • In the Data Resource dropdown select the ALMTABLE resource


4. Time to Run the Test

  • Click on the ALM Test Lab area
  • Create a New Test Set called ALMUFT
  • In the ALMUFT test set add the ALMTable test we created earlier
  • Click Run


  • Click on the Launch Report button


  • You should now see the data used in our script that is stored in the Resource. Notice when we created the script we used the excel values in the ALMDEBUG1.xlsx (1 + 1 = 2). Now it is using the ALMDEBUG1.xlsx values (10 + 10) we have stored in the ALM resource we created. Cool!


More UFT API Automation Awesomeness

For more UFT API Automation Awesomeness, tips, tricks and how-tos, check out my new book, The UFT API Testing Manifesto – A step-by-step, hands-on testing guide for the masses, available on Amazon.com!

Don't own a Kindle? No Problem — you can still read my UFT API book!
I'm aware that some of you have had trouble accessing my books in the past. The truth is that you don't need a Kindle! There are a variety of free ways you can read a Kindle eBook:

In short, it's really simple to read Amazon Kindle books, no matter what type of device you use to access the Internet.

20 comments
Massimo - January 13, 2014

Hi, i have a problem with ALM integration to UFT API.
I tried to follow you guide but i can’t complete Step 3
i don’t have “Select Dynamic” option in Test configuration under ALM.

i have 11.52 alm version. is it the cause?
is there a newer version?

Reply
    Joe Colantonio - January 14, 2014

    Hi – I did not do anything special to have that option available. Maybe it has to do with my License — I need to research to see if this is the case. For the example I’m using ALM 11 with UFT 11.5

    Reply
      Massimo - January 14, 2014

      I have last version and last patch both of ALM and UFT.
      I followed your guide but during the run i have following error:
      Error occurred when trying to execute the test
      System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
      Parameter name: index
      at System.ThrowHelper.ThrowArgumentOutOfRangeException()
      at System.Collections.Generic.List`1.get_Item(Int32 index)
      at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
      at HP.ST.Shared.Utilities.ExcelFileProcessor.FillTableByMappedData(String filePathSrc, String filePathReplacing, IEnumerable`1 columnMappingItems, IEnumerable`1 rowIndexes)
      at HP.ST.Ext.QCIntegrationAddin.QCTestDataUpdater.FillSingleTableByMapping(String testTableFilePath, String qcTableFilePath, String resultTablePath, IEnumerable`1 singleTableItems, IEnumerable`1 rowIndexesToProcess)
      at HP.ST.Ext.QCIntegrationAddin.QCTestDataUpdater.FillTablesByData(String testTableFilePath, String qcTableFilePath, String resultTablePath, IEnumerable`1 mappingItems, IEnumerable`1 rowIndexesToProcess)
      at HP.ST.Ext.QCIntegrationAddin.QCTestDataUpdater.CreateTablesFromMapping(String testPath, String qcTableFilePath, IEnumerable`1 mappingItems, IEnumerable`1 rowIndexesToProcess)
      at HP.ST.Ext.QCIntegrationAddin.QCTestDataUpdater.UpdateTestData(ResolvingContext context)
      at HP.ST.Fwk.SOAReplayAPI.RuntimeResourceManager.UpdateTestData(ResolvingContext context)
      at HP.ST.Fwk.SOAReplayAPI.RuntimeResourceManager.ResolveDependencies(ResolvingContext context)
      at HP.ST.Fwk.SOAReplayAPI.ServiceTestRunner.UpdateResourceManagerInInstance(ExecutionUnitInstance executionUnit, Dictionary`2 context)
      at HP.ST.Fwk.SOAReplayAPI.ServiceTestRunner.LoadTest(String path, String addinId, Dictionary`2 context)
      at HP.ST.Ext.STRemoteAgentHelper.TestRunner.RunTest(IRun run, String testDirPath, Dictionary`2 inputParameters, String outputParametersFilePath, String activeEnvironmentProfileName, String reportDir)
      at HP.ST.Ext.STRemoteAgentHelper.RemoteAgentHelper.RunTest(IRun currentRun, Dictionary`2 inputParameters)
      at HP.ST.Ext.STRemoteAgentHelper.RemoteAgentHelper.RunTestInThread()

      Reply
Massimo - January 14, 2014

i re-tried to follow the guide.
Now i dont’ have errors but UFT script DON’T use the values in Data Table on ALM but still use the firse excel (1+1).
Have you idea what’s wrong?

Reply
jojo francisco - January 21, 2014

Hi Joe,

Thank you for the information.
You used API Math activity in your example above. I don’t see any data source linking buttons/panes when trying to data drive my SOAP activity. Is there a way to drive my SOAP request with data from ALM resources the same with your Add example?

Thank you so much!

-Jojo

Reply
    Joe Colantonio - January 23, 2014

    Hi Jojo – what activity are you using the ‘SOAP Request” under the Network folder? Make sure in your activity that you hover your mouse all the way to the right of the field that you want to link to a data source. An image of a link should appear. Not sure why HP doesn’t have any easier way to get to this.

    Reply
      jojo francisco - August 5, 2014

      hi Joe. I am using the “SOAP Request” activity under the “Network” in the toolbox. No image appears to the right of the field not like when using the “Math” activity. Not sure where to go from here. I’ve been researching. Probably a few C# tricks?

      thanks,
      Jojo

      Reply
        Joe Colantonio - August 12, 2014

        Hi jojo – sorry not sure I understand the issue. Did you resolve this yet? I have a SOAP request and a Math activity on my main canvas area an I’m trying to understand what the issue is that you are seeing. Please let me know. Cheers~Joe

        Reply
          jojo francisco - August 13, 2014

          Hi Joe.
          This is not resolved yet. I resorted to local data file for now. But i need the data to be fetched from ALM. Unlike the Math activity, SOAP Request activity does not have the button/link to the rightmost part of the field in the properties pane. So I am not able to use test configurations in ALM like you did in your example.

          Thanks,
          Jojo

          Reply
Jen - March 11, 2014

Hi,
I followed your example, but on step 3 after click “Map Parameters” button, I can’t see the A, B, and Result parameters. I’m using QC 11.0.0.7051, and UFT 11.52. Do you know why the parameters didn’t show up? Thanks.

Reply
YAsser - March 30, 2014

Hi joe ,
i made those step successfully , However when i try to open Script from ST i get Exception from UFT , and cant open or save service test to ALM anymore , sometimes it say cant open as subject is not integre ! , also cant save to ALM , it gives error stating something include OTA ,
am i missing any configuration , do you have any recommendations ?

Reply
Parthiban R - May 9, 2014

Hi Joe,

Hope you are doing good and thanks for the tons of articles you have published, which is of great use for us.

I face a strange issue where I am unable to view the excel content under resource viewer tab associated with a data table. I am currently using HP ALM 11 Patch 15.

Thanks in advance for your assistance.

Regards,
Parthiban R

Reply
Aki - May 22, 2014

Hi anyone resolved this issue Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index?

I am experiencing the same issue when trying to execute UFT tests with parameters.

your assistance is much appreciated.

Reply
shankar - October 29, 2014

Hi Joe,
i am new to API testing using UFT. I wanted to know in how many ways we can do this testing using UFT.Is there any way that we can code in function libraries and drive the API testing.Pls let me know at the earliest. Thanks in advance

Reply
    Joe Colantonio - October 30, 2014

    Hi – not sure I understand you want to be able to programmatically code UFT API methods from with in a GUI UI script?

    Reply
Johnny - February 9, 2015

Hi Joe I have followed your example , and in step 2 , i encountered a error which can not save the script to the ALM. below is the error info
can you help take a look?

“getresoursefolderbypath() returned null folder”

Reply
Chris Trimper - April 15, 2015

Rock on! This was very very helpful. Basically looks like i missed out that we need to map our fields with API test. So accustomed to GUI test where the data is a direct replacement…

Thanks Joe!

Reply
Navya - April 7, 2017

I was using UFT API testing in my project. Here i am facing issues in HTTP Version. Even after providing version in URL and leaving the HTTP Version property empty, My test fails because of the reason that , Url is taking two versions.
EX : URL- http://hna**************/ 1.0/ 1.1

Reply
Click here to add a comment

Leave a comment: