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

Single object of type map passed keyword as argument give emtpy map as result after argument collection #33

Open
shan-96 opened this issue Feb 3, 2020 · 5 comments

Comments

@shan-96
Copy link

shan-96 commented Feb 3, 2020

Coming from #19 and robotframework documentation as java has no support for explicit kwarg variable, a single map passed on to robot keyword without ** must also be considered as kwarg.

In KeywordInvoker.java and ArgumentCollector.java while collecting arguments args is not null with one non empty map but kwargs are null. But after keyword argument collection we receive one empty map which is wrong

@Hi-Fi
Copy link
Contributor

Hi-Fi commented Feb 3, 2020

I think there's still some confusion of kwargs in general, because RF own documentation states (implicitly) that single map can't be treated as kwarg from caller side

If a Java keyword accepts kwargs, Robot Framework will automatically pack all arguments in name=value syntax at the end of the keyword call into a Map and pass it to the keyword

According your use case you just want to use argument as type of map, not kwargs.

@shan-96
Copy link
Author

shan-96 commented Feb 3, 2020

I think there's still some confusion of kwargs in general, because RF own documentation states (implicitly) that single map can't be treated as kwarg from caller side

If a Java keyword accepts kwargs, Robot Framework will automatically pack all arguments in name=value syntax at the end of the keyword call into a Map and pass it to the keyword

According your use case you just want to use argument as type of map, not kwargs.

Correct! I want to use the Map as normal arg but somehow it doesnt get parsed!

@Hi-Fi
Copy link
Contributor

Hi-Fi commented Feb 3, 2020

OK, I think now I started to see the issue. Not sure if I have time to check it within this week, but I'll try. Probably it requires new version from both JavalibCore and jrobotremoteserver, but let see.

@shan-96
Copy link
Author

shan-96 commented Feb 4, 2020

Ok. If you need, you can go through my PR I will be adding few more test cases in it

@Hi-Fi
Copy link
Contributor

Hi-Fi commented Feb 29, 2020

Just remembered this, and noticed that there's a test that should check for that (

).

So I'm still a bit puzzled of the issue.

Note that this needs annotations to work. With Classpathlibrary approach map is always varargs, and I don't think there's any reason to try to make any logic to try to determine if user wants to use arg or varargs.

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

No branches or pull requests

2 participants