Status: New
Owner: ----
Labels: Type-Enhancement Priority-Medium

New issue 467 by Carl.Dichter: Want variables that come from resource files be in a namespace, just like keywords.
http://code.google.com/p/robotframework/issues/detail?id=467

I put arrays of data in resource files, so that each resource file is like
a table of records-- only horizontal rather than vertical. The variables
had the file name on them like a namesspace, then they could be accessed in
an OO way what is a lot like the relational database model (except columns
are records, rather than rows).

The first Name in the User table is:  @{User.Name}[0]
That user's zip code is:  @{User.PostalCode}[0]
The company he works at is: @{User.CompanyID}[0]

The details of companies are in another table that I can probably "join"
with something like this: @{company.na...@{user.companyid}[0]]

As a workaround, I'm putting the name in the resource file with the
namespace already on it (User.Names).

Carl asked:
I'm not seeing the name-space behavior that the RF user's
guide mentions:

Resource files are specified in the full keyword name, similarly as library names. The name of the resource is derived from the basename of the resource
file without the file extension. For example, the keyword Example in a
resource file myresources.html can be used as myresources.Example. Note that this syntax does not work, if several resource files have the same basename.
In such cases, either the files or the keywords must be renamed. The full
name of the keyword is case-, space- and underscore-insensitive, similarly
as normal keyword names.

I put a variable "bar" in a resouces file called "foo.htm", then I cannot
seem to access the variable as ${foo.bar} but I there is no problem
accessing ${bar}.

Pekka answered:
The namespace behavior is unfortunately limited only to keywords. I
haven't even though it about ${resource.variable_name} syntax but it
feels pretty nice. The only problem is that it might easily clash with
the extended variable syntax (e.g. ${variable_as_object.attribute}).
Please submit an enhancement request about adding namespaces for
variables to the tracker. We probably need to look at the related code
anyway in RF 2.5.



--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

Reply via email to