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”,要单击一下才能继续运行。









  • 相关阅读:
    BZOJ 3684 大朋友和多叉树
    Loj #2495. 「AHOI / HNOI2018」转盘
    Loj #2494. 「AHOI / HNOI2018」寻宝游戏
    Loj 2320.「清华集训 2017」生成树计数
    SQL Server 权限管理
    微信和支付宝支付模式详解及实现(.Net标准库)- OSS开源系列
    跨站请求伪造(CSRF)
    require.js入门
    C#中禁止跨线程直接访问控件
    Video.js web视频播放器
  • 原文地址:https://www.cnblogs.com/doit8791/p/5766239.html
Copyright © 2011-2022 走看看