Android :: Unit Test Build Error

Mar 8, 2010

I just switched the way my Android project is being built and non of my unit tests work any more...I get errors like WARN/dalvikvm(575): VFY: unable to resolve static field X in WARN/dalvikvm(575): VFY: unable to find class referenced in signature These errors only come from my Unit Tests, where classes defined in it can't even see other classes defined in the unit test. Before each project had it's own directory with copies of the 3rd party jar files. I've read around that Dex does weird things with references but haven't been able to figure out how to fix this problem. Is there a better way to do this? I would love to see an example of a large Android workspace where there are multiple projects, jar references, etc.Is it possible to fix this with an Order/Export tweak ?

Android :: Unit Test Build Error


Android :: Error When Unit Test With Activity Instrumentation Test Cas­e 2?

Aug 23, 2009

I am using ActivityInstrumentationTestCase2 to do some test for an activity. I get a button in the setUp() method like this: protected void setUp() throws Exception {super.setUp(); act = getActivity(); btn = Button)act.find ViewById ( R.id.bike_button ); // this button has been defined in layout} Then I use this button to perform a click in a test method like this: public void testBikeButton(){ //click the bike button btn.performClick();}

View 7 Replies View Related

Android :: How To Transfer Test Fixture File To Device From Unit Test Application?

Sep 24, 2010

I'm writing an Android JUnit test and want to copy/reset a test fixture file (it's an SQLite database file.) If I were within the main application, I know I could just place the file in the assets directory and use getResources().getAssets().open(sourceFile).However, this API appears to be unavailable from the ActivityInstrumentationTestCase2 class.Is there an easy way to copy a file over from the testing PC, or should I just keep a fresh copy of a test fixture on the device and copy it over a temporary file?

View 2 Replies View Related

Android :: Is It Unit Test Or An Integration Test?

Nov 9, 2010

I'm working on a school project and I'm researching testing possibilities for Android applications. On this page: http: // developer . android . com/ resources / tutorials /testing /hello android. Google writes about a unit test. Is this really a unit test? A Unit test will not integrate all classes and will not test in his context. So my opinion is it is not a Unit Test but an Integration Test.

View 7 Replies View Related

Android :: Way To Unit Test Phone Library App?

Nov 16, 2010

Sorry if this is a bit of a vague question, however im struggling to find a single solid example on how to do unit testing (isolated testing) with Android. So one project contains models and logic, then another project contains tests for said library. There is no front end or UI, so I want to do the bare minimum to just be able to test that my methods all work in isolation.

View 1 Replies View Related

Android :: Author Unit Test Case

Oct 23, 2009

I have downloaded donut branch and build for emulator. I am running the author test case in the following way cd /data;test_pvauthorengine -test 5 5 -video yuvtestinput.yuv - videoconfigfile mp4_config.cfg -audio amrtestinput.amr - audioconfigfile amr_config.cfg -output mp4.3gp Starting Test 5: AMR & YUV to AV using M4V Encoder .3gp Test PVSCHED:Scheduler 'PVAuthorEngineTestScheduler', Thread 0xafe43c24: Error! AO PvmiMIOFileInput Error 101 not handled PVSCHED:Scheduler 'PVAuthorEngineTestScheduler', Thread 0xafe43c24: Error! Reason 101

View 3 Replies View Related

Android :: Unit Testing With Test Only Assets

Jul 3, 2009

I my main app and tests are organized like this (standard from "android create project"): AndroidManifest.xml assets/ main app asset files src/tests/AndroidManifest.xml -- uses <instrumentation> to point to the main app assets/ -- test-specific asset files src/ Writing test cases with AndroidTestCase, I'd like to load asset files from the test-specific assets/ directory, not from the main app assets/ directory. How can I accomplish that? The normal way to load an asset would be getContext().getAssets().open ("foo.txt"), for assets/foo.txt in the main app. I assume I just have to somehow change the Context or the AssetManager to point to the test- specific assets directory, but I don't see any way to do that. I have looked into the tests/bin/MyApp-debug.apk to confirm that the test assets are in there. Now I just need a way to access them.

View 2 Replies View Related

Android :: How To Refactor Class So I Can Unit Test It?

May 21, 2010

I am trying to unit test a class that does SAX parsing and creates an object.This class takes a string as a parameter representing the URL of a document on the internet, parses it and then creates an object based on the contents.I don't want to have the unit tests actually access the network, so I'd like to have a few test xml files to parse. However I can't figure out how to access them from my AndroidTestCases. I don't want to include the test files with the actual application, I want them in the test project (it's a separate project, as is the norm for Android tests from what I could gather - due to the need to have a custom AndroidManifest.xml, for one).One way would be to put the XML files in the test project's assets directory, I can read them using getContext() .getAssets().open(filename) into an InputStream in the test case, but my class expects a URL string. I'd rather not have to provide an InputStream to this class instead of the current URL string. I can test just the parsing by making two methods, one that takes a string and one an Inputstream, and test the second, but how can I then test the one that just takes a string?How should I design my class and or tests to circumvent this problem?

View 1 Replies View Related

Android :: Unnecessarily Hard To Unit Test?

Oct 8, 2009

Being able to write Android apps in regular Java is a huge win. However, I am confused about unit testing Android apps. Many of the 'best practices' seem to boil down to 'split your business logic off, and test it separately using JUnit'. This is great as far as it goes. And I understand that truly testing the UI will require firing up the emulator. But it seems there is a category of UI tests that I should be able to run without the emulator. The various Mockxxx classes seem to be going a long way towards this. But why (oh why oh why!) do they all. throw new RuntimeException( "Stub!" ); in their constructors? I can understand them doing this in their METHODS (then I could subclass them as needed) but why their constructors? I cannot stop this functionality so I cannot do (limited but useful) UI tests such as public TextView createTextView ( Context context ) {return new TextView( context );

View 3 Replies View Related

Android :: Add New Id To R.id To Later Reference It Via FindViewById() In Unit Test?

Jul 9, 2010

I am creating an EditText object which i then try to reference in a unit test. what is the best way to add a new 'id' to R.id for this dynamically created object so that i can later reference it via findViewById() in the unit test?

View 2 Replies View Related

Android :: Writing Unit Test For Parcelable Object

Feb 6, 2009

I follow the following example in creating a Parcelable object: http://code.google.com/android /reference / android /os / Parcelable .html . Writing unit test for parcelable object

View 4 Replies View Related

Android :: Relative Layout Unit Test Setup

Mar 20, 2010

i'm trying to write an unit test for my Android's RelativeLayout. Currently, my testcode setup is as follow:public class SampleRelativeLayoutTest extends AndroidTestCase {private ViewGroup testView;private ImageView icon;private TextView title;@Overrideprotected void setUp() throws Exception {super.setUp();
// inflate the layout
final Context context = getContext();
final LayoutInflater inflater = LayoutInflater.from(context);
testView = (ViewGroup) inflater.inflate(R.layout.sample_layout,
null);
// manually measure and layout
testView.measure(500, 500);
testView.layout(0, 0, 500, 500);
// init variables
icon = (ImageView) testView.findViewById(R.id.icon);
title = (TextView) testView.findViewById(R.id.title);
}However, I encountered NullPointerException with the following stack tracejava.lang.NullPointerException
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:427)
at android.view.View.measure(View.java:7964)
at com.dqminh.test.view.SampleRelativeLayoutTest.setUp(SampleRelativeLayoutTest.java:33)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:430)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)
What should I change in my setUp() code to make the test run properly ?

View 1 Replies View Related

Android :: How Can I Unit Test Activity That Acts On Accelerometer?

May 10, 2010

I am starting with an Activity based off of this ShakeActivity and I want to write some unit tests for it. I have written some small unit tests for Android activities before but I'm not sure where to start here. I want to feed the accelerometer some different values and test how the activity responds to it. For now I'm keeping it simple and just updating a private int counter variable and a TextView when a "shake" event happens. So my question largely boils down to this: How can I send fake data to the accelerometer from a unit test?

View 3 Replies View Related

Android :: Good Automated Unit And System Test Tools?

Nov 3, 2010

I approached this problem as an oh hey that's not too bad, I can write a bunch of unit tests, and I have been keeping my suite green. However as things get more involved continuous integration and testing is a great great thing to have. And then I saw oh Android has emma integration as well awesome ... and then that's where it get's iffy. So I setup Hudson and have it call the coverage target of the ant build.xml that the android executable in the sdk can generate. And then it hits me. adb -s <emulator> shell am instrument -w ... will never return a result code that is not 0 ... because adb technically exited cleanly and usually will regardless of how the shell command that executed did..............

View 6 Replies View Related

Android :: How Do I Sync Message Queue Thread In Unit Test?

Mar 30, 2010

I'm writing unit tests for a ListActivity in Android that uses a handler to update a ListAdapter. While my activity works in the Android emulator, running the same code in a unit test doesn't update my adapter: calls to sendEmptyMessage do not call handleMessage in my activity's Handler. How do I get my ActivityUnitTestCase to sync with the MessageQueue thread and call my Handler?

View 2 Replies View Related

Android :: Get Dorid Unit Test Instrementation To Call Activity's OnActivityResult()?

Feb 3, 2009

Can you please tell me if you know how to get the Andorid unit test instrementation to call my activity's onActivityResult()?

I can't find anything here: http://code.google.com/android/reference/android/app/Instrumentation.

View 4 Replies View Related

Android :: Build Error Build/core/java.mk:20 On 2.2

Jun 24, 2010

I downloaded the Android 2.2 source code and try to build it. When I executed the make command, I got an error here like this build/core/java.mk:20: *** frameworks/ex/common: Invalid LOCAL_SDK_VERSION '8' Choices are: current 4 5 6 7. Stop. Then I changed the frameworks/ex/common/Android.mk to LOCAL_SDK_VERSION = 8 from LOCAL_SDK_VERSION = 7. Next place, build/core/java.mk:20: *** external/jsr305: Invalid LOCAL_SDK_VERSION '8' Choices are: current 4 5 6 7. Stop. I changed the external/jsr305/Android.mk to LOCAL_SDK_VERSION = 8 from LOCAL_SDK_VERSION = 7

Last one, build/core/java.mk:20: *** external/guava: Invalid LOCAL_SDK_VERSION '8' Choices are: current 4 5 6 7. Stop. I changed the external/guava/Android.mk to LOCAL_SDK_VERSION = 8 from LOCAL_SDK_VERSION = 7
By these changes the code started the compilation.

1. Why the error occured?
2. Changes which I did is correct or not?

View 3 Replies View Related

Android :: How Can I Source-level Debugging In Unit Test Caes In Android Under Eclipse With ADT?

Feb 2, 2009

I can run the unit test cases either by :

1. command line ' adb shell am instrument -w com.example.android.apis.tests/android.test.InstrumentationTestRunner'

2. Go to 'Dev' and clicks 'Instrumentation' and click 'Test API Demo'.But my questions now is, how can I debug my unit test cases? I try 'Debug' my APIDemoTest eclipse project and then do #2 above, it did not break at any of my breakpoints I setup.

View 3 Replies View Related

Android :: Test Data Sources In Android Unit Testing

Jan 27, 2010

I want to test parsing of data returned from server.I thought I might create several test XML files and then feed them to the sax parser which uses my custom data handler (as in the application that I test).But where should I put those test XMLs?I tried with [project_root] /res/xml, but then I get the error: android.content.res.Resources $NotFoundException: Resource ID #0x7f040000 type #0x1c is not valid at android.content. res. Resources. loadXml ResourceParser(Resources.java:1870)at android.content.res. Resources. getXml(Resources. java:779) Does that mean that the xml is invalid, or that android couldn't find the XML file?(I use the same XML that comes from the server - copied it from the firebug's net panel and pasted into the file).Can I somehow read that XML as a text file, since etContext(). getResources() .getXml (R.xml.test_response1) returns XmlResourceParser instead of String (which I'd prefer)?

View 1 Replies View Related

Android :: How To Start Android Test Unit From Command Line?

Nov 16, 2010

Here is my manifest file:<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=" http://schemas. android. com /apk/res/android" package="com. wsandroid.test" android:version Code= "1" android:versionName="1.0"><application android:icon="@drawable/icon" android : label ="@string/app_name"><uses-library android:name="android.test.runner" /></application> <uses-sdk android:minSdkVersion="3" /><instrumentation android:targetPackage="com.wsandroid" android :name="android.test.InstrumentationTestRunner" />

View 1 Replies View Related

Android :: How To Build Test App With Dependency On Another App Using Ant?

Mar 17, 2010

I have a module called MyApp, and another module called MyAppTests which has a dependency on MyApp. Both modules produce APKs, one named MyApp.apk and the other MyAppTests.apk.I normally build these in IntelliJ or Eclipse, but I'd like to create an ant buildfile for them for the purpose of continuous integration.I used "android update" to create a buildfile for MyApp, and thanks to commonsware's answer to my previous question I've been able to build it successfully using ant.I'd now like to build MyAppTests.apk using ant. I constructed the buildfile as before using "android update", but when I run it I get an error indicating that it's not finding any of the classes in MyApp.Taking a que from my previous question, I tried putting MyApp.apk into my MyAppTests/libs, but unfortunately that didn't miraculously solve the problem.

View 1 Replies View Related

Android :: Can't Build And Run An Test Project Created

Mar 18, 2010

I have a module that builds an app called MyApp.I have another that builds some testcases for that app, called MyAppTests. They both build their own APKs, and they both work fine from within my IDE. I'd like to build them using ant so that I can take advantage of continuous integration.Building the app module works fine. I'm having difficulty getting the Test module to compile and run.I used android create test-project -p MyAppTests -m ../MyApp -n MyAppTests to create the necessary build files to build and run my test project. This seems to work great (once I remove an unnecessary test case that it constructed for me and revert my AndroidManifest.xml to the one I was using before it got replaced by android create), but I have two problems.Any idea what's causing the "Class ref in pre-verified class resolved to unexpected implementation" error?

View 3 Replies View Related

Android :: Cannot Test Build Phone Appl On HTC Evo

Aug 22, 2010

I cannot test build Android application on my HTC Evo at all. I searched online for answers, but nothing helped, including updating all the software. The Eclipse launched Emulator doesn't recognize it as an external device either.

View 1 Replies View Related

Android :: How To Build Ctsand To Add And Run Your Test Case

May 13, 2010

From 2.0 the cts is freely downloadable from android's repository.

But there is no documents about it.

Does anyone can tell me:

How to build cts? Is there a standard procedure? How to run cts? How to add customized test case?

Here, share my experience. After repo sync all source, you can't directly run "make" to build all source.
You will get some errors.

Now, I'am trying to first build android source without cts, and then build cts alone.

Also, here are some reference for run cts:

http://i-miss-erin.blogspot.com/2010/05/how-to-add-test-plan-package-to-android.html
www.mentby.com/chenny/how-does-cts-work-where-can-i-get-the-test-streams.html
www.jxva.com/?act=blog!article&articleId=157

1st time Update @ 5-13 18:39 +8:00

I do the following steps:

1.build android source without cts (move cts out of the $SDK_ROOT).

2.build cts (move cts back).

both jdk1.5 and 1.6 have the following errors:

CODE:.....................

View 1 Replies View Related

Android :: Verify Error While Trying To Run Unit Tests

Aug 5, 2009

I'm getting VerifyErrors when running unit tests. My tests are setup as a separate eclipse project which references the project I am testing. I have a class in my project which I use fairly heavily in my test project and this class is getting rejected by Dalvik.I also have a third party jar on the build path of both the project under test and the test project. This causes no problems when running the project under test so I can't see why it should when running the test project, basically I'm stumped. I have posted the error text below, MyProjectClass is a class in the project under test which is used fairly heavily in the test project.

View 7 Replies View Related

Android :: Build Fingerprint - Generic - Google Sdk/generic - 1.5/CUPCAKE - 147336 - Eng - Test-keys

Aug 4, 2009

While running i am getting this error in my logcat and my app exiting automatically...

CODE:....................

View 3 Replies View Related

Android :: SDK 1.5 Build Error

Apr 15, 2009

I'm attempting to test one of my applications in the SDK1.5 environment, but when it tries to build, I get this error:

[2009-04-15 12:33:13 - Battle Bricks] trouble processing "java/awt/font/NumericShaper.class": [2009-04-15 12:33:13 - Battle Bricks] Attempt to include a core VM class in something other than a core library. It is likely that you have attempted to include the core library from a desktop virtual machine into an application, which will most assuredly not work. If you really intend to build a core library -- which is only appropriate as part of creating a full virtual machine binary, as opposed to compiling an application -- then use the "--core-library" option to suppress this error message. If you go ahead and use "--core-library" but are in fact building an application, then please be aware that your build will still fail at some point; you will simply be denied the pleasure of reading this helpful error message.

But I've tested my other application in the environment, and it worked fine. I've looked through my imports, and none of my files import NumericShaper, so I'm confused as to why it seems to think that it is being referenced.

View 5 Replies View Related

Android :: Opencore Test Cases Error

Feb 24, 2010

I guess ur doing it correctly.While running the test cases already provided by the PVcore,one can only see the logs and not the output on the screen or the speaker. This is what my experience says.Other people who worked on this can confirm.

View 2 Replies View Related

Android :: Build Failure - Got Error

Jul 7, 2010

I followed instructions from here. After $ repo sync I tried to build it with $ make, but got this error:

CODE:............

Using Ubuntu 10.04 LTS.

UPD: I found a discussion, that claims, that problem could be that I'm having 64bit libs on my 32bit system.

CODE:.....

How do I figure out, if that libz.so.1.2.3.3 is the right lib, and in case I have to replace it with the right one, how do I do it?

View 3 Replies View Related

Android :: Build Project - MTJ Error?

Oct 3, 2009

I've the latest 1.6 sdk. I would like to build the project on 1.5 as well as on 1.6. New 1.6 also comes with 1.5. My build succeeds, but I get a bunch of error --- Not sure if I screwed the java env setup?

Exception Stack:

CODE:.............

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved