stephenwang1011 / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

To search a text which doesn't exist on the phone screen returns true. #319

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Installed the resigned apk to phone.
2. Import robotium jars into workspace. 
3. Write the testing method use solo.searchText() to search a text which 
doesn't exist on the phone screen;
4. Run the Test project as Android Junit Test. 

What is the expected output? What do you see instead?
Expected result: The test case should be failed since the text doesn't exist.
Actual result: The test case is passed.

What version of the product are you using? On what operating system?
Sony LT26i, Android system.

Please provide any additional information below.

    public void test_0010_isEnabled() {
        solo.clickOnText("NfcAdapter");
        solo.clickOnText("isEnabled01");
        solo.searchText("getNfcAdapter2(): OK"); //This text(getNfcAdapter2(): OK) doesn't exist on the phone screen.
        solo.searchText("nihao");//This text(nihao) doesn't exist on the phone screen.
    }

It should failed the test case. I have no idea why it got passed. Could anybody 
help me out? 

Original issue reported on code.google.com by Kaylyn...@gmail.com on 3 Sep 2012 at 3:24

GoogleCodeExporter commented 9 years ago
The way in which searchText works is that it will return true or false 
depending on if it finds it or not. If you want to make an assert at that point 
you will need to do something like this:

Assert.assertFalse("getNfcAdapter was found", 
solo.searchText("getNfcAdapter2(): OK");

Please search the forum for answers to questions like this:

http://groups.google.com/group/robotium-developers

Original comment by renasr...@gmail.com on 3 Sep 2012 at 11:40