Forum Discussion

Sjef's avatar
Sjef
Occasional Contributor
2 years ago

Specify an variable Excel file to check

Hi There,

I've made an keywordtest in which I export data and save this data in an excelfile.

With parameters the Keywordtest is to be executed in different situations in my desktop program.


eg:

when I start the test in TAB "ServiceAmounts"

Then I go to this TAB with an Variable OCR Parametervalue "ServiceAmounts"

Then I export the DATA in this TAB to a file with the (variable) name "ServiceAmountsAfter.xlsx" which to compare with "ServiceAmountBefore.xlsx", so far so good.

But now I want to use this keywordtest with a parameter "Service Agreements" in which I go to TAB "ServiceAgreements" and export the data to the file "ServiceAgreementsAfter.xlsx" which to compare with "ServiceAgreementsBefore.xlslx." but the excelcheckpoint has the operationname "ServiceAmountsBefore"and not "ServiceAgreementsBefore" and I don't now how to make this a variable value.

I use some easy Pythonscripts, but I'm not an expert; maybey it's possibel to use a script to make this name variable or are there any other solutions ?

Greetings,

Sjef

    • Sjef's avatar
      Sjef
      Occasional Contributor

      Sorry for the later response (I had a Holiday and other businesses to do):
      The first link gives no result and the second link doesn't contain information about setting parameters in a ExcelCheckpoint.

      I want to use a script to call a variable; like this:

      def ExcelCheckpoint():
      #Compares the Stores.TablesExcelFile item with the contents of the specified Excel sheet.
      ExcelResourceFile = Project.Variables.ExcelResourceFile
      Tables[ExcelResourceFile].Check()

      but the result is:

       

      RuntimeError: The specified object is not indexable.


      When I use Tables.NameOfTheTableInTestcomplete.check(); then the function works

      But I want to use a variable (and a parameter)....

      how can I realise this ?

      Greetings,

      Sjef

    • Sjef's avatar
      Sjef
      Occasional Contributor

      I have reviewed the information provided by you, to the extent that it was not already known to me, and I do not see a solution to my problem here:

      1. Either I need to work through the existing operator ExcelCheckpoint, but I cannot figure out how to call a different table each time using a parameter or variable that needs to be checked by the checkpoint.
      2. Or I need to work entirely through a script, where I have to manually construct the Excel file field by field. This is too laborious, and I also have doubts about whether I can work with a variable in this case.

      I want to use the standard ExcelCheckpoint but call the table to be checked via a parameter.

      It shouldn't be so difficult, in my opinion; I don't understand why I can't insert a variable in the script between Tables. ..., Check(), if that were possible, my problem would be solved.

      Let me summarize the actions I am taking (there may be another solution for this):

      1. I want to create a single keyword test that I can control with parameters (possibly via project variables).
      2. The keyword test exports data to an Excel file (after performing various other keyword tests in my desktop application), and the data in this file should always be the same. So, I have created a table in advance that contains the expected data.
      3. I use the Excel Checkpoint to compare the data from the latest export with the data in my table.

      Best regards, Sjef