Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 programmatically kill the app at the end of a test?
I'm using ActivityInstrumentationTestCase2 with Robotium

like image 247
Taras Avatar asked Oct 21 '11 15:10

Taras


People also ask

How does Robotium work?

Robotium aims to make writing tests for simulating user actions such as touching, clicking, and typing simple. It can be used if you have the source code for the app or if you only have the apk files, and can run on either emulators or real devices.

What is Robotium testing tool?

Robotium is an open-source test framework for writing automatic gray-box testing cases for Android applications. With the support of Robotium, test case developers can write function, system and acceptance test scenarios, spanning multiple Android activities.

Is Robotium automation?

Robotium is an Android test automation framework that has full support for native and hybrid applications.


1 Answers

Or just add solo.finishOpenedActivities();

like image 50
BlackHatSamurai Avatar answered Sep 19 '22 18:09

BlackHatSamurai