• mvn常用指令记录


    1. mvn test

        可以指定运行某特定类中的测试用例

        mvn test -Dtest=test_classname

        例子:

    $ mvn test -Dtest=StringUtilTest
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Study 0.0.2
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ Study ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory C:\Documents and Settings\test\Documents\workspace-sts-2.9.2.RELEASE\Study\src\main\resources
    [INFO]
    [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ Study ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ Study ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory C:\Documents and Settings\test\Documents\workspace-sts-2.9.2.RELEASE\Study\src\test\resources
    [INFO]
    [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ Study ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ Study ---
    [INFO] Surefire report directory: C:\Documents and Settings\test\Documents\workspace-sts-2.9.2.RELEASE\Study\target\surefire-reports
    
    -------------------------------------------------------
     T E S T S
    -------------------------------------------------------
    Running com.boco.zhjk.Study.StringUtilTest
    ==============================
    
    print header:
    ==================================================
    %%%%%%%%%%%%%%% Customised Header %%%%%%%%%%%%%%%%
    ==================================================
    00000034
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.062 sec
    
    Results :
    
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

     

        也可以使用模糊匹配进行测试

      mvn test -Dtest=*Test  

    2. mvn package

     可以传入参数指定跳过Test阶段

       mvn package -DskipTests

    3. mvn cobertura:cobertura  

        查看单元测试覆盖率报告

        运行这条指令后,target文件夹下出现了一个site目录,下面是一个静态站点,里面就是单元测试的覆盖率报告

       

  • 相关阅读:
    第七章之main函数和启动例程
    第一章之系统调用、库函数、内核函数区别
    unp第七章补充之socket tcp 产生 rst响应的情况
    unp第七章补充之TCP半开连接与半闭连接
    Qt 布局管理器
    Qt setMargin()和setSpacing() 的含义
    工作感悟
    关于数组数据常用的技巧
    正则表达式练习
    call/apply应用-对象使用原型链上的方法
  • 原文地址:https://www.cnblogs.com/vigarbuaa/p/2614392.html
Copyright © 2020-2023  润新知