2016-05-19 13:48 GMT+03:00 Vinicius Kwiecien Ruoso <
viniciu...@gmail.com>:
>
> I was trying to use the ${CURDIR} variable from within a Python
> library by using the BuiltIn().get_variable_value method. It did not
> work, so I read the docs and they say: "Additionally ${CURDIR} is
> special because it is replaced already during the test data processing
> time.".
Yes, ${CURDIR} is not a normal variable. It is replaced already at the
parsing time.
> We have a few ways of handling this variable to the library (init
> argument, keyword argument, a keyword to set it in the library state,
> and so on) but in that particular case the test suite itself would
> benefit from a "transparent" way of passing a relative path.
>
> Does anyone see a better way of handling that case? Would it be much
> effort to add support to that variable in the "Get Variable Value"
> keyword?
If you are interested in a relative path to the test suite itself,
then you could simply use ${SUITE SOURCE} variable. If you would need
a path to resource file calling your library keyword, you can create a
variable with that information in the resource file based on
${CURDIR}:
*** Variables ***
${RESOURCE DIR} ${CURDIR}
Notice that if you would create such a ${RESOURCE DIR} variable both
in a resource file and in a test suite file importing the resource
file, only the value in the suite file would be visible.
Cheers,
.peke
--
Agile Tester/Developer/Consultant ::
http://eliga.fi
Lead Developer of Robot Framework ::
http://robotframework.org