Specify an variable Excel file to check
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.
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 ?
Solved! Go to Solution.
The Excel checkpoint instructions say you can use a variable parameter
See if that works for you.
Just curious - why are you exporting data every time instead of just starting with the data in the Excel file?
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:
#Compares the Stores.TablesExcelFile item with the contents of the specified Excel sheet.
ExcelResourceFile = Project.Variables.ExcelResourceFile
but the result is:
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 ?
Have a look at the Python code for Excel Object, which should hopefully give you a rough idea on how to structure your code.
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:
- 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.
- 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):
- I want to create a single keyword test that I can control with parameters (possibly via project variables).
- 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.
- I use the Excel Checkpoint to compare the data from the latest export with the data in my table.
Best regards, Sjef
It is possible. Look at the example about Excel Object that @rraghvani gave and see the Check Method examples here. Try it and show us what happens.