Java ant build.xml中的Junit测试打印完整堆栈跟踪,如何只打印结果?

Java ant build.xml中的Junit测试打印完整堆栈跟踪,如何只打印结果?,java,ant,junit,Java,Ant,Junit,如何仅打印测试的输出 INFO - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@7632efa7: display name [org.springframework.context.support.FileSystemXmlApplicationContext@7632efa7]; startup date [Mon Dec 09 18:05:51 IST 2013]; root

如何仅打印测试的输出

INFO - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@7632efa7: display name [org.springframework.context.support.FileSystemXmlApplicationContext@7632efa7]; startup date [Mon Dec 09 18:05:51 IST 2013]; root of context hierarchy
INFO - Loading XML bean definitions from file [/home/user/Desktop/RangdeDev/src/applicationContext.xml]
INFO - Loading XML bean definitions from file [/home/user/Desktop/RangdeDev/src/applicationContext-hibernate.xml]
INFO - Loading XML bean definitions from file [/home/user/Desktop/RangdeDev/src/applicationContext-quartz.xml]
INFO - Overriding bean definition for bean 'GMAIT_T': replacing [Root bean: class [org.springframework.beans.factory.config.FieldRetrievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.beans.factory.config.FieldRetrievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
INFO - Overriding bean definition for bean 'ALDEN_1': replacing [Root bean: class [org.springframework.beans.factory.config.FieldRetrievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.beans.factory.config.FieldRetrievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
INFO - Overriding bean definition for bean 'mailHelper': replacing [Root bean: class [org.rangde.service.MailHelper]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [/home/user/Desktop/RangdeDev/src/applicationContext.xml]] with [Root bean: class [org.rangde.service.MailHelper]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [/home/user/Desktop/RangdeDev/src/applicationContext-quartz.xml]]
INFO - Bean factory for application context [org.springframework.context.support.FileSystemXmlApplicationContext@7632efa7]: org.springframework.beans.factory.support.DefaultListableBeanFactory@7cbe41ec
INFO - Loading properties file from file [/home/user/Desktop/RangdeDev/WebContent/WEB-INF/jdbc.properties]
INFO - Loading properties file from file [/home/user/Desktop/RangdeDev/WebContent/WEB-INF/jdbc.properties]
INFO - Loading properties file from file [/home/user/Desktop/RangdeDev/WebContent/WEB-INF/jdbc.properties]
INFO - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7cbe41ec: defining ----
Testcase:testPrintMessage花费了0.004秒
失败
预期:但是:
junit.framework.AssertionFailedError:应为:但为:
tests.TestJunit.testPrintMessage(TestJunit.java:13)

我认为您必须将日志记录级别更改为警告/错误(我不知道您使用的是什么日志记录程序)

正如您所见,它打印了许多目前不需要的
INFO

INFO - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@7632efa7: display name [org.springframework.context.support.FileSystemXmlApplicationContext@7632efa7]; startup date [Mon Dec 09 18:05:51 IST 2013]; root of context hierarchy
INFO - Loading XML bean definitions from file [/home/user/Desktop/RangdeDev/src/applicationContext.xml]
INFO - Loading XML bean definitions from file [/home/user/Desktop/RangdeDev/src/applicationContext-hibernate.xml]
INFO - Loading XML bean definitions from file [/home/user/Desktop/RangdeDev/src/applicationContext-quartz.xml]
INFO - Overriding bean definition for bean 'GMAIT_T': replacing [Root bean: class [org.springframework.beans.factory.config.FieldRetrievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.beans.factory.config.FieldRetrievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
INFO - Overriding bean definition for bean 'ALDEN_1': replacing [Root bean: class [org.springframework.beans.factory.config.FieldRetrievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.beans.factory.config.FieldRetrievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
INFO - Overriding bean definition for bean 'mailHelper': replacing [Root bean: class [org.rangde.service.MailHelper]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [/home/user/Desktop/RangdeDev/src/applicationContext.xml]] with [Root bean: class [org.rangde.service.MailHelper]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [/home/user/Desktop/RangdeDev/src/applicationContext-quartz.xml]]
INFO - Bean factory for application context [org.springframework.context.support.FileSystemXmlApplicationContext@7632efa7]: org.springframework.beans.factory.support.DefaultListableBeanFactory@7cbe41ec
INFO - Loading properties file from file [/home/user/Desktop/RangdeDev/WebContent/WEB-INF/jdbc.properties]
INFO - Loading properties file from file [/home/user/Desktop/RangdeDev/WebContent/WEB-INF/jdbc.properties]
INFO - Loading properties file from file [/home/user/Desktop/RangdeDev/WebContent/WEB-INF/jdbc.properties]
INFO - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7cbe41ec: defining ----
Testcase: testPrintMessage took 0.004 sec
    FAILED
expected:<[11]> but was:<[97]>
junit.framework.AssertionFailedError: expected:<[11]> but was:<[97]>
    at tests.TestJunit.testPrintMessage(TestJunit.java:13)