Ver Fonte

let tests run on emulator 2.2

Bartek Przybylski há 12 anos atrás
pai
commit
369f2adb50

+ 2 - 2
.classpath

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="gen"/>
 	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
 	<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="gen"/>
 	<classpathentry kind="output" path="bin/classes"/>
 </classpath>

+ 2 - 2
tests/.classpath

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="gen"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/owncloud-android"/>
 	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
 	<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="gen"/>
 	<classpathentry kind="output" path="bin/classes"/>
 </classpath>

+ 17 - 15
tests/AndroidManifest.xml

@@ -1,19 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.owncloud.android.test"
-    android:versionCode="1"
-    android:versionName="1.0" >
-
-    <uses-sdk android:minSdkVersion="8" />
-
-    <instrumentation
-        android:name="android.test.InstrumentationTestRunner"
-        android:targetPackage="com.owncloud.android" />
-
-    <application
-        android:icon="@drawable/ic_launcher"
-        android:label="@string/app_name" >
+          package="com.owncloud.android.test"
+          android:versionCode="1"
+          android:versionName="1.0">
+    <!-- We add an application tag here just so that we can indicate that
+         this package needs to link against the android.test library,
+         which is needed when building test cases. -->
+    <application>
         <uses-library android:name="android.test.runner" />
     </application>
-
-</manifest>
+    <!--
+    This declares that this application uses the instrumentation test runner targeting
+    the package of com.owncloud.android.test.  To run the tests use the command:
+    "adb shell am instrument -w com.owncloud.android.tests/android.test.InstrumentationTestRunner"
+    -->
+    <instrumentation android:name="android.test.InstrumentationTestRunner"
+                     android:targetPackage="com.owncloud.android"
+                     android:label="Tests for com.owncloud.android"/>
+</manifest>

+ 2 - 5
tests/src/com/owncloud/android/test/AccountUtilsTest.java

@@ -1,15 +1,12 @@
 package com.owncloud.android.test;
 
-import org.junit.Test;
+import android.test.AndroidTestCase;
 
 import com.owncloud.android.AccountUtils;
 import com.owncloud.android.utils.OwnCloudVersion;
 
-import junit.framework.TestCase;
-
-public class AccountUtilsTest extends TestCase {
+public class AccountUtilsTest extends AndroidTestCase {
     
-    @Test
     public void testGetWebdavPath() {
         OwnCloudVersion ocv12 = new OwnCloudVersion(0x010200);
         OwnCloudVersion ocv22 = new OwnCloudVersion(0x020200);