[Added robotframework-users back to Cc.]
2014/1/23 Somesh Daga <
someshd...@gmail.com>:
> Thanks a lot for your explanation and the links were quite helpful.
> I understand now that importing a library multiple times with different
> arguments can create multiple instances of a class. Now my question is how
> do you access those instances? In RIDE, you can store a string as a
> variable, ${str}="blahblahblah" and then use the ${str} variable to keep
> referring to the string "blahblahblah". So considering that I am going to
> have multiple instances of my class, how do I call class functions on a
> specific instance because I don't have a variable names to refer to the
> instances? If we can assign variable names to the instances, how do we do
> it?
Methods implemented by your libraries are available as keywords. If
you import same library multiple times with different arguments, you
need to use the "WITH NAME" syntax to give unique name for each of
them. Assuming the imported libs have same keywords, you need to then
use them so that you prefix the keyword name with the library name
like "MyLib.My Keyword". Both the "WITH NAME" syntax and resolving
conflicts when multiple libraries have same keywords are discussed
more thoroughly in the User Guide.
Notice that I'm not sure is using these classes as libraries the best
approach in general. Depending on your use case, you might want to
create a separate library that has keywords that return instances of
you other class., You can then easily pass those instances to other
keywords if that's needed.
To get a better understanding how libraries work in practice, you may
want to study this demo project:
https://bitbucket.org/robotframework/robotdemo/wiki/Home