[已解决]junit.framework.AssertionFailedError: No tests found in

Junit报错java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test]的解决 阅读详情
单元测试的时候报错

junit.framework.AssertionFailedError: No tests found in androidstudio.kodulf.unittestdemo2.TestCaseDo
at junit.framework.Assert.fail(Assert.java:50)
at junit.framework.TestSuite$1.runTest(TestSuite.java:97)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:115)
at android.support.test.internal.runner.junit3.AndroidTestResult.runProtected(AndroidTestResult.java:77)
at junit.framework.TestResult.run(TestResult.java:118)
at android.support.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:55)
at junit.framework.TestCase.run(TestCase.java:124)
at android.support.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:63)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at android.support.test.internal.runner.junit3.DelegatingTestSuite.run(DelegatingTestSuite.java:103)
at android.support.test.internal.runner.junit3.AndroidTestSuite.run(AndroidTestSuite.java:69)
at android.support.test.internal.runner.junit3.JUnit38ClassRunner.run(JUnit38ClassRunner.java:103)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)


Tests ran to completion.


这个报错最后发现原因是我的方法名是首字母大写的了

public class TestCaseDo extends TestCase {


    public void TestMax(){
        int max = TestClass.max(0, 1);
        assertEquals(max,1);
    }

}

解决办法:

方法名首字母小写

public class TestCaseDo extends TestCase {


    public void testMax(){
        int max = TestClass.max(0, 1);
        assertEquals(max,1);
    }

}




Android import junit.framework.Assert不存在 import junit.framework.Assert;不存在 下载junit-4.12.jar包,app目录下建议libs,复制进去,然后引入,成功。 阅读详情

相关推荐

Android MediaCodec学习笔记

模块介绍 基本概念 OpenMAX是Khronos Group提出的标准,目标在于创造一个统一的接口,加速大量多媒体资料的处理。OpenMAX分成三层:应用层(Application Layer, AL), 整合层(Integration Layer, IL) 以及开发层(Development Layer, DL)。 OpenMAX (Open Media Acceleration) OpenMAX AL Application Layer ..

kisshine 2358

junit.framework.AssertionFailedError: No tests found in **问题的解决

今天在跟B站学习aop的过程中,想要编写测试类来测试自己的aop到底成不成功,于是编写测试类如下: import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.itheima....

SilenceToPromise的博客 1997

Unity微信小游戏资源管理实战:YooAsset的Tag与Group策略精讲

本文深入解析了在Unity微信小游戏开发中,如何利用YooAsset的Tag与Group策略进行精细化资源管理。通过实战案例,详细阐述了如何通过Tag实现核心资源的必下与额外资源的按需加载,并借助Collector的合理打包策略,实现热更新包体最小化,从而有效解决加载慢、更新流量大的痛点,最终提升玩家体验。

weixin_29012677的博客 270

【已解决】junit.framework.AssertionFailedError: No tests found in test.test

报junit.framework.AssertionFailedError这个错一般是Test命名前面没有加test字样。 没有加test字样如果能运行也有可能test时会很慢。半天没有出现输出结果。   格式:test + (你要的命名)   ...

Jason的博客 1万+

Python量化交易实战:pytdx库高效获取通达信分笔成交数据

本文详细介绍了如何使用Python的pytdx库高效获取通达信分笔成交数据,为量化交易提供关键市场微观结构分析。通过环境搭建、服务器连接、数据获取与清洗的完整流程,帮助开发者快速掌握这一免费高质量数据源,并实现分笔数据的实战分析与应用。

weixin_29061509的博客 1345

海洋与地质地理信息数据下载网站汇总集锦

各种海洋与地质地理信息数据集合

qq_36980284的博客 1268

junit.framework.AssertionFailedError: No tests found in错误解决办法

代码如下: import java.util.List; import junit.framework.TestCase; import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContex...

jadewoo的专栏 2062

RS485接口EMC设计:三级防护与滤波隔离方案

RS485总线在工业现场面临共模噪声、差模脉冲和地电位差三大电磁兼容挑战。通过三级防护架构(气体放电管、PTC热敏电阻、半导体放电管)实现能量梯次泄放,结合共模扼流圈和滤波电容形成完整防护链。该方案经实测可将6kV浪涌下的通信稳定性提升90%,特别适用于工业自动化、电力监控等严苛环境。设计要点包括防护器件选型计算、PCB分区布局及地处理策略,其中GDT通流能力与TSS箝位电压的配合是关键。

weixin_33419305的博客 522

已解决 junit framework AssertionFailedError No tests found in

已解决 junit framework AssertionFailedError No tests found in

qq_43682769的博客 1452

【WRF数据介绍第二期】气象驱动场数据介绍及下载

【WRF数据介绍第二期】气象驱动场数据介绍及下载

WW、forever的博客 2160

漏洞挖掘之工具配置

本文主要讲解burp工具的插件安装。

qq_64775230的博客 3273

junit.framework.AssertionFailedError: No tests found in testaa报错如何解决

junit.framework.AssertionFailedError: No tests found in testaa at junit.framework.Assert.fail(Assert.java:57) at junit.framework.TestCase.fail(TestCase.java:227) at junit.framework.TestSuite$1.runTest(TestSuite.java:97) at junit.framework.Te

2301_77094778的博客 317

[实践篇]13.13 再来梳理一下HAB的设计原理

HAB全称为Hypervisor Abstraction,即硬件抽象,主要用于提供对HOST OS硬件资源的访问。

从0到1,突破自己 7258

junit.framework.AssertionFailedError: No tests found in CarTest报错解决

在idea运行一个spring的test报错junit.framework.AssertionFailedError: No tests found in CarTest,测试方法为Test1。莫名其妙报错(jiushi),在测试方法名前加上test,即变为testTest1,运行就成功了。

weixin_56342559的博客 525

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

[已解决]junit.framework.AssertionFailedError: No tests found in com.wbm.app.business.NeedLoginTestCase

junit.framework.AssertionFailedError: No tests found in com.wbm.app.business.NeedLoginTestCase at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191) at android.test.AndroidTestRunner

Kodulf的专栏 2254

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

android学习笔记转--------------junit.framework.AssertionFailedError: No tests found in错误解决办法

package cn.hxyh.cal.test; import junit.framework.TestCase; import cn.hxyh.cal.dao.CaculatorDAO; import cn.hxyh.cal.factory.CaculatorFactory; public class TestCaculator extends TestCase {  public

奔跑的蜗牛 1万+

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

android学习笔记转--------------junit.framework.AssertionFailedError: No tests found in错误解决办法...

package cn.hxyh.cal.test; import junit.framework.TestCase; import cn.hxyh.cal.dao.CaculatorDAO; import cn.hxyh.cal.factory.CaculatorFactory; publ...

chenqunan3231的博客 187

MyBatis测试报错:junit.framework.AssertionFailedError: No tests found in

显示: junit.framework.AssertionFailedError: No tests found in com.service.QuestionServiceTest 解决: 报junit.framework.AssertionFailedError这个错一般是Test命名前面没有加test字样。 没有加test字样如果能运行也有可能test时会很慢。半天没有出现输出结果。 格式:test + (你要的命名)–首字母不能大写 ...

ylovd的博客 1416
上一篇: vr
下一篇: iOS 第7课 UIImageView
千雅爸爸
博客等级 码龄18年 292粉丝 639原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值