tag:blogger.com,1999:blog-25456655.post5368929285469352479..comments2024-03-23T07:01:55.848-04:00Comments on Diego Torres Milano's blog: Android: Testing on the Android platform - ApiDemos testsDiego Torres Milanohttp://www.blogger.com/profile/12030778501784140349noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-25456655.post-17580758111386996942010-05-02T04:03:45.120-04:002010-05-02T04:03:45.120-04:00Here is a ScreenCast I made on How to Unit Test on...Here is a ScreenCast I made on How to Unit Test on Android and Eclipse<br /><br />http://www.gubatron.com/blog/2010/05/02/how-to-do-unit-testing-on-android-with-eclipse/<br /><br />Watching this will save you a lot of headaches.Gubatronhttps://www.blogger.com/profile/11635778263252613707noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-88770136452340675192009-06-17T01:16:40.852-04:002009-06-17T01:16:40.852-04:00i was trying to run MediaFramework test suite as a...i was trying to run MediaFramework test suite as a part of Android unit testing. The test suite expects a big list of media files (mp3, mp4, wma, ogg, wav, amr, 3gp) to be available in sdcard mounted on the emulator. The list of files can be found in MediaNames.java file, since the names are hardcoded with the file name and params like width, duration, length, wait/pause time etc, it appears they should be available somewhere. But i couldn't find them anywhere in the code repository, so was wondering where to get these media files from. Tests can be probably done with own media, but the files are too many and it would be lengthier procedure to download them and update MediaNames.java file accordingly with the params i mentioned above. <br /> Any clue where we can find them.Rajahttps://www.blogger.com/profile/06867219001675058484noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-19861657775336486492009-04-14T18:48:00.000-04:002009-04-14T18:48:00.000-04:00Thanks Diego! I had both 1.0_R2 and 1.1_R1 on my ...Thanks Diego! I had both 1.0_R2 and 1.1_R1 on my system, and it does appear to have been a mismatch somewhere along the line. Fixed now.RodneyBhttps://www.blogger.com/profile/15052910445907545557noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-89797627949730494252009-04-13T06:43:00.000-04:002009-04-13T06:43:00.000-04:00Strange, it seems like you don't have the Anno...Strange, it seems like you don't have the Annotations classes.<BR/>Try upgrading to Android SDK 1.1 (http://developer.android.com/sdk/download.html?v=android-sdk-mac_x86-1.1_r1.zip) and be sure that you are using the same ApiDemos that came with your SDK.<BR/><BR/>Also verify that your AndroidManifest.xml has these lines:<BR/><BR/> <instrumentation android:name="android.test.InstrumentationTestRunner"<BR/> android:targetPackage="com.example.android.apis"<BR/> android:label="Tests for Api Demos."/>Diego Torres Milanohttps://www.blogger.com/profile/12030778501784140349noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-879522235677243372009-04-10T17:43:00.000-04:002009-04-10T17:43:00.000-04:00Diego,I'm having problems getting this demo to wor...Diego,<BR/>I'm having problems getting this demo to work. I've got android-sdk-mac_x86-1.0_r2, Eclipse Ganymede, and JUnit 4.5 on Mac OS X 10.5.<BR/><BR/>I more or less followed your instructions; won't guarantee I did it all the same, but the .apk's built, and I installed them to the emulator successfully. The "Tests for Api Demos" didn't show up in Instrumentation, so I shut down the emulator and restarted it, and then it did show up.<BR/><BR/>When I selected" Tests for Api Demos," LogCat says,<BR/>ERROR/dalvikvm(288): Unable to resolve Lcom/example/android/apis/ApiDemosApplicationTests; annotation class 164<BR/><BR/>and a few lines later:<BR/>ERROR/AndroidRuntime(288): java.lang.NoClassDefFoundError: android.test.suitebuilder.annotation.SmallTest<BR/><BR/>When I run from the command line, it produces the same NoClassDefFoundError.<BR/><BR/>Any idea what's causing this? Is there something I don't have set up right in Eclipse, or installed properly to the emulator?RodneyBhttps://www.blogger.com/profile/15052910445907545557noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-12606829772479741682009-03-24T22:59:00.000-04:002009-03-24T22:59:00.000-04:00I have been unable to make this work on Android 1....I have been unable to make this work on Android 1.0R2, Eclipse 3.4.2, and Windows XP SP3. <BR/><BR/>1) Open Eclipse<BR/>2) Select File -> New Android Project<BR/>3) Enter 'ApiDemosTest" for the project name<BR/>4) Enter "com.example.android.apis.tests" for the package.<BR/>5) Enter "Dummy" for the activity name.<BR/>6) Enter "Dummy" for the application name.<BR/>7) Click on the Finish button.<BR/>8) In the Navigator, select ApiDemos/tests and drag it into<BR/>ApiDemosTest.<BR/>9) Right click on ApiDemosTest and select Properties.<BR/>10) Select Java Build Path.<BR/>11) Select the Source tab.<BR/>12) Select ApiDemosTest/src and click on the Remove button.<BR/>13) Click on the Add Folder button.<BR/>14) Select tests/src.<BR/>15) Select the Projects tab.<BR/>16) Click on the Add button.<BR/>17) Select ApiDemos.<BR/>18) Click on the Ok button<BR/>19) Click on the Ok button<BR/>20) Select Project -> Build All.<BR/><BR/>The result is that I get the following errors:<BR/><BR/>Description Resource Path Location Type<BR/>Class com.example.android.apis.tests.Dummy does not exist<BR/>AndroidManifest.xml ApiDemosTest line 8 Android Problem<BR/><BR/>Description Resource Path Location Type<BR/>Package 'com.example.android.apis.tests' does not exist!<BR/>AndroidManifest.xml ApiDemosTest Unknown aapt ProblemUnknownhttps://www.blogger.com/profile/17947076031378363680noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-61814004843301215222009-03-10T21:01:00.000-04:002009-03-10T21:01:00.000-04:00I meant to copy the ApiDemos/test/AndroidManifest....I meant to copy the <B>ApiDemos/test/AndroidManifest.xml</B> to the root of the new project.Diego Torres Milanohttps://www.blogger.com/profile/12030778501784140349noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-40567672616934629242009-03-09T21:27:00.000-04:002009-03-09T21:27:00.000-04:00For "Copy AndroidManifest.xml"did you mean copy th...For "Copy AndroidManifest.xml"<BR/><BR/>did you mean copy the AndroidManifest.xml in tests/src folder? or other the apidemos folder, I copy and paste the apidemos's one, but build error, which says 42 error in AndroidManifest.xmlhakehttps://www.blogger.com/profile/15466930193004932417noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-25213650565947228272008-12-18T05:03:00.000-05:002008-12-18T05:03:00.000-05:00Most probably, if they're not listed in Instrument...Most probably, if they're not listed in Instrumentation, they are not installed.<BR/><BR/>Anyway, you can try<BR/><BR/>$ adb shell am instrument -w com.example.android.apis.tests/android.test.InstrumentationTestRunner<BR/><BR/>If you can provide more information I will be able to help you better.Diego Torres Milanohttps://www.blogger.com/profile/12030778501784140349noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-55868088592485617752008-12-17T21:09:00.000-05:002008-12-17T21:09:00.000-05:00Hi, i follow the step you gived. but wht it still ...Hi, i follow the step you gived. but wht it still can not show in the instrumentation. Is there another way to run the test?Grace Huhttps://www.blogger.com/profile/14670406835613401245noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-8651527137515461212008-12-03T21:43:00.000-05:002008-12-03T21:43:00.000-05:00When compile or build the project in eclipse autom...When compile or build the project in eclipse automaticlyLukeWhttps://www.blogger.com/profile/10151773464485930343noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-73853992442679791722008-12-02T04:13:00.000-05:002008-12-02T04:13:00.000-05:00Which step gave you that error ?Which step gave you that error ?Diego Torres Milanohttps://www.blogger.com/profile/12030778501784140349noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-69563475255320562312008-12-02T02:26:00.000-05:002008-12-02T02:26:00.000-05:00Hi Diego, I have justice the sources follow ur ins...Hi Diego, I have justice the sources follow ur instruction, but i got a error "Conversion to Dalvik format failed with error 1" <BR/>some solution for this ?LukeWhttps://www.blogger.com/profile/10151773464485930343noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-9025475424392079292008-11-18T14:59:00.000-05:002008-11-18T14:59:00.000-05:00I've received some comments requesting some clarif...I've received some comments requesting some clarification on the entire process of splitting ApiDemos.<BR/><BR/>1. Create <B>ApiDemosTests</B> project<BR/>2. Copy <B>tests/src</B> folder from <B>ApiDemos</B> to <B>ApiDemosTests</B><BR/>3. Open <B>tests</B> folder to show <B>src</B><BR/>4. Right click on <B>src</B> and select <B>Build path -> Use as Source Folder</B><BR/>5. Open <B>ApiDemosApplicationTests</B> from <B>com.example.android.apis</B> and click the light bulb next to the class definition and select <B>Fix project properties</B><BR/>6. Select <B>ApiDemos</B> project<BR/>7. Run<BR/><BR/>Hope this helps.<BR/><BR/><B>NOTE:</B><I>this process was tested on Linux and Eclipse Ganymede, may be slightly different on other platforms and versions</I>Diego Torres Milanohttps://www.blogger.com/profile/12030778501784140349noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-87935538862113906322008-11-13T05:18:00.000-05:002008-11-13T05:18:00.000-05:00Yes, that's the idea to split the ApiDemos project...Yes, that's the idea to split the ApiDemos project into two.Diego Torres Milanohttps://www.blogger.com/profile/12030778501784140349noreply@blogger.comtag:blogger.com,1999:blog-25456655.post-60506116060863988912008-11-13T00:33:00.000-05:002008-11-13T00:33:00.000-05:00I am a little unclear on the section "Copy ApiDemo...I am a little unclear on the section "Copy ApiDemos tests". The end result is an eclipse source folder named "tests" with a package named "com.example.andoid.apis.tests"?<BR/><BR/>I don't quite follow the steps to set that up.Matthewhttps://www.blogger.com/profile/11388741727938103917noreply@blogger.com