instrumentation

Unable to resolve activity for: Intent when instrumentation-testing android activities

谁说我不能喝 提交于 2019-12-01 06:54:03
I'm getting errors when I'm trying to run insturmentation tests on android. I've written an Activity, called AudioPlayerActivity that lies in the package com.mycompany.mobile.android.gui , and now I'm trying to test the GUI of that project and I'm running in the following error: java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.mycompany.mobile.android.gui/.AudioPlayerActivity } I have read this question , and followed the advice there, but to no avail. I also googled for the error, but did not find any help. This is how

Unable to resolve activity for: Intent when instrumentation-testing android activities

China☆狼群 提交于 2019-12-01 04:55:41
问题 I'm getting errors when I'm trying to run insturmentation tests on android. I've written an Activity, called AudioPlayerActivity that lies in the package com.mycompany.mobile.android.gui , and now I'm trying to test the GUI of that project and I'm running in the following error: java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.mycompany.mobile.android.gui/.AudioPlayerActivity } I have read this question, and followed

Testing onActivityResult()

◇◆丶佛笑我妖孽 提交于 2019-12-01 02:32:45
I have the following Activity: package codeguru.startactivityforresult; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class StartActivityForResult extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); this.startButton = (Button) this.findViewById(R.id.start_button); this.startButton.setOnClickListener(onStart); } @Override protected void onActivityResult(int requestCode,

Testing onActivityResult()

烈酒焚心 提交于 2019-11-30 22:56:49
问题 I have the following Activity: package codeguru.startactivityforresult; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class StartActivityForResult extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); this.startButton = (Button) this.findViewById(R.id.start_button); this

Instrumentation test for Android - How to receive new Activity after orientation change?

本小妞迷上赌 提交于 2019-11-30 21:27:59
I'm trying to test, if newly created Activity (after orientation change) is properly reinitialized. The code below shows that activity returned from getActivity() is the one constructed in setUp(), not the newly created one. Test: public class MyActivityTest extends ActivityInstrumentationTestCase2<MyActivity>{ private static final String TAG = "RAMPS"; private MyActivity mActivity; public MyActivityTest() { super("com.ramps", MyActivity.class); } protected void setUp() throws Exception { super.setUp(); mActivity = getActivity(); Log.v(TAG, "setUp; activity=" + mActivity); } public void

How to pass an argument to an AndroidTestCase?

▼魔方 西西 提交于 2019-11-30 20:26:23
I've implemented an Instrumentation and an AndroidTestCase. For my tests I need to connect to an external WIFI device. I want the testers to be able to specify an SSID for the test to use. Giving the the command line (adb shell am instrument ...) to run the test is not a problem, but how can I add the SSID to the command line and extract it in the code? To expand on selalerer 's answer , instrumentation test(s) can be started with arguments specified via Gradle: ./gradlew -Pandroid.testInstrumentationRunnerArguments.exampleArgument=hello connectedAndroidTest You can retrieve instrumentation

How to pass an argument to an AndroidTestCase?

本小妞迷上赌 提交于 2019-11-30 15:26:27
问题 I've implemented an Instrumentation and an AndroidTestCase. For my tests I need to connect to an external WIFI device. I want the testers to be able to specify an SSID for the test to use. Giving the the command line (adb shell am instrument ...) to run the test is not a problem, but how can I add the SSID to the command line and extract it in the code? 回答1: To expand on selalerer's answer, instrumentation test(s) can be started with arguments specified via Gradle: ./gradlew -Pandroid

Identify loops in java byte code

孤街浪徒 提交于 2019-11-30 10:40:08
问题 I am trying to instrument java byte code. I want to recognize the entry and exit of a java loop , but I have found the identification of loops to be quite challenging. I have spent a good few hours looking at ASM and open source de-compilers (whom I thought must solve this problem all the time), however, I came up short. The tool I am augmenting / extending, is using ASM, so ideally I would like to know how to instrument the entry and exit of the different loop constructs in java via ASM .

How to start Instrumentation project programmatically using Android Intent?

旧街凉风 提交于 2019-11-30 10:00:50
one way to start testcase is, adb shell am instrument -w com.google.vishal.test/android.test.InstrumentationTestRunner i want to start this using Android code (with intent) for example, adb shell am start -n com.google.android.contacts/.ContactsActivity we can run using Android intent by following method :- Intent intent = new Intent(com.google.android.contacts, ContactsActivity.class); startActivity(intent); But, how to run adb shell am instrument -w com.google.vishal.test/android.test.InstrumentationTestRunner by Android intent ? Thanks for your help in advance :-) Command to start

What is instrumentation?

时光毁灭记忆、已成空白 提交于 2019-11-30 04:38:05
I've heard this term used a lot in the same context as logging, but I can't seem to find a clear definition of what it actually is. Is it simply a more general class of logging/monitoring tools and activities? Please provide sample code/scenarios when/how instrumentation should be used. I write tools that perform instrumentation. So here is what I think it is. DLL rewriting. This is what tools like Purify and Quantify do. A previous reply to this question said that they instrument post-compile/link. That is not correct. Purify and Quantify instrument the DLL the first time it is executed after