From: Carlos S. <car...@us...> - 2005-10-06 21:26:31
|
carlossg 05/10/06 14:26:24 Modified: cobertura/xdocs changes.xml properties.xml cobertura project.xml plugin.properties plugin.jelly Log: Added maven.cobertura.check.totallinerate and maven.cobertura.check.totalbranchrate properties. Fixed cobertura check goal always checking against 50%. Revision Changes Path 1.13 +4 -0 maven-plugins/cobertura/xdocs/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/cobertura/xdocs/changes.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- changes.xml 22 Sep 2005 02:38:40 -0000 1.12 +++ changes.xml 6 Oct 2005 21:26:24 -0000 1.13 @@ -22,6 +22,10 @@ <title>Changes</title> </properties> <body> + <release version="1.2" date="in CVS"> + <action dev="carlossg" type="add">Added maven.cobertura.check.totallinerate and maven.cobertura.check.totalbranchrate properties.</action> + <action dev="carlossg" type="fix">Fixed cobertura check goal always checking against 50%.</action> + </release> <release version="1.1.1" date="2005-09-21"> <action dev="carlossg" type="fix">Fixed problems that caused 0 percent coverage always.</action> <action dev="carlossg" type="update">Upgrade to cobertura 1.6.</action> 1.7 +27 -8 maven-plugins/cobertura/xdocs/properties.xml Index: properties.xml =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/cobertura/xdocs/properties.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- properties.xml 19 Jul 2005 04:14:52 -0000 1.6 +++ properties.xml 6 Oct 2005 21:26:24 -0000 1.7 @@ -80,40 +80,59 @@ Seems cobertura doesn't work correctly if changed (to be verified) </td> </tr> + </table> + + <section name="Coverage check related properties"> + <table> + <tr> + <th>Property</th> + <th>Default</th> + <th>Optional?</th> + <th>Description</th> + </tr> <tr> <td>maven.cobertura.check.report</td> <td>false</td> <td>Yes</td> <td> Whether or not the cobertura check report is generated. Disabled by default because - seems that it doesn't work on maven 1.0.x (works in 1.1-beta-1) + seems that it doesn't work on maven 1.0.x (works in 1.1 beta 1 and beta 2) + </td> + </tr> + <tr> + <td>maven.cobertura.check.linerate</td> + <td>50</td> + <td>Yes</td> + <td> + Specify the minimum acceptable line coverage rate needed by each class. This should be an integer value between 0 and 100. </td> </tr> <tr> - <td>maven.cobertura.check.line</td> + <td>maven.cobertura.check.branchrate</td> <td>50</td> <td>Yes</td> <td> - Line test coverage % under which the build will fail when cobertura:check is called. + Specify the minimum acceptable branch coverage rate needed by each class. This should be an integer value between 0 and 100. </td> </tr> <tr> - <td>maven.cobertura.check.branch</td> + <td>maven.cobertura.check.totallinerate</td> <td>50</td> <td>Yes</td> <td> - Branch test coverage % under which the build will fail when cobertura:check is called. + Specify the minimum acceptable average line coverage rate needed by the project as a whole. This should be an integer value between 0 and 100. </td> </tr> <tr> - <td>maven.cobertura.check.file</td> - <td>${maven.cobertura.dir}/check.txt</td> + <td>maven.cobertura.check.totalbranchrate</td> + <td>50</td> <td>Yes</td> <td> - File where to store results when cobertura:check is called. + Specify the minimum acceptable average branch coverage rate needed by the project as a whole. This should be an integer value between 0 and 100. </td> </tr> </table> + </section> </section> </body> </document> 1.21 +1 -1 maven-plugins/cobertura/project.xml Index: project.xml =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/cobertura/project.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- project.xml 22 Sep 2005 02:38:40 -0000 1.20 +++ project.xml 6 Oct 2005 21:26:24 -0000 1.21 @@ -22,7 +22,7 @@ <pomVersion>3</pomVersion> <artifactId>maven-cobertura-plugin</artifactId> <name>Maven Cobertura Plug-in</name> - <currentVersion>1.1.1</currentVersion> + <currentVersion>1.2-SNAPSHOT</currentVersion> <inceptionYear>2005</inceptionYear> <description>Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage.</description> <url>http://maven-plugins.sourceforge.net/maven-cobertura-plugin</url> 1.7 +6 -3 maven-plugins/cobertura/plugin.properties Index: plugin.properties =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/cobertura/plugin.properties,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- plugin.properties 19 Jul 2005 04:14:52 -0000 1.6 +++ plugin.properties 6 Oct 2005 21:26:24 -0000 1.7 @@ -23,9 +23,12 @@ # don't change this seems it doesn't work maven.cobertura.datafile=${basedir}/cobertura.ser -maven.cobertura.check.line=50 -maven.cobertura.check.branch=50 -maven.cobertura.check.file=${maven.cobertura.dir}/check.txt +maven.cobertura.check.linerate=50 +maven.cobertura.check.branchrate=50 +maven.cobertura.check.totallinerate=50 +maven.cobertura.check.totalbranchrate=50 +maven.cobertura.check.failureproperty=coberturaCheckFailureProperty +maven.cobertura.check.haltonfailure=true # don't generate the report by default, seems that it breaks in maven < 1.1 maven.cobertura.check.report=false 1.15 +14 -43 maven-plugins/cobertura/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/cobertura/plugin.jelly,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- plugin.jelly 22 Sep 2005 02:35:22 -0000 1.14 +++ plugin.jelly 6 Oct 2005 21:26:24 -0000 1.15 @@ -160,54 +160,25 @@ Fail the build if the test coverage is lower than a threshold ======================================================================== --> - <goal name="cobertura:check" prereqs="cobertura:check-report-text" - description="Fail the build if the coverage is lower than the specified threshold"> + <goal name="cobertura:check" + description="Fail the build if the coverage does not meet the test requirements"> - <j:if test="${checkFailed}"> - <fail message="Some files don't met required test coverage levels ${checkFailedLines}"/> - </j:if> - - </goal> - - - <!-- - ======================================================================== - Check if the test coverage is lower than a threshold and save the tests not fullfilling the requirements - ======================================================================== - --> - <goal name="cobertura:check-report-text" - description="Create a text report with classes not meeting the test coverage requirements"> <mkdir dir="${maven.cobertura.dir}"/> - <record name="${maven.cobertura.check.file}" action="start"/> - <ant:cobertura-check> - <ant:classpath> - <ant:path refid="cobertura.classpath"/> - </ant:classpath> + <ant:cobertura-check + branchrate="${maven.cobertura.check.branchrate}" + linerate="${maven.cobertura.check.linerate}" + totalbranchrate="${maven.cobertura.check.totalbranchrate}" + totallinerate="${maven.cobertura.check.totallinerate}" + haltonfailure="${maven.cobertura.check.haltonfailure}" + failureproperty="${maven.cobertura.check.failureproperty}" + datafile="${maven.cobertura.datafile}"> - <j:if test="${!empty(context.getVariable('maven.cobertura.check.branch'))}"> - <ant:setProperty name="branch" value="${maven.cobertura.check.branch}"/> - </j:if> - <j:if test="${!empty(context.getVariable('maven.cobertura.check.line'))}"> - <ant:setProperty name="line" value="${maven.cobertura.check.line}"/> - </j:if> - - </ant:cobertura-check> - <record name="${maven.cobertura.check.file}" action="stop"/> - - <u:loadText var="checkFileString" file="${maven.cobertura.check.file}"/> - - <u:tokenize var="checkFileLines" delim=" ">${checkFileString}</u:tokenize> + <ant:classpath> + <ant:path refid="cobertura.classpath"/> + </ant:classpath> - <j:set var="checkFailed" value="false"/> - <j:set var="checkFailedLines" value=""/> - <j:forEach var="checkFileLine" items="${checkFileLines}"> - <j:if test="${checkFileLine.indexOf('required')>0}"> - <j:set var="checkFailed" value="true"/> - <!-- add the line but stripping '[cobertura-check] ' text --> - <j:set var="checkFailedLines" value="${checkFailedLines} ${checkFileLine.substring(18)}"/> - </j:if> - </j:forEach> + </ant:cobertura-check> </goal> |