I am trying to pass a HashMap parameter to the function I am using in Fitnesse. However, nothing is being passed correctly, as i am getting "{}" when remote debugging in eclipse.
Below is the method that I am calling:
public String issueHttpRequest(String url, Map<String,String> params){
client = new HttpClient();
PostMethod post = createPostMethod(url);
for (Map.Entry<String, String> entry : params.entrySet()){
post.addParameter(entry.getKey(), entry.getValue());
}
client.executeMethod(post);
String response = post.getResponseBodyAsString();
return response;
}
Here is how I am calling it from FitNesse:
!|script|CLASS_NAME|
|check|issueHttpRequest;|login|!{username:"guest",password:"guest"}|{"status":"success"}|
When remote debugging in eclipse, params is being passed as empty brackets {}.
Any help would be appreciated. Thanks in advance.
I noticed that the !
character before the script table might be a problem. Try without:
|script|CLASS_NAME| |check|issueHttpRequest;|login|!{username:"guest",password:"guest"}|{"status":"success"}|
Check SLIM MarkupHashTable DataType for reference.
I only tried map arguments do work for SLIM tests in script tables. So make sure you have this defined before your test if my proposed still workaround does work:
!define TEST_SYSTEM {slim}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.