Skip to content

add keywords to call methods from custom components - #65

Merged
jussimalinen merged 1 commit into
MarketSquare:masterfrom
WojtekKowaluk:component-methods
Apr 16, 2015
Merged

add keywords to call methods from custom components#65
jussimalinen merged 1 commit into
MarketSquare:masterfrom
WojtekKowaluk:component-methods

Conversation

@WojtekKowaluk

Copy link
Copy Markdown
Contributor

We add generic getters which can be used to read data from custom controls.

@jussimalinen

Copy link
Copy Markdown
Contributor

Looks good, but I'm a bit hesitant about creating different keywords for each different argument combination. I think calling with strings and booleans at least might be necessary in future.

Couldnt we make this more generic and just make it "call component method" which takes *args and converts them automatically?

Then we can use the argument converter from javalibcore (included in swinglibrary). https://github.com/robotframework/JavalibCore/blob/master/src/main/java/org/robotframework/javalib/reflection/ArgumentConverter.java

I suppose we could just assume that there are no overloaded methods and that there will only be one method with specific name? Another approach would be that we try to choose the method with the same number of arguments as the call has. (But I'm happy with going with a simpler solution first, if that works for you).

@jussimalinen

Copy link
Copy Markdown
Contributor

Also we really should have atleast some tests for this feature.

@WojtekKowaluk

Copy link
Copy Markdown
Contributor Author

Actually I was already thinking about it. Getting method with right number of arguments is not problem at all. I will update this PR soon.

Making some tests based on existing test app should not be problem either.

@WojtekKowaluk

Copy link
Copy Markdown
Contributor Author

i have updated PR. Keyword now takes list of argument, and coverts them to required types. Only problem with this solution is when there are method overloads with same number of arguments (but different argument types). But i think this is quite rare case in real life. I Also added some tests.

I'm not sure where getMethodByNameAndArgumentCount helper method should go. Any suggestion?

@jussimalinen

Copy link
Copy Markdown
Contributor

This is very good. getMethodByNameAndArgumentCount helper can I think stay where it is until it is needed somewhere else. I think it would be slightly cleaner to add a helper private String getMethodDescription or something like that. But I can do that.

jussimalinen added a commit that referenced this pull request Apr 16, 2015
add keywords to call methods from custom components
@jussimalinen
jussimalinen merged commit fb0210b into MarketSquare:master Apr 16, 2015
jussimalinen added a commit that referenced this pull request Apr 16, 2015
@jussimalinen

Copy link
Copy Markdown
Contributor

Hum, the documentation actually could have been improved. I already made a release, but I will improve the docs for next one. At least some examples would be nice.

@WojtekKowaluk

Copy link
Copy Markdown
Contributor Author

Right, totally forgot about it. I will take care of it if you don't mind.

@jussimalinen

Copy link
Copy Markdown
Contributor

That should do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants