android - conditional statement for getting TextView -
I have to get an EditText
object which is not a search bar in the app with text As a current location
, if I have already created a search query with myText
, then no current location
text is displayed. And the search bar shows myText
.
I am writing test cases using a single object.
How can I write a conditional statement to get the EditText
even if something like the text shows
if! Got a single Tag ("Current Location") Single Search Tag ("my text");
This is what I am currently doing
EditText text = (EditText) solo.getText ("Current Location"); If (text == null) {text = (EditText) solo.getText ("myText"); // My rest code goes here ....
but it throws an exception if current location
is not present in the search bar.
junit.framework.AssertionFailed error: Text with text: 'Current Location' is not found!
Please suggest correctly.
Try this code: (! Solo.searchText ("Current Location"))
if assertTrue (solo.searchText ("my text")) and assertTrue (solo.searchText ("current location"));
Comments
Post a Comment