Hi folks,
I was not sure how best to name this topic. My shop's use of Robot Framework is a bit unusual; we run our tests on HDF5 data in a post-mortem approach. Our data contains timestamped log file tables, such that each has a table name and each table has named columns. Our usage is additionally unusual in that we are using Pandas as our data access and manipulation layer to the HDF5 data. We are somewhat creating, bit-by-bit, a data manipulation access API that uses Pandas under-the-hood at the Python level. As we learn more about what we can do with Robot Framework keywords, that is, how we can create simple utility keywords and combine them most flexibly, we hopefully will be able to create a good API that doesn't have to reproduce too much of the full Python-level Pandas API. Oh yes, I must mention that we are currently stuck with an older version of Robot Framework, 2.8.6.
It would be very natural (and in the spirit of using keywords at the level of plain language) to be able to use data table column names in keywords. Using a "dot operator" shorthand notation, as is common everywhere in the software world, seems to fit nicely, such as:
The myLog.columnX Value Should Be Less Than ${errorThreshold}
In such a case, I would want "myLog.columnX" to somehow bind to the underlying table and column value (let's assume this is at some fixed time). That is, I would like to avoid more verbose approaches such as:
${logname} = myLog
${colname} = columnX
The ${colname} Column in Table ${logname} Value Should Be Less Than ${errorThreshold}
I made the following experiment, but am running into some kind of runtime matching problem (to keep it shorter, I leave out the Settings table here):
*** Test Cases ***
Test logname expansion
Run Keyword myLog.columnX #1
myLog.columnX #2
myLog.columnX Should Equal 10 #3
*** Keywords ***
${logname}.${columnname}
#Log ${logname} #4
#Log ${columnname} #5
[Return] ${10} #6, this is just a test placeholder for a Pandas lookup
${logcol} Should Equal ${val}
#Should Be Equal ${logcol} ${val} #7
Should Be Equal Run Keyword ${logcol} ${val} #8
Lines 1 and 2 combined with lines 4 and 5 run just fine; the logname and column name are logged.
When I try line 3 with line 6, then both line 7 and 8 fail with the following error:
Test logname expansion | FAIL |
Test case file contains multiple keywords matching name 'myLog.columnX Should Equal 10'
Found: '${logname}.${columnname}' and '${logcol} Should Equal ${val}'
Hopefully it is clear what I was trying to do: I wanted the use of "myLog.columnX" in "myLog.columnX Should Equal 10" to first result in the
value 10 by way of the ${logname}.${columnname} keyword, then this value to be used as the value of the "${logcol}" variable in the second keyword. This test step should pass, as 10 equals 10. This is why I tried the variation in line 8, thinking that we might need to use "Run Keyword" to ensure that the first keyword gets invoked.
Thanks in advance for any advice!
Regards,
Chuck Lutz