android - Robotium Drag does not work -
i have written game using andengine want test using robotium. problem robotium's drag function not work. have robotum 4.0 jar added build path , exported, , manifest file seems correct. second test(joystick) fails movement never takes place. test class:
package cs428.uiuc.robotswarms.test; import junit.framework.assert; import org.andengine.entity.sprite.animatedsprite; import com.jayway.android.robotium.solo.solo; import cs428.uiuc.robotswarms.robotswarms; import android.test.activityinstrumentationtestcase2; public class testmotion extends activityinstrumentationtestcase2<robotswarms> { public testmotion() { super(robotswarms.class); } private solo solo; protected void setup() throws exception { super.setup(); setactivityinitialtouchmode(true); solo = new solo(getinstrumentation(), getactivity()); } protected void teardown() throws exception { solo.finishopenedactivities(); super.teardown(); } private void waitforspriteinitialisation(robotswarms activitydata) { while (activitydata.getplayersprite() == null) { } } public void testjoystickmovement() { robotswarms activitydata = getactivity(); final float fromx = 400.0f; float tox = 380.0f; final float fromy = 208.0f; float toy = 208.0f; animatedsprite playersprite; waitforspriteinitialisation(activitydata); playersprite = activitydata.getplayersprite(); float initialplayerxposition = playersprite.getx(); solo.sleep(2000); solo.drag(fromx, tox, fromy, toy, 5); solo.sleep(2000); playersprite = activitydata.getplayersprite(); float playermovedx = playersprite.getx(); assert.asserttrue(playermovedx != initialplayerxposition); } }
target application manifest file:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cs428.uiuc.robotswarms" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" android:debuggable="true"> <activity android:name="cs428.uiuc.robotswarms.robotswarms" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application>
test project manifest file:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cs428.uiuc.robotswarms.test" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" /> <instrumentation android:name="android.test.instrumentationtestrunner" android:targetpackage="cs428.uiuc.robotswarms" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <uses-library android:name="android.test.runner" /> </application>
i have tried using touchutils instead of robotium not seem work either. edit: bump
Comments
Post a Comment