instrumentation

How to fix INJECT_EVENT permission exception when sending touches to an ActivityInstrumentationTestCase2 test

时光总嘲笑我的痴心妄想 提交于 2019-12-12 09:43:21
问题 Although there are many examples showing that something like this should work, the following code fails. This code lives in a test project that is associated with the real project. public class MyTest extends ActivityInstrumentationTestCase2<MyActivity> { public MyTest(String name) { super("com.mypackage.activities", MyActivity.class); setName(name); } public void testTap() throws Throwable { //Required by MotionEvent.obtain according to JavaDocs long downTime = SystemClock.uptimeMillis();

How to resolve Exception during suite construction?

不问归期 提交于 2019-12-12 09:40:14
问题 I have followed the below steps to test my app. I have created Android Project. I have created the debug signature for my sample app and test app(which need to be tested) Place the sampleapp_debug.apk in the bin folder (where my workspace is there) Installed the testapp_debug.apk in the emulator. Now i am running the project as a Android JunitTest. I am getting the below error.. How to resolve this.. java.lang.RuntimeException: Exception during suite construction at android.test.suitebuilder

Ignoring report generation for specific classes in cobertura maven plugin

谁都会走 提交于 2019-12-12 08:25:21
问题 I've been using Cobertura plugin for report generation and instrumentation (with surefire). Here is the issue I am facing: I am unable to make the plugin ignore report generation for specific classes in my project. PF below the related excerpt from pom.xml, I have added the ignore tag, but that just ignores instrumentation for the ignored classes. I want the report for specific projects to not be generated at all. Firstly, due to my limited knowledge of both Maven and Conberture, I want to

WPF Webbrowser create html file from user input

一个人想着一个人 提交于 2019-12-12 07:24:48
问题 I'm reading a html using the webbrowser component in WPF. I should let the user to give there own text, upload an image and save it as a .html file . By this way I can get the tag value: string myTagValue = (FrameWithinGrid.Document as mshtml.HTMLDocument) .getElementsByTagName("div") .OfType<mshtml.IHTMLElement>() .First() .innerText; How can i get the value from a text box and save it as a .html file including a new image? Need your help. Thank you. This is the html file: <!DOCTYPE HTML

How can I inject code in python programs so that they can print the conditions inside the if statement?

主宰稳场 提交于 2019-12-12 04:59:53
问题 I am looking for a way to instrument (Inject code inside) python programs. For example, if a program hits the if condition x > 2 , I want to automatically add a print statement following the if condition which prints to the console x > 2 . The source code of the program is not available. 回答1: You can use the ast module, but you still need the sources. If you have only the bytecode, you must use something like uncompyle6 in order to get the source back - since you are doing this automatically

Javassist CannotCompileException when trying to add a line to create a Map

与世无争的帅哥 提交于 2019-12-12 04:39:46
问题 um trying to instrument a method to do the following task. Task - Create a Map and insert values to the map Adding System.out.println lines wouldn't cause any exception. But when i add the line to create the Map, it throws a cannotCompileException due to a missing ; . When i print the final string it doesn't seem to miss any. What am i doing wrong here. public void createInsertAt(CtMethod method, int lineNo, Map<String,String> parameterMap) throws CannotCompileException { StringBuilder

Delete all sharedPreferences in Android [duplicate]

倖福魔咒の 提交于 2019-12-11 06:57:25
问题 This question already has answers here : Do the same thing as clear data button (2 answers) Closed 4 years ago . Is it possible to programmatically delete all sharedPreferences of an Android application, without knowing the file names? I mean all files, not all keys of a given file. I'm running unit tests with instrumentation for several applications, and i need to clear every file the an app may create under /data/data/app.package.name/shared_prefs folder. For example an app may create these

gcc gprof/gcov/other - how to get sequence of function calls/exits + control flow statements

给你一囗甜甜゛ 提交于 2019-12-11 05:06:44
问题 BACKGROUND We have testers for our embedded GUI product and when a tester declares "test failed", sometimes it's hard for us developers to reproduce the exact problem because we don't have the exact trace of what happened. We do currently have a logging framework but us devs have to manually input those logging statements in the code which is fine . . . except when a hard-to-reproduce bug occurs and we didn't have a log statement at the 'right' location and then when we re-build, re-run the

How to get Stmt class object from Expr object in Clang

社会主义新天地 提交于 2019-12-11 04:56:15
问题 I am writing a clang plugin for inserting assertions in a C code. I have implemented a class for visiting each unary operator and check if it is a pointer dereference. If it is, I would like to insert an NULL pointer assertion check for it. But I am stuck as I cannot figure out how to get the Stmt object containing the Expr object in Clang. This is my code which instruments the assertion but at a completely wrong location (ie just after the pointer dereference. I would like to do it just

Android instrumentation.execStartActivity parameters

一笑奈何 提交于 2019-12-11 04:24:57
问题 Having a bit of trouble. I'm trying to start an activity using another activity and need to get the 7 parameters of the execStartActivity method in the instrumentation.java class. From what I can tell the method is as follows: execStartActivity( Context who, IBinder contextThread, IBinder token, Activity target, Intent intent, int requestCode, Bundle options) { Suppose my starting activity is called MainActivity. Obviously the who parameter, as stated in documentation, is my base activity so