Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add keywords to call methods from custom components #65

Merged
merged 1 commit into from
Apr 16, 2015
Merged

add keywords to call methods from custom components #65

merged 1 commit into from
Apr 16, 2015

Conversation

WojtekKowaluk
Copy link
Contributor

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

@jussimalinen
Copy link
Member

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
Member

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

@WojtekKowaluk
Copy link
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
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
Member

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 robotframework:master Apr 16, 2015
jussimalinen added a commit that referenced this pull request Apr 16, 2015
@jussimalinen
Copy link
Member

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
Contributor Author

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

@jussimalinen
Copy link
Member

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.

None yet

2 participants