简体   繁体   English

如何调试我的测试类?

[英]How to debug my Test Classes?

I am working on integration test with JUnit. 我正在与JUnit进行集成测试。 I have a some services ( Spring Services @Service) to test. 我有一些服务(Spring Services @Service)要测试。 So i create a test class to test services. 因此,我创建了一个测试类来测试服务。

I have : MyTestClass => ServicesToTest 我有:MyTestClass => ServicesToTest

When i execute my test, i cannot set a breakpoint and see what's happening in service classe. 当我执行测试时,我无法设置断点,也无法查看服务等级中的情况。 I know that when using Spring Service, Spring create some proxy to provide access to service. 我知道使用Spring Service时,Spring创建一些代理来提供对服务的访问。 I don't know really if it is related to Spring. 我真的不知道它是否与Spring有关。 How i can debug my Test class. 我如何调试我的Test类。 For information my test classes is configured as below : 作为参考,我的测试类配置如下:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:test-context.xml")
@Transactional
public class MyTestClass(){
     //Injection of dao and services + test method.
}

What's wrong, please ? 请问怎么了?

In case you are using Eclipse ensure that Add line number attributes to generated class files is checked. 如果您使用的是Eclipse,请确保选中“ Add line number attributes to generated class files

You will find this under Window -> Preference -> Java -> Compiler as shown below. 您将在Window-> Preference-> Java-> Compiler下找到它,如下所示。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM