¡@

Home 

2014/10/16 ¤W¤È 08:14:10

android Programming Glossary: getinstrumentation

how to pass an argument to a android junit test (Parameterized tests)

http://stackoverflow.com/questions/14820175/how-to-pass-an-argument-to-a-android-junit-test-parameterized-tests

protected void setUp throws Exception solo new Solo getInstrumentation getActivity @Override public void tearDown throws Exception.. void testSomething MyTestRunner myTestRunner MyTestRunner getInstrumentation Log.d TAG argument myTestRunner.getArgument and get the arguments..

How do you test an Android application across multiple Activities?

http://stackoverflow.com/questions/1759626/how-do-you-test-an-android-application-across-multiple-activities

testAValidUserCanLogIn Instrumentation instrumentation getInstrumentation Register we are interested in the authentication activiry..... intent Wait for it to start... Activity currentActivity getInstrumentation .waitForMonitorWithTimeout monitor 5 assertThat currentActivity.. Wait for the welcome page to start... currentActivity getInstrumentation .waitForMonitorWithTimeout monitor 5 assertThat currentActivity..

Can't build and run an android test project created using “ant create test-project” when tested project has jars in libs directory

http://stackoverflow.com/questions/2472059/cant-build-and-run-an-android-test-project-created-using-ant-create-test-proje

HttpTest.java 19 cannot find symbol javac symbol method getInstrumentation javac location class com.myapp.test.HttpTest javac assertEquals.. class com.myapp.test.HttpTest javac assertEquals MyApp getInstrumentation .getTargetContext .getResources .getString com.myapp.R.string.app_name.. 19 cannot find symbol javac symbol method getInstrumentation javac location class com.myapp.test.SafeAsyncTest javac assertEquals..

Storing test files in the test project

http://stackoverflow.com/questions/6547783/storing-test-files-in-the-test-project

this will load xml from the android project assets folder getInstrumentation .getTargetContext .getResources .getAssets .open testFile This.. This will load xml from the test project assets folder getInstrumentation .getContext .getResources .getAssets .open testFile Make sure..

test if a button starts a new activity in android junit (pref without robotium)?

http://stackoverflow.com/questions/9405561/test-if-a-button-starts-a-new-activity-in-android-junit-pref-without-robotium

that need to be monitored. ActivityMonitor activityMonitor getInstrumentation .addMonitor NextActivity.class.getName null false open current.. activity. button.performClick NextActivity nextActivity getInstrumentation .waitForMonitorWithTimeout activityMonitor 5 next activity is..

how to pass an argument to a android junit test (Parameterized tests)

http://stackoverflow.com/questions/14820175/how-to-pass-an-argument-to-a-android-junit-test-parameterized-tests

super TARGET_PACKAGE_ID launcherActivityClass @Override protected void setUp throws Exception solo new Solo getInstrumentation getActivity @Override public void tearDown throws Exception try solo.finishOpenedActivities solo.finalize catch Throwable.. tests you can do something like this public void testSomething MyTestRunner myTestRunner MyTestRunner getInstrumentation Log.d TAG argument myTestRunner.getArgument and get the arguments that you can specify in the command line as adb shell..

How do you test an Android application across multiple Activities?

http://stackoverflow.com/questions/1759626/how-do-you-test-an-android-application-across-multiple-activities

extends InstrumentationTestCase @MediumTest public void testAValidUserCanLogIn Instrumentation instrumentation getInstrumentation Register we are interested in the authentication activiry... Instrumentation.ActivityMonitor monitor instrumentation.addMonitor.. instrumentation.startActivitySync intent Wait for it to start... Activity currentActivity getInstrumentation .waitForMonitorWithTimeout monitor 5 assertThat currentActivity is notNullValue Type into the username field... View currentView.. instanceOf Button.class TouchUtils.clickView this currentView Wait for the welcome page to start... currentActivity getInstrumentation .waitForMonitorWithTimeout monitor 5 assertThat currentActivity is notNullValue Make sure we are logged in... currentView..

Can't build and run an android test project created using “ant create test-project” when tested project has jars in libs directory

http://stackoverflow.com/questions/2472059/cant-build-and-run-an-android-test-project-created-using-ant-create-test-proje

mike Projects myapp android MyAppTests src com myapp test HttpTest.java 19 cannot find symbol javac symbol method getInstrumentation javac location class com.myapp.test.HttpTest javac assertEquals MyApp getInstrumentation .getTargetContext .getResources.. symbol javac symbol method getInstrumentation javac location class com.myapp.test.HttpTest javac assertEquals MyApp getInstrumentation .getTargetContext .getResources .getString com.myapp.R.string.app_name javac ^ javac Users mike Projects myapp android.. mike Projects myapp android MyAppTests src com myapp test SafeAsyncTest.java 19 cannot find symbol javac symbol method getInstrumentation javac location class com.myapp.test.SafeAsyncTest javac assertEquals MyApp getInstrumentation .getTargetContext .getString..

Storing test files in the test project

http://stackoverflow.com/questions/6547783/storing-test-files-in-the-test-project

in the assets folder. in your test code under test project this will load xml from the android project assets folder getInstrumentation .getTargetContext .getResources .getAssets .open testFile This will load xml from the test project assets folder getInstrumentation.. .getTargetContext .getResources .getAssets .open testFile This will load xml from the test project assets folder getInstrumentation .getContext .getResources .getAssets .open testFile Make sure your TestCase class extends android.test.InstrumentationTestCase..

test if a button starts a new activity in android junit (pref without robotium)?

http://stackoverflow.com/questions/9405561/test-if-a-button-starts-a-new-activity-in-android-junit-pref-without-robotium

public void testOpenNextActivity register next activity that need to be monitored. ActivityMonitor activityMonitor getInstrumentation .addMonitor NextActivity.class.getName null false open current activity. MyActivity myActivity getActivity final Button.. Runnable @Override public void run click button and open next activity. button.performClick NextActivity nextActivity getInstrumentation .waitForMonitorWithTimeout activityMonitor 5 next activity is opened and captured. assertNotNull nextActivity nextActivity..