草庐IT

test_method

全部标签

java - Espresso 2.0 - 在扩展 junit3 测试用例的类中用 @Test 注释的方法

当使用Espresso2.0附带的新ActivityInstrumentationTestCase2类时,我收到一个奇怪的警告Methodannotatedwith@Testinsideclassextendingjunit3testcase。我的类(class)看起来就像Google提供的示例类(class):importandroid.support.test.InstrumentationRegistry;importandroid.support.test.runner.AndroidJUnit4;importandroid.test.ActivityInstrumentati

android - java.lang.NullPointerException : Attempt to invoke interface method on a null object reference error on OnPostExecute() - AsyncTask 异常

我正在尝试从AsyncTask中获取结果以显示在我的搜索Activity中。我有一个来自以前应用程序的示例,它是在一位同事的帮助下制作的(我是那里的实习生)。我根据这个应用程序的需要调整了示例,但现在我得到了NullPointerException:03-0403:50:23.865:E/AndroidRuntime(8224):FATALEXCEPTION:main03-0403:50:23.865:E/AndroidRuntime(8224):Process:com.cyberdog.what2watch,PID:822403-0403:50:23.865:E/AndroidRun

java.lang.NullPointerException : Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference 异常

我有一个BlankFragmentpackagecom.hfad.addingafragmenttoframelayout;importandroid.os.Bundle;importandroid.support.v4.app.Fragment;importandroid.util.Log;importandroid.view.LayoutInflater;importandroid.view.View;importandroid.view.ViewGroup;importandroid.widget.TextView;importorg.w3c.dom.Text;/***Asimp

NuGet引用依赖后,运行报错:System.MissingMethodException:“Method not found: ‘Microsoft.EntityFrameworkCore.Quer

Zack.EFCore.Batch运行报错:今天引用Zack.EFCore.Batch.MSSQL_NET6来做批量删除修改操作。下载引入注册等都正常,运行后编译成功了,但运行出错了。运行环境为vs2022,.net6,连接sqlserver。报错提示:System.MissingMethodException:“Methodnotfound:'Microsoft.EntityFrameworkCore.Query.SqlExpressions.SelectExpressionMicrosoft.EntityFrameworkCore.Query.RelationalParameterBase

java - 错误 :Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference

publicclassAlarmTaskimplementsRunnable{//ThedateselectedforthealarmprivatefinalCalendardate;//TheandroidsystemalarmmanagerprivatefinalAlarmManageram;//YourcontexttoretrievethealarmmanagerfromprivatefinalContextcontext;publicAlarmTask(Contextcontext,Calendardate){this.context=context;this.am=(Ala

玩转Google开源C++单元测试框架Google Test系列(gtest)之六 - 运行参数

目录一、前言二、基本介绍三、参数列表四、XML报告输出格式五、总结一、前言使用gtest编写的测试案例通常本身就是一个可执行文件,因此运行起来非常方便。同时,gtest也为我们提供了一系列的运行参数(环境变量、命令行参数或代码里指定),使得我们可以对案例的执行进行一些有效的控制。二、基本介绍前面提到,对于运行参数,gtest提供了三种设置的途径:1.系统环境变量2.命令行参数3.代码中指定FLAG因为提供了三种途径,就会有优先级的问题,有一个原则是,最后设置的那个会生效。不过总结一下,通常情况下,比较理想的优先级为:命令行参数>代码中指定FLAG>系统环境变量为什么我们编写的测试案例能够处理这

android - com.android.dex.DexIndexOverflowException : method ID not in [0, 0xffff]:android studio 中的 65536

我有一个安卓项目。当我将它导入eclipse时。它工作正常。但是当我将它导入到Androidstudio时,它给出了:-com.android.dex.DexIndexOverflowException:方法ID不在[0,0xffff]:65536构建时出错。一个项目甚至有可能在eclipse和AndroidStudio中表现不同。在这两种情况下(是/否),我该如何解决我已经检查了我的build.gradle文件中的依赖项。所有依赖项都与我在eclipse中使用的相同。 最佳答案 对于ANDROIDSTUDIO...启用即时运行在F

android - 将参数从按钮传递到 android :onClick method

您好,我的Activityxml中有类似这样的东西(3个按钮)指向相同的方法:有什么方法可以确定在printNo方法中按下了哪个按钮? 最佳答案 publicvoidprintNo(Viewv){switch(v.getId()){case(R.id.Button_1)://stuffbreak;case(R.id.Button_2)://stuffbreak;case(R.id.Button_3)://stuffbreak;} 关于android-将参数从按钮传递到android:on

Android 回收查看 LogCat : Could not find method

我使用了Android支持库中的RecyclerView。在装有Android4.1.2(API16)的三星GalaxyS2上运行时,一切正常,但在Logcat中我看到消息:03-24I/dalvikvm:DexOpt:illegalmethodaccess(callLandroid/support/v7/widget/RecyclerView$ViewHolder;.isUpdated()ZfromLnet/mytest/TransactionsAdapter$TransactionsAdapterViewHolder;)03-24I/dalvikvm:Couldnotfindmet

安卓工作室 : grant permission between installing test APK and running tests with graphical test runner

我正在尝试automatethedisablingofanimationsasdescribedinthispost,但这似乎只适用于connectedAndroidTest的命令行调用。我想在Studio中使用图形测试运行程序,列表框显示通过/失败的测试。使用该运行者,权限授予(adbshellpmgrant...android.permission.SET_ANIMATION_SCALE)永远不会运行,似乎是因为gradle任务installDebugAndroidTest永远不会运行,而是运行者正在运行Gradle到assembleDebugAndroidTest(或我在运行配置