robotium

Launching app and executing some test cases with Robotium

放肆的年华 提交于 2020-01-25 11:35:39
问题 I am new to Robotium and tried to execute following code to launch an app and perform some functions. An example would be, launch messaging app on android emulator and send a text message "Hi" to a user "test". package com.example.android.test; import com.example.android.NewUserActivity; import com.jayway.android.robotium.solo.Solo; import android.test.ActivityInstrumentationTestCase2; public class NewUserActivityTest extends ActivityInstrumentationTestCase2<NewUserActivity> { private Solo

Launching app and executing some test cases with Robotium

此生再无相见时 提交于 2020-01-25 11:34:28
问题 I am new to Robotium and tried to execute following code to launch an app and perform some functions. An example would be, launch messaging app on android emulator and send a text message "Hi" to a user "test". package com.example.android.test; import com.example.android.NewUserActivity; import com.jayway.android.robotium.solo.Solo; import android.test.ActivityInstrumentationTestCase2; public class NewUserActivityTest extends ActivityInstrumentationTestCase2<NewUserActivity> { private Solo

Using Robotium with intents

泄露秘密 提交于 2020-01-16 00:55:17
问题 I have an application with several activities with list views, the selection from the first list view determines the content of the second list view, and the second list view determines the contents of the third, etc. I want to test the third list view, but as it requires an intent the list returns nothing. To remedy this I can manually add the intent to the test which does mean it works public InspectionListActivityTest() { super(InspectionListActivity.class); Intent i = new Intent(); i

How to use R.id in robotium if I have only the apk file

跟風遠走 提交于 2020-01-15 01:55:05
问题 I want to test an app from play market. I have a problem when I`m trying to use solo.clickOnView(solo.getView(cn.wps.moffice_eng.R.id.writer_edittoolbar_saveBtn)); cn - cn cannot be resolved to a variable How can i solve this poblem? As I understand, robotium can't use R.id because I don't have R.id file from my tested app? my code package com.example.android.apis.test; import android.test.ActivityInstrumentationTestCase2; import android.util.Log; import android.view.KeyEvent; import android

Display alert dialog while running an Android test case

混江龙づ霸主 提交于 2020-01-07 02:33:07
问题 I am using Robotium to automate testing of an application. Is there a way I can display an alert box while executing a particular test case. Thanks. 回答1: It is possible to do, nearly everything is possible but before I give you the answer do you have a good reason to do this? I cant easily thing of a good reason why a test should open an alert box but you may know best. Robotium has the method. solo.getCurrentActivity(); Using this you can get an Activity Context and with such a thing you can

How to make APK that can launch my Robotium test?

房东的猫 提交于 2020-01-05 09:04:34
问题 (A) App to test (eg. Browser) (B) Test app. (extends ActivityInstrumentationTestCase2) (Robotium) (C) Launcher (like "devTools" -> Instrumentation) How can I create an APK(C) that can launch the Test app(B). 回答1: public class Main extends Activity { protected List<InstrumentationInfo> mList; protected ComponentName mBrowserTestComponent; protected final static String TARGET_PACKAGE = "com.android.browser"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

Correct way to take screenshot with Robotium and Cucumber

若如初见. 提交于 2020-01-05 03:07:24
问题 Which is the best way to take a screenshot when one scenario fails using Robotium and Cucumber ? I have tried (without success, because it doesn't execute runTest method) with this: import cucumber.api.CucumberOptions; import cucumber.api.java.After; import cucumber.api.java.Before; @CucumberOptions(features = "features", tags = {"~@ignore"}) public class CustomInstrumentationTestCase extends ActivityInstrumentationTestCase2<LaunchActivity> { protected Solo solo; public

Robotium & system dialogs

旧城冷巷雨未停 提交于 2020-01-04 09:16:51
问题 When I try to pair with Bluetooth device, system confirmation dialog with PIN appears. There are buttons "Cancel" and "OK". But I can't click them with Robotium. How can I work with Android OS dialogs in Robotium? Thanks. 回答1: This works for me: solo.clickOnView(solo.getView(android.R.id.button1)); where the 'Positive' button is android.R.id.button1, the 'Negative' button is android.R.id.button2 and 'Neutral' is android.R.id.button3. 回答2: It is not possible to write a test case that spans

Android Robotium NoClassDefFoundError

陌路散爱 提交于 2019-12-30 05:56:36
问题 I was just trying to use Robotium in an Android JUnit Test, but the Testing always fails with an error: java.lang.NoClassDefFoundError: com.jayway.android.robotium.solo.Solo thrown at solo = new Solo(getInstrumentation(), getActivity()); in the setUp() method: protected void setUp() throws Exception { super.setUp(); solo = new Solo(getInstrumentation(), getActivity()); } I read somewhere that this could be related to the Android SDK revision 17, but I cannot confirm this, as I first tried

How can i use id to do action on an object of an android using Robotium tool?

北城余情 提交于 2019-12-25 11:54:56
问题 I tried to use id to click on the object in an android application but when i enter solo.clickOnImageButton(R.id.action_menu_search); It is showing an error, that action_menu_search cannot be resolved or not a field. How can i use the id of an object to click on the same. Thank you in advance, With regards, David Gayler 回答1: Use solo.clickOnView(solo.getView(int id)); 回答2: Method clickOnImageButton takes parameter as index, not id, so you should use method, which Renas has mentioned. 来源: