var singleCommand = {
name: "theMethodName",
arguments: ["array", 1, true, false, "of values to the method"],
variable: "@@variable_name_to_store_this_result@@", // (optional)
target: "Robotium" // (optional) other option is LastResultOrRobotium (the default)
};
The first method will be invoked upon Robotium
. Every subsequent call will be invoked upon the last result.
http = Net::HTTP.new '127.0.0.1', 7777
response = http.post '/', command({:name => 'getCurrentListViews'}, {:name => 'get', :arguments => [0]}, {:name => 'getChildCount' })
count_of_listview_children = response.body
def command(*commands)
"commands=#{commands.to_json}"
end
private int getFirstListViewChildCount(final Solo solo) {
final ListView listView = solo.getCurrentListViews().get(0);
return listView.getChildCount();
}
We can also capture results into variables, and pass them into other method calls.
http = Net::HTTP.new '127.0.0.1', 7777
commands = [
{:name => 'getText', :arguments => ['some text to find'], :variable => '@@the_view@@'},
{:name => 'clickOnView', :arguments => ['@@the_view@@'], :target => 'Robotium'}
]
response = http.post '/', command(*commands)
def command(*commands)
"commands=#{commands.to_json}"
end
private void clickOnText(final Solo solo, final String text) {
final TextView foundText = solo.getText(text);
solo.clickOnView(foundText);
}