【0】README

0.1)本文旨在给出如何在命令行中执行 Junit测试的steps:

【1】在命令行中执行Junit测试

1)problem+solution:

1.1)problem:


1.2)solution:导出 JUnitCore 类并且使用 runClasses() 方法,将测试类名称作为参数。

package com.spring.chapter3_scope;import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;public class TestRunner {public static void main(String[] args) {Result result = JUnitCore.runClasses(StudentTest.class);for (Failure failure : result.getFailures()) {System.out.println(failure);}}
}

2)开始测试

Attention)在命令行中需要导入 相应的Junit jar ,参见:  https://github.com/pacosonTang/SpringInAction/tree/master/chapter3/chapter3_scope

E:\bench-cluster\cloud-data-preprocess\SpringInAction4\src>java -cp .;../lib/*; com.spring.chapter3_scope.TestRunner
五月 31, 2016 2:39:06 下午 org.springframework.test.context.support.AbstractTestContextBootstrapper getDefaultTestExecutionListenerClassNames
信息: Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExe
cutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.Depe
ndencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.t
ransaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context
.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.c
ontext.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframe
work.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
五月 31, 2016 2:39:06 下午 org.springframework.test.context.support.AbstractTestContextBootstrapper instantiateListeners
信息: Could not instantiate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]. Specify custom listener cla
sses or make the default listener classes (and their required dependencies) available. Offending class: [org/springframework/transaction/interceptor/T
ransactionAttribute]
五月 31, 2016 2:39:06 下午 org.springframework.test.context.support.AbstractTestContextBootstrapper instantiateListeners
信息: Could not instantiate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener]. Specify custom listener classesor make the default listener classes (and their required dependencies) available. Offending class: [javax/servlet/ServletContext]
五月 31, 2016 2:39:06 下午 org.springframework.test.context.support.AbstractTestContextBootstrapper instantiateListeners
信息: Could not instantiate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener]. Specify custom li
stener classes or make the default listener classes (and their required dependencies) available. Offending class: [org/springframework/transaction/int
erceptor/TransactionAttributeSource]
五月 31, 2016 2:39:06 下午 org.springframework.test.context.support.AbstractTestContextBootstrapper getTestExecutionListeners
信息: Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@28864e92, org.springframe
work.test.context.support.DependencyInjectionTestExecutionListener@6ea6d14e, org.springframework.test.context.support.DirtiesContextTestExecutionListe
ner@6ad5c04e]
五月 31, 2016 2:39:06 下午 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.GenericApplicationContext@2812cbfa: startup date [Tue May 31 14:39:06 CST 2016]; root of context
hierarchy
name = tr, age = 100 // highlight line.

命令行执行Junit测试相关推荐

  1. 【JUnit】Junit命令行执行、参数化执行、Main方法执行

    参考资料: main方法执行:http://stackoverflow.com/questions/2543912/how-do-i-run-junit-tests-from-inside-my-ja ...

  2. 系统学习Python——单元测试unittest:命令行执行测试

    分类目录:<系统学习Python>总目录 相关文章: · 单元测试unittest:框架结构 · 单元测试unittest:测试固件 · 单元测试unittest:编写测试用例 · 单元测 ...

  3. 命令行执行php脚本中的$argv和$argc配置方法

    这篇文章主要介绍了命令行执行php脚本 中$argv和$argc的方法,本文给大家介绍的非常详细,需要的朋友可以参考下 在实际工作中有可能会碰到需要在nginx命令行执行php脚本的时候,当然你可以去 ...

  4. jmeter命令行运行-分布式测试

    秒秒开心 jmeter命令行运行-分布式测试 上一篇文章我们说到了jmeter命令行运行但是是单节点下的, jmeter底层用java开发,耗内存.cpu,如果项目要求大并发去压测服务端的话,jmet ...

  5. php wscript.shell组件,wscript.shell × 命令行执行组件

    动画内任何广告皆为作者个人行为,网络交易,风险自负 大家好.我是辉少.那次的IIS重定向挂马大家都了解了吗? 这次给大家带来的是:修改 wscript.shell 名称 达到"独享" ...

  6. Windows用命令行执行mysql的sql文件

    Windows用命令行执行mysql的sql文件 1.连接本地的MySQL 2.远程MySQL a.本地导入 b.远程导入 `遇到的几个问题` 1.连接本地的MySQL 格式: mysql -h主机地 ...

  7. python程序在命令行执行提示ModuleNotFoundError: No module named ‘XXX‘ 解决方法

    python程序在命令行执行提示ModuleNotFoundError: No module named 'XXX' 解决方法 参考文章: (1)python程序在命令行执行提示ModuleNotFo ...

  8. 【Groovy】Groovy 脚本调用 ( 命令行执行 Groovy 脚本并传入参数 | 获取 Groovy 脚本执行参数 )

    文章目录 前言 一. 命令行执行 Groovy 脚本并传入参数 二.获取 Groovy 脚本执行参数 前言 在 Groovy 脚本 , Groovy 类 , Java 类中 , 可以调用 Groovy ...

  9. 【Android 安全】DEX 加密 ( Java 工具开发 | 生成 dex 文件 | Java 命令行执行 )

    文章目录 一.生成 dex 文件 二.生成 dex 文件代码示例 三.生成 dex 结果 参考博客 : [Android 安全]DEX 加密 ( 常用 Android 反编译工具 | apktool ...

最新文章

  1. Mathemmatica 新函数
  2. 在命令行下进行Oracle用户解锁
  3. linux装完windows时间长,重装Windows 10上的Linux子系统
  4. EasyUI Form提交后json数据IE上需要下载(转)
  5. Ghost in IE6.web标准网页IE6中的幽灵。
  6. 基于FPGA实现PCIE IP功能仿真
  7. mysql linux32_linux 32 位mysql 安装中的问题 以及修改数据库密码
  8. ylb:SQL 系统函数
  9. 《JSP实用教程(第2版)/耿祥义》错误之非必要导入包
  10. 爱奇艺技术分享:轻松诙谐,讲解视频编解码技术的过去、现在和将来
  11. iOS包体积优化实践
  12. 大数据综合实验(一)
  13. 设置主菜单背景显示为壁纸
  14. 马斯克宣布重磅消息!一切来得那么快!
  15. Android Google Maps教程
  16. pink老师携程网制作(html+css)
  17. 天正建筑t20 v5.0破解版|t20天正建筑中文破解版下载v5.0(附破解补丁+注册表)
  18. EditPlus的安装与破解
  19. Qt实现中国象棋:(四)棋子绘制的实现
  20. 鲸探发布点评:9月19日发售《中国大飞机C919》数字藏品

热门文章

  1. Codeforces Round #630 (Div. 2) E. Height All the Same 排列组合
  2. P3825 [NOI2017]游戏
  3. Lottery Gym - 102822L
  4. Musical Theme pku1743 (后缀数组)
  5. 2020牛客国庆集训派对day3 Points
  6. Message Decoding密码翻译
  7. P5012-水の数列【并查集,RMQ】
  8. jzoj4382-[GDOI2016模拟3.11]历史【并查集】
  9. Ch4201-楼兰图腾【树状数组】
  10. 【数学】奶牛编号(jzoj 2932)