robotium

How to change the font in android settings using Robotium?

牧云@^-^@ 提交于 2019-12-24 11:56:25
问题 Can I change font size from medium to large or tiny in Android Settings via Robotium? If so, how? Thanks! 回答1: I'm certainly sure that Robotium doesn't provide this feature. Robotium is an instrumentation test framework, which is close to your app's UI , so if your app doesn't provide this feature in its own interface, Robotium won't do it. Although, lately I'd read about Google's UI test framework uiautomator and it seems to have this feature. To prove that assumption read this Android:

How to run robotium tests in a specific order?

我与影子孤独终老i 提交于 2019-12-24 00:54:18
问题 I have this robotium testproject which has one testclass. The test class contains all the test methods. Right now when I run the test class, the test methods are run in alphabetical order. Since I have some dependencies between the test methods(i know this is not the preferred practice) I want the test methods to run in a specific order. The reason I am having dependencies is that, it allows for less code to be written and makes the whole test class to run faster. Is there any way to run the

Uninstall application when testing

时光毁灭记忆、已成空白 提交于 2019-12-23 15:21:17
问题 I'm new to testing in Android with Robotium. How can I programatically uninstall and then install the application before running some of the tests? For example, in order for me to test the login activity, I need to make sure the login credentials are not saved from a prior run of the app. Or is there another way to do this? 回答1: You could use the following piece of code (on the machine you're debugging from) to uninstall your application: Runtime rt = Runtime.getRuntime(); Process pr = rt

How can I get all component and widget Id of current Android window screen programmatically?

醉酒当歌 提交于 2019-12-23 03:22:31
问题 I use Robotium Framework for Android testing purpose and manually take component_id or index id or else part of Widgets from Hierarchy Viewer to put value at runtime for testing purpose. Is there any way to take component_id or index id or else part of Widgets Programmatically? So far I'm able to get package name and all activity names under that package application. 回答1: import time, subprocess, socket, re afttFile=open("ApplicationPackage.DOC", "r") fileName="" packageName="" activityName="

How to use solo.searchText for searching some text consisting of special characters

牧云@^-^@ 提交于 2019-12-22 17:22:13
问题 I am using robotium to test an android project.I have a testcase where i need to test a message consisting of special characters is posted correctly. So I created a constant consisting of special characters : public static final String PostMessageWithSpecialchars = "Hey hi,* Have a good day*.:()[]-=/&!?"'+;@#"; and i am using following code to search it and assert that the posted message is exactly like the message in the constant PostMessageWithSpecialchars assertTrue(solo.searchText

How to mock user interaction (“fromUser=true”) with the SeekBar in a Robotium test?

巧了我就是萌 提交于 2019-12-22 11:26:22
问题 My code distinguishes user and code interactions with the SeekBar using fromUser parameter passed to onProgressChanged() method: @Override public void onProgressChanged(SeekBar seekBar, int i, boolean fromUser) { if (fromUser) { // execute only if it was user interaction with the SeekBar ... } } When I'm trying to test my SeekBar with robotium I'm not able to "mock user interaction with the SeekBar": solo.setProgressBar(mSeekBar, newValue); onProgressChanged() callback is executed with

Robotium: Test run failed to complete. Expected N tests, received (N-1)

半腔热情 提交于 2019-12-22 10:06:21
问题 Android testing still remains my headache. I created the most simple app just to clear up how Robotium works, and each time tests fail with an error: Running tests Test running started Test failed to run to completion. Reason: 'Test run failed to complete. Expected 1 tests, received 0'. Check device logcat for details Test running failed: Test run failed to complete. Expected 1 tests, received 0 Once I had "Expected 3 tests, received 2" instead. The condition of using no-args constructor is

How to generate test result report using robotium?

安稳与你 提交于 2019-12-22 08:07:32
问题 I have been using robotium to test my android application.Testing was successful but i want to know that is there any way to view test results in a separate file. 回答1: I have had good luck just running the robotium tests as regular Android JUnit tests, and then using the standard mechanism to get back the test results, namely the ant task fetch-test-report. To do this I used the build.xml file create by android through the tooling. See documentation for developing in other IDEs for detailed

can wifi be switched on/off in test case through robotium

。_饼干妹妹 提交于 2019-12-22 04:39:15
问题 can we switch on/off the wi-fi of the device in a test cases in robotium? because i am testing an issue which needs wifi to be on in initial phase then turning off the wi-fi and continue with testing. 回答1: Yes you can do it, see the example: public void testNoNetworkConnection() throws Exception { setWifiEnabled(false); // do stuff solo.something setWifiEnabled(true); } private void setWifiEnabled(boolean state) { WifiManager wifiManager = (WifiManager)solo.getCurrentActivity()

Getting started with Robotium. EditText not found

坚强是说给别人听的谎言 提交于 2019-12-20 05:30:10
问题 I just getting started with Robotium, writing my first test and I'm getting this weird error: junit.framework.AssertionFailedError: 2131165500 EditTexts are not found! This is my my test case public class TestRegistrationActivity extends ActivityInstrumentationTestCase2<RegistrationActivity>{ private Solo solo; public TestRegistrationActivity() { super(RegistrationActivity.class); } public void setUp() throws Exception { solo = new Solo(getInstrumentation(), getActivity()); } @Override public