On 04/14/2012 11:54 PM, learner wrote:
> I'm puzzled by the value of CURDIR& EXECDIR when running from RIDE.
> I may have the same questions when invoking robot from the CLI (not
> from RIDE), but I haven't tried that yet.
>
> When starting a test from RIDE, I don't yet see much rhyme or reason
> for the setting of CURDIR or EXECDIR.
>
> It **seems** that:
>
> 1. EXECDIR is set to the path to the directory where RIDE is initially
> invoked, and
> 2. CURDIR is set to the path to the directory of the most recently
> sourced resource file in the test case file.
>
> *** Questions ***
> 1. Are my statements above correct?
Not entirely. EXECDIR points to the working directory where test
execution is started, it is basically os.path.abspath(os.curdir). CURDIR
points to the directory where a particular test suite/resource file is.
It is resolved during parsing, and cannot be changed dynamically.
> 2. I'm a little puzzled on how to proceed. I want to be able to load
> different resources from a specific relative path (a different
> resource depending on the device name provided upon invocation). I
> think that I cannot guarantee the directory that RIDE was started from
> because it depends on the user behavior (where they invoke RIDE from)
> and I cannot guarantee the directory of the most recently sourced
> resource file because the user may have changed the test case or suite
> setup to source other resources.
CURDIR can be used for this purpose. Having e.g
.
|--tests
| |-mysuite.txt
|--resources
| |-dev1res.txt
| |-dev2res.txt
you can always use import like this in mysuite.txt
Resource | ${CURDIR}${/}..${/}resource{/}${DEVICE}res.txt
where ${DEVICE} can be defined e.g. from the command line. ${CURDIR}
used in mysuite.txt always resolves as absolute path to `tests` directory.
hope this helps,
--J
--
Janne H�rk�nen <|> Software Craftsman @ http://reaktor.fi
http://twitter.com/#!/janneharkonen