Note that there are some explanatory texts on larger screens.

plurals
  1. POproblem of robotium
    primarykey
    data
    text
    <p>I just start to use robotium. The demo can be run without any problem, but when I wrote first test script by using <code>EditText</code> and <code>Button</code>, problems occured. My environment is android 2.1 and the script is quite simple, just input username and psw, then click sumbit button to login.<br> The script is as follows:</p> <pre><code>package com.tpc.test; import com.tpc.login.Login; import com.jayway.android.robotium.solo.Solo; import android.test.ActivityInstrumentationTestCase2; import android.test.suitebuilder.annotation.Smoke; public class LoginTest extends ActivityInstrumentationTestCase2&lt;Login&gt;{ private Solo solo; public LoginTest() { super("com.tpc", Login.class); } public void setUp() throws Exception { solo = new Solo(getInstrumentation(), getActivity()); } @Smoke public void testApp() throws Exception { String appName = solo.getCurrentActivity().getClass().getSimpleName(); System.out.println(appName); solo.getButton(0).getClass().getSimpleName(); solo.assertCurrentActivity("Expected login activity", appName); System.out.println(solo.getButton(0).getText());//can get the text of button solo.enterText(0, "name"); //input name to the 1st EditText is OK solo.enterText(1, "psw"); // Actually inout psw after name to the 1st EditText solo.clickOnButton(0); //Expect click the 1st button.Actually click the 1st EditText //assert of sample, not been modified boolean expected = true; boolean actual = solo.searchText("Note 1") &amp;&amp; solo.searchText("Note 2"); assertEquals("Note 1 and/or Note 2 are not found", false, actual); } @Override public void tearDown() throws Exception { try { solo.finalize(); } catch (Throwable e) { e.printStackTrace(); } getActivity().finish(); super.tearDown(); } } </code></pre> <p>One problem is both name and psw is filled in the first <code>EditText</code>,the other is <code>solo.clickOnButton(0);</code> click the first <code>EditText</code>, NOT the first <code>Button</code>. I also tried to use the text name of the <code>Button</code>, but the result was the same. It seems all the operations been put to the first <code>EditText</code>. I wanna what's the problem. Any suggestion?thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload