I am trying to write a junit test case to select a list item and intent for the next action, but I don't know how to simulate this user action using junit coding. Can anyone help?
Also I want to ask if there is any material teaching a function or syntax for simlate various user actions in junit?
Below is an example from my curriculum tutorials, and I want to do something like this, but in a listview element.
public void testKilosToPounds() {
TouchUtils.tapView(this, textKilos);
sendKeys("1");
TouchUtils.clickView(this, buttonPounds);
double pounds;
try {
pounds = Double.parseDouble(textPounds.getText().toString());
} catch (NumberFormatException e) {
pounds = -1;
}
assertEquals("1 kilo is 2.20462262 pounds", 2.20462262, pounds, DELTA);
}
source
share