Junit 命令行测试 报错:Could not find class 理解及解决方法
一、报错 : 『Could not find class』
下面给出三个示例比较,其中只有第一个是正确的。
1.
MyComputer:bin marikobayashi$ java -cp .:./junit-4.10.jar org.junit.runner.JUnitCore NextdayTest
JUnit version 4.10
...............
Time: 0.016
OK (15 tests)
2.
MyComputer:bin marikobayashi$ java -cp .:./junit-4.10.jar org.junit.runner.JUnitCore ./NextdayTest
JUnit version 4.10
Could not find class: ./NextdayTest
Time: 0.002
OK (0 tests)
3.
MyComputer:bin marikobayashi$ java -cp ./junit-4.10.jar org.junit.runner.JUnitCore ./NextdayTest
JUnit version 4.10
Could not find class: ./NextdayTest
Time: 0.001
OK (0 tests)
二、 分析
java -cp .:./junit-4.10.jar org.junit.runner.JUnitCore NextdayTest
- -cp 指类路径 : "." 指的是当前路径,一定要有; 『:』 是分隔符, 『./junit-4.10.jar』 指当前路径下的./junit-4.10.jar包,也可以在其他路径下
- org.junit.runner.JUnitCore : 测试框架入口
- NextdayTest :待测Junit 测试用例+脚本 类。 PS : 前面不要加 路径,否则可能找不到(会被一并认为测试脚本类名)
Junit 命令行测试 报错:Could not find class 理解及解决方法的更多相关文章
- rpm方式安装MySQL后在命令行登录报错:ERROR 1045 (28000): Unknown error 1045
1.通过https://mirrors.tuna.tsinghua.edu.cn镜像源安装了MySQL5.7.22 rpm -ivh --force --nodeps https://mirrors. ...
- 解压tar.gz文件报错gzip: stdin: not in gzip format解决方法
解压tar.gz文件报错gzip: stdin: not in gzip format解决方法 在解压tar.gz文件的时候报错 1 2 3 4 5 [Sun@localhost Downloads] ...
- 含有package关键字的java文件在命令行运行报错
程序中含有package关键字,使用命令行运行程序时出现"找不到或无法加载主类",而使用Eclipse软件可以正常运行程序的可能解决办法. 在包下的类,在Java源文件的地方编译后 ...
- docker mac 命令行登录报错处理 : Error saving credentials: error storing credentials - err: exit status 1
参考:https://blog.csdn.net/xufwind/article/details/88756557 比较新版本的docker命令行登录会出现以下错误: Error saving cre ...
- 安装 R 包报错 clang: error: unsupported option '-fopenmp' 的解决方法
MacOS 上安装 R 包 install.packages("data.table") 后面提示是否安装需要编译的版本: Do you want to install from ...
- 问题:eclipse中线程编程编译报错,undefined reference to 'pthread_create'的解决方法(已解决)
问题描述: 在Ubuntu系统中,使用eclipse CDT集成开发环境编写pthread程序,编译时,pthread_create不通过,报错信息是: undefined reference to ...
- 安装CentOS 6.x报错"Disk sda contains BIOS RAID metadata"解决方法
今天在安装CentOS 6.2的时候,当进到检测硬盘的时候,总是过不去,报错如下: Disk sda contains BIOS RAID metadata, but is not part of a ...
- scp报错:not a regular file,解决方法:加参数 -r
命令:scp -P1234 /data/aa root@192.0.0..0:/data 文件结构:/data/aa/yearmonth=2015-09 报错:not a regular fi ...
- MyEclipse 启动报错:'Building workspace' has encountered a problem解决方法
转载于:http://blog.csdn.net/v123411739/article/details/42645159 每次MyEclipse工作空间报错如下:'Building workspace ...
随机推荐
- openstack网络
OpenStack中neutron的2种ip.3种管理模式 Nova有固定IP和浮动IP的概念.固定IP被分发到创建的实例不再改变,浮动IP是一些可以和实例动态绑定和释放的IP地址. Nova支持3种 ...
- 学习excel的使用技巧二批量复制
1 选中要操作的部分 2 CTRL+G 打开定位 3 点击 定位条件 4 选择空值 5 输入=号 然后键盘的 方向键 向上 6 按住CTRL+回车 即可实现 批量复制
- Tesseract-OCR的简单使用与训练
Tesseract,一款由HP实验室开发由Google维护的开源OCR(Optical Character Recognition , 光学字符识别)引擎,与Microsoft Office Docu ...
- python——字符串问题总结
转义符r/R使用: print (r'\n') print (R'\n') 输出: \n \n 不受转义符\n影响 python字符串格式化: print ("我叫 %s 今年 %d 岁!& ...
- python——数字问题之_ 变量
在交互模式中,最后被输出的表达式结果被赋值给变量 _ ._ 变量应被用户视为只读变量 >>> a=12/2.3 >>> b=1.2 >>> a*b ...
- leetcode124
class Solution { int maxValue; public int maxPathSum(TreeNode root) { maxValue = Integer.MIN_VALUE; ...
- python Django 无法获取post 参数问题
对于 request.POST.get(name) 方式取值,需要 from 表单提交数据,如果 是ajax 提交数据,则需要做如下设置: 1.设置请求头,以from表单方式传值 'Content-T ...
- mvc中view与controll之间传递参数时,可以使用url进行传递
mvc中view与controller之间传递参数时,可以使用url进行传递,但是在url的地址中需要加上“id=123”这样的东西才行. 具体如代码: window.location.href = ...
- alert()、confirm()、prompt()的区别
使用消息框 使用警告.提示和确认 可以使用警告.确认和提示消息框来获得用户的输入.这些消息框是 window 对象的接口方法.由于 window 对象位于对象层次的顶层,因此实际应用中不必使用这些消息 ...
- 初学c# -- 学习笔记(9) 关于SQL2008
在做一个局域网的类似网盘的学习练习,服务端差不多了,在改bug.用vlc的dll做的全格式视频.音频预览在线播放下载等等. 在做服务端也遇到了一些问题,走了好多弯路. 开始把上传的视频.音频.图像.文 ...