robotium

Robotium. In the suite of tests each next test is affected by the previous test

谁都会走 提交于 2019-12-08 15:09:35
问题 I have multiple UI tests. When I run a single test, everything is OK. But if I run a batch of them (as a part of CI build) test fail, because tests that go first change the state of the application, and the next tests are affected by those changes. (Since the app is not getting killed). I tried getActivity().finish() in tearDown() . Tried solo.finalize() which does the same actually. Is there a way to have a fresh app at the beginning of each test run? (Using Robotium). And is there a way to

Android Espresso how to write tests using apk?

假装没事ソ 提交于 2019-12-08 11:35:12
问题 I am a robotium user now switching to Espresso can anyone tell me how to write tests using apk in espresso, as we do in robotium without having acccess to the code but using app apk. And how to access views without R.id.viewid in espresso? as we do in robotium solo.getview("viewidText") In robotium this is how we do public class CoreTest extends ActivityInstrumentationTestCase2 { private Solo solo; //class name of the app launcher activity private static final String LAUNCHER_ACTIVITY_FULL

Robotium testing failed because of deleteDatabase()

元气小坏坏 提交于 2019-12-08 06:13:28
问题 I've refactored my application to use a ContentProvider and all the CursorLoader framework but since I've done it, all my test failed because of database error like java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed. but these occure only in robotium test mode. When I test manually the app it seems to work. 2 days that I'm trying to makes my tests working… The database management code is available here : http://code.google.com/p/radis

Espresso How to access views without using R.id.viewid as we do in robotium?

放肆的年华 提交于 2019-12-08 05:04:37
问题 I am switching from robotium to espresso, I am writing tests using apk , I dont have access to code. In robotium using solo.getView("view-id") we can access the view but I am not geting how to do it in espresso? espresso witId() method needs R.id.viewid which I dont have access. public class AaEspressoTest { private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.tri.re.CordActivity"; private static Class<?> launcherActivityClass; static { try { launcherActivityClass = Class

Can't get my assert current activity to work

戏子无情 提交于 2019-12-07 14:10:46
问题 I have 2 activities, the first one is the startup one which in it's create method causes the second one to be launched, always. My Robolectric tests pass fine Activity public class LoginActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.loginview); Intent intent = new Intent(this,MainActivity.class); startActivity( intent ); } I know my activity

Use both InstrumentationTestRunner and AndroidJUnitRunner with Robotium and Espresso

眉间皱痕 提交于 2019-12-07 05:11:14
问题 We're using Robotium with the android.test.InstrumentationTestRunner for our tests. Nevertheless we want to replace Robotium for Espresso, but we still have some doubts about it, since we have a machine with Jenkins for the CI. Espresso uses the android.support.test.runner.AndroidJUnitRunner while Robotium uses the aforementioned and first, we would like to be able to use both testing frameworks at the same time. Is it possible? How can we specify that in the build.gradle file? How can we

Android & Robotium - Test activity that expects an extra?

二次信任 提交于 2019-12-06 17:02:28
问题 It seems to me that robotium was designed in a way to test 1 Activity at a time instead of the whole application. So my question is how do I test an activity that expects an extra to be passed to it? by extra I mean intent.putExtra("Something", object); 回答1: The method setActivityIntent(Intent) should be what you are looking for. I used this method to provide a custom Intent to my Activity's TestCase. Just use it after you call super in your constructor. Intent i = new Intent(); i.putExtra(

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

泪湿孤枕 提交于 2019-12-06 15:33:47
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(PostMessageWithSpecialchars)); but the test fails at assertTrue line. What to do to search the

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

谁都会走 提交于 2019-12-06 06:16:01
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 fromUser == false. Is it possible to write Robotium test that sets SeekBar's progress and mocks user

How to generate test result report using robotium?

Deadly 提交于 2019-12-05 10:11:50
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. 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 instructions on setting that up. Good luck! XML report generation is quite simple when we are using Eclipse