Friday, March 7, 2014

Robotium a thorny issue, can not run with multiple test cases


Learn robotium testing framework has two months, has been used previously relatively smoothly, but recently a similar measure fetion apk there is a problem, which can only run a test case, it is strange, to finish first after the death card not moving, very strange.
Apk fly with simple letter to explain, I hope experts can answer:
Apk flying letters can be in any one market to using debug signature after the next down, attached to the real machine, manually log fetion in the real machine account password, the flying letters are automatically saved when between the time the test operation of the project will enter a friend interface.
The main code test works is as follows:
 @ SuppressWarnings ("rawtypes") 
public class FetionTest2 extends ActivityInstrumentationTestCase2 {
private static final String TARGET_PACKAGE_ID = "cn.com.fetion";
private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "cn.com.fetion.android.ui.activities.StartActivity";
private static Class launcherActivityClass ;
static {
try

{
launcherActivityClass = Class
. ForName (LAUNCHER_ACTIVITY_FULL_CLASSNAME);
} Catch (ClassNotFoundException e) {
throw new RuntimeException (e);
}
}

@ SuppressWarnings ("unchecked")
public FetionTest2 () {
super (TARGET_PACKAGE_ID, launcherActivityClass);
}

private Solo solo;

protected void setUp () throws Exception {
Log.v ("FetionTest", "execute setUp ()");
solo = new Solo (getInstrumentation (), getActivity ());
}

public void testFetion_1 () throws Exception {
Log.v ("FetionTest", "First Case started");
solo.sleep (2000);
boolean expected = true;
boolean actual = solo.searchText ("My Friends") ;/ / when the program is running into the main interface between the main interface will have a "My Friends" string
assertEquals ("anticipated results", expected, actual);
solo.goBack () ;/ / add this sentence is not a problem without a key, to return or not, the second case will not go
stuck stagnantLog.v ("FetionTest", "the end of the first Case");
}

public void testFetion_2 () throws Exception {/ / the same as the previous test, but the case did not run, hope to seek expert answers, the younger grateful! ! !
Log.v ("FetionTest", "Second Case");
solo.sleep (2000);
boolean expected = true;
boolean actual = solo.searchText ("My Friends");
assertEquals ("anticipated results", expected, actual);
solo.goBack ();
Log.v ("FetionTest", "Second Case");
}


public void tearDown () throws Exception {
Log.v ("FetionTest", "execute tearDown ()");

try {
solo.finalize ();
} Catch (Throwable e) {

e.printStackTrace ();
}
getActivity () finish ();.
super.tearDown ();
}

}


After performing LogCat log Show 06-18 07:14:47.783: V / FetionTest (23489): execute setUp ()
06-18 07:14:48.703: V / FetionTest (23489): The first start
Case06-18 07:14:52.363: V / FetionTest (23489): The first end
Case06-18 07:14:52.363: V / FetionTest (23489): execution tearDown ()
06-18 07:14:52.633: V / FetionTest (23489): execute setUp ()


That second use case start to finish is not running, the card does not move in there, do not know what the solution? ? ? ? ? ? ? ? ? ?<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Nomad out to solve the next big God?
Reply:
TearDown framework ()
Wrong.
Reply:
What's wrong? I have encountered this problem novice, seeking clarification
Reply:
What is the problem? Solved yet?

Reply:
The teardown of the try statement solo.finalize (); changed: this.solo.finishOpenedActivities ();
Reply:
I have encountered this problem, the landlord solved yet, can share with ah
Reply:
Landlord resolved, seeking to share ah.

No comments:

Post a Comment