zoukankan      html  css  js  c++  java
  • 使用maven进行测试设置断点调试的方法

    在Maven中配置测试插件surefire来进行单元测试,默认情况下,surefire会执行文件名以Test开头或结尾的测试用例,或者是以TestCase结尾的测试用例。
                   <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <argLine>${surefireArgLine}</argLine>
                        <!--testng.xml -->
                        <suiteXmlFiles>
                            <suiteXmlFile>target/test-classes/testcase/testng.xml</suiteXmlFile>
                        </suiteXmlFiles>
                        <testFailureIgnore>true</testFailureIgnore>
    <!--                     <debugForkedProcess>true</debugForkedProcess>  -->
                        <properties>
                            <property>
                                <name>usedefaultlisteners</name>
                                <value>false</value>
                            </property>
                        </properties>
                        <!--  target -->
                        <workingDirectory>target/</workingDirectory>
                    </configuration>
                </plugin>  
    按上述配置执行,maven test 会忽略程序中的断点执行,如果要进行调试可通过下面两个方法设置:
    1、使用配置testFailureIgnore 配置
    在pom.xml文件中<configuration> 结点下,增加<debugForkedProcess>true</debugForkedProcess>
    2、配置maven test参数
    在Debug->Debug Config 设置框中,设置Goals值为:test -Dmaven.surefire.debug即可。


    注意:在配置支持断点调试的模式下运行后,控制台console会出现“Listening for transport dt_socket at address: 5005”,要单击一下才能继续运行。









  • 相关阅读:
    iOS NSString的常用用法
    有序数组在数据量较少时候的查找效率比较
    【转载】gdb基本命令总结
    从一个笔误引起的思考
    常见性能优化小技巧原理
    使用T-SQL进行活动目录查询
    你需要一条怎样的牛仔裤?
    #VSTS日志# 2015/12/10 – 终于可以删除工作项了
    #VSTS定制#全新的模版定制能力
    混合使用TFVC和GIT配置库的优化方案
  • 原文地址:https://www.cnblogs.com/doit8791/p/5766239.html
Copyright © 2011-2022 走看看