Android :: Unit Testing A Seek Bar's Events?
Dec 6, 2009
I have a very simple activity created with one seek bar. I'm trying to figure out how best to unit test the events.
Below is how I have the seek bar wired up in my activity.
CODE:.........
So with this I have a test class that extends ActivityInstrumentationTestCase and I have test method.
Should I not be able to so something like this? Right now I'm getting Test run failed: String resource ID #0x2 with this code.
CODE:....................
View 2 Replies
Jul 14, 2010
I was finally able to build and debug the android platform (the process can be seen here). Now, the question is: where are the unit tests, how do I launch them and where do I see results? And also, is there any guide to android platform architecture?
View 1 Replies
View Related
Nov 17, 2010
There is no way to load a string from a specific locale's language file.
What I want to do is run all my locales' (I have 24 of them) time format strings through unit tests to make sure they don't crash. For example, here's a date format string in French: "'Hier à ' h:mm a".
These really need to be unit tested, because translators aren't great about properly escaping these strings, causing crashes unless we manually verify every string in every language every time we get a translation pass back.
This question has a sort-of answer. Is that really the only way? Is there a better way to specify the locale of a Context in unit tests?
View 1 Replies
View Related
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
Oct 5, 2010
I have a class that uses a Handler for a timed, asynchronous activity.
Something like this:
CODE:.................
View 11 Replies
View Related
Mar 30, 2010
I'm trying to start unit testing on my application (should have done so from the beginning). I've got an Eclipse project structure set up and everything seems to work well, but...
I'm subclassing SQLiteOpenHelper to access the application database. This works well for the application, but when using the same class in the unit tests, it writes to the same database as the actual application. This is obviously rather irritating, since unit test data shows up when developing and testing the actual application.
What's the best way to make the SQLiteOpenHelper class write to a different database file when being called from the unit tests?
View 2 Replies
View Related
Oct 8, 2010
I want to start with a consistent test environment so I need to reset/clear my preferences. Here's the SetUp for test I have so far. It's not reporting any errors, and my tests pass, but the preferences are not being cleared.
I'm testing the "MainMenu" activity, but I temporarily switch to the OptionScreen activity (which extends Android's PreferenceActivity class.)
I do see the test correctly open the OptionScreen during the run.
CODE
:...............
StartNewActivity Code:
CODE:.................
View 1 Replies
View Related
Oct 27, 2010
I'm trying to run unit tests on my Android app and I'm getting a NoClassDefFoundError when referencing 3rd party jars.
The classes in those jars are only referenced by the app itself, not the unit tests. The jars are on the apps classpath and have been exported in the eclipse settings to allow tyhem to be found by dependant apps - which, of course, the test app is.
View 1 Replies
View Related
Feb 22, 2010
I need to run unit tests for code that references SQLiteDatabase for my Android code; however all my attempts to instantiate this object outside the emulator (on my desktop machine) have failed. JDBC on Android is not being recommended on the Net, hence it's out of the question (I could have provided mock objects very easily that way).
View 2 Replies
View Related
Dec 18, 2009
What is the easiest way to create some kind of test harness for Android apps and to be able to visualize (even on the emulator) what is going into the db? I want to test things like constraints, look at the data, unit test methods, etc. Is there any kind of GUI tool that I can hook up to the emulator to be able to look at the db of a particular app while I'm developing/testing, or are my only options the adb shell and creating test Activities within my app?
View 1 Replies
View Related
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
May 13, 2010
Can any one help with how to test sensor events like shake on Android Emulator.I have found some posts pointing to openintents but can anyone explain how to use it in android 2.0 avd.
View 1 Replies
View Related
Feb 27, 2010
This is the code for motion events in my instrumentation testing.
long downTime = SystemClock.uptimeMillis();
long eventTime = SystemClock.uptimeMillis();
MotionEvent event = MotionEvent.obtain(downTime, eventTime,
MotionEvent.ACTION_DOWN, 100,100, 0);
MotionEvent event2 = MotionEvent.obtain(downTime, eventTime,
MotionEvent.ACTION_UP, 100, 100, 0);...............................
View 1 Replies
View Related
Aug 6, 2010
I'm new to android unit testing. I'm trying to write a unit test for the Phone application:
package com.android.phone;
import android.content.Intent;
import android.net.Uri;
import android.test.ApplicationTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import com.android.phone.PhoneApp;
import dalvik.annotation.TestTargetClass;...............
View 3 Replies
View Related
Feb 24, 2010
I wrote a simplest test based on android.test.ActivityInstrumentationTestCase2.
CODE:..............
View 2 Replies
View Related
Apr 16, 2009
I've been exploring the Android test package and I'm very confused on how to implement functional testing for endpoint-to-endpoint.
Consider the example below, I have 4 activities: 1. A Contact List Activity 2. A View Contact Activity 3. An Add/Edit Contact Activity 4. A Sync Contact List activity
I want to automate a few tests that will go through multiple test cases simulating a user experience: From launching the application, to selecting 'Add contact;' opening the add contact activity, entering data, saving it, going back to the list activity, and verifying the new contact was saved properly.
As I understand it, ActivityInstrumentationTestCase<T extends Activity> and ActivityUnitTestCase<T extends Activity>, are only useful for testing single activity functionality.
But what if I need to switch between 2 or more activities inside a single functional test case?
View 5 Replies
View Related
Jun 9, 2010
I am new to android. I want to customize a seek bar like attached image.white and brown portions are the images.
View 2 Replies
View Related
Nov 3, 2010
I'm developing one application which used SeekBar to control volume in MediaPlayer. The problem is when i move the seek bar at that time only the volume is increased, rest of the time default volume was set. Here is my code...
View 1 Replies
View Related
Sep 17, 2010
I'm developing an android application where i want to add the volume control in Status Bar. Can i add a seek bar inside the Status Bar. I have worked with NotificationManager and I've found that adding animation is difficult in Notification bar.But can anyone please suggest if i can add a seek bar in my Status Bar(Notification bar).
View 1 Replies
View Related
Apr 21, 2009
I want to make my own Seek Bar. When I try to override onProgressRefresh method, Eclipse give me an error: the method onProgressRefresh is undefined for the type SeekBar. I checked listing SeekBar.java and this method is in. Any ideas why this happened?
View 10 Replies
View Related
Oct 1, 2010
I am using seek bar to show the progress of the video which I am playing. I am using Media Player / Video View. But when I move the thumb of the seek bar back and forth, the video is not starting correspondingly from the position of the thumb. Anybody has any idea of how to load the video from where the seekbar's thumb is positioned?
View 2 Replies
View Related
May 11, 2009
I have developed seek bar component (I am showing while playing the song). If i seeks the bar the song is getting changed the position based on the seek bar change event, and playing fine. But if I leave the seek bar it is not moving based on the song sequence. I know we have to do something for that. Can any one tell me how to get the event for moving the seek bar based on the song sequence.
View 2 Replies
View Related
Apr 22, 2010
I need a seek bar to not be able to be adjusted, but without making the color change... setFocusable does not work for this. Is there a way to do this because it seems like there should be (without re- writing the seekbar class that is).
View 2 Replies
View Related
Oct 11, 2010
The seek bar of Mediacontroller is not been updating according to de audio player. Only when the trackball is shifted, or the play/pause button is clicked, the seek bar tracks the audio player. Could anybody give me any clue?
View 3 Replies
View Related
Feb 23, 2009
I guess this one is too advanced for the beginner's group, so I'll ask it here:
View 3 Replies
View Related
Feb 15, 2010
I want to make a custom seek bar having color gradient as shown in the below image URL.
View 6 Replies
View Related
Dec 3, 2009
How can we display a custom seek bar for a streaming video file in android?
View 1 Replies
View Related
Aug 18, 2010
How to change the rectangular thumb to round thumb in android seek bar?
View 4 Replies
View Related
Aug 13, 2010
I have two questions:
1) how do I change the color of the seek bar (path) from yellow (the default color) to white. What I mean to say is, while I slide the thumb , it turns the line traversed from grey to yellow. I want track/line to either remain grey or white..Basically I want just the thumb to move with no color change in the seek bar.
2)
How to change the thumb of seekbar from rectangle to circle/sphere/round shape.
View 1 Replies
View Related
Oct 12, 2009
I always thought the default display unit would be pixels.But when I run my application on WVGA800 in the emulator the lines are five pixels wide even though I called Paint.setStrokeWidth(3). The same seems to happen with Drawable.setBounds(); the value I provide gets multiplied by 1.5 internally. If that's the case, how can I specify pixels instead of dips if I want pixels?
View 3 Replies
View Related