sangmingming / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

Robotium cannot simulate the scenario like finishing all activities and start again. #143

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The tested application is "HelloAndroid", it has main activity is 
"HelloActivity", and another activity is "HelloNextActivity".
In "HelloNextActivity", there is one button "Refresh", after clicking 
"Refresh", it will finish all activities and start "HelloActivity".

AndroidManifest Info:
<activity android:name=".HelloActivity"
                  android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Restart "HelloActivity" code:
PackageManager manager = getPackageManager();
Intent intent = manager.getLaunchIntentForPackage(getPackageName());
startActivity(intent);

What steps will reproduce the problem?
1. Run test to simulate tested application, the "HelloActivity" is showed 
correctly.
2. Simulate clicking "Refresh" button in "HelloNextActivity".

What is the expected output? What do you see instead?
The expected output:
It can simulate the tested application display "HelloActivity" correctly.

The actual output:
It jumps out of tested application after clicking "Refresh" button.

What version of the product are you using? On what operating system?
Robotium 2.2, Moto Milestone(Droid2) Android 2.2

Please provide any additional information below.
Do the actions on tested application manually, it can work well.

Do a change for restart "HelloActivity" code, it can simulate very well, not 
jumps out.
PackageManager manager = getPackageManager();
Intent intent = manager.getLaunchIntentForPackage(getPackageName());
intent.setAction(null);
startActivity(intent);

Why it cannot work well when Intent's Action is "android.intent.action.MAIN", 
how to resolve it?

Original issue reported on code.google.com by derek110...@gmail.com on 24 Aug 2011 at 2:04

GoogleCodeExporter commented 9 years ago
Unfortunetely I can not help you with this. It is not a Robotium bug.

Original comment by renasr...@gmail.com on 26 Aug 2011 at 9:51