zoukankan      html  css  js  c++  java
  • 在junit中添加fail--有test失败即build Failed

    项目使用jenkins做持续集成,ant来构建,发现在跑junit单元测试的时候,如果有test case失败了,ci的状态是黄色的unstable,而不是红色的failed,看起来很不爽。个人觉得build只有两种状态最好,绿色stable和红色failed,黄色让人看起来很困惑,是要fix好呢还是不fix也可以呢?

    在网上查到解决方案,就是在ant的build文件里面,加上这样一段:

    demo - build.xml
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
      <target name="unitTest" depends="runCompileTest">
        <junit printsummary="on" failureproperty="junit.failure">
          <!-- some code here-->
        </junit>
    
        <fail message="Some tests failed - Build failed" status="2">
            <condition>
                <isset property="junit.failure" />
            </condition>
        </fail>
        </target>
    
  • 相关阅读:
    Linux基础优化(二)
    权限
    分页
    序列化
    forms
    redis
    Django缓存机制
    跨域问题
    Django的ORM
    模板层
  • 原文地址:https://www.cnblogs.com/kingzzm/p/3325396.html
Copyright © 2011-2022 走看看