命令行执行Junit测试
来源:互联网 发布:软件工程硕士排名 编辑:程序博客网 时间:2024/04/27 20:15
【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.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.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 classes or make the default listener classes (and their required dependencies) available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]五月 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 classes or 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 listener classes or make the default listener classes (and their required dependencies) available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]五月 31, 2016 2:39:06 下午 org.springframework.test.context.support.AbstractTestContextBootstrapper getTestExecutionListeners信息: Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@28864e92, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@6ea6d14e, org.springframework.test.context.support.DirtiesContextTestExecutionListener@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 contexthierarchyname = tr, age = 100 // highlight line.
0 0
- 命令行执行Junit测试
- Junit 测试执行顺序
- 用ANT执行JUNIT测试
- Junit指定测试执行顺序
- Junit测试方法执行顺序
- Junit测试用例按顺序执行
- junit测试方法执行顺序
- 用Ant执行Junit测试
- 在命令行调用Junit测试类
- Linux命令行下进行Junit测试
- Ant执行JUnit测试并生成报告
- ant脚步执行JUnit测试用例
- ant脚本执行junit测试用例
- 用Ant批量执行Junit 测试
- Ant执行JUnit测试并生成报告
- JUnit中按照顺序执行测试方式
- Unittest命令行执行测试、执行测试发现操作实例
- 通过RFT命令行执行测试脚本
- Struts2中文乱码解决办法
- hdu 2680 最短路
- 如何在bluemix的虚拟机上部署selenium hub
- iOS autoLayout
- Git学习
- 命令行执行Junit测试
- 对链表进行排序
- 欢迎使用CSDN-markdown编辑器
- NoSQL之Redis---Lists类型命令
- Java加密技术(二)——对称加密算法DES&AES
- 仿微信图片选择器
- Android Dev Intro - Stencil Test
- java中的jar包
- iOS学习之——多线程编程