From: Carlos S. <car...@us...> - 2005-07-12 22:10:00
|
carlossg 05/07/12 15:09:47 Modified: cobertura plugin.jelly cobertura/xdocs changes.xml goals.xml Log: Added check reports Revision Changes Path 1.7 +39 -4 maven-plugins/cobertura/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/cobertura/plugin.jelly,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- plugin.jelly 12 Jul 2005 21:22:16 -0000 1.6 +++ plugin.jelly 12 Jul 2005 22:09:47 -0000 1.7 @@ -54,6 +54,12 @@ link="cobertura/index" target="_blank" description="Cobertura test coverage report." /> + + <doc:registerReport + name="Cobertura check" + pluginName="maven-cobertura-plugin" + link="cobertura/cobertura-check" + description="Cobertura test coverage check report." /> </j:if> </goal> @@ -63,6 +69,7 @@ <j:if test="${sourcesPresent == 'true'}"> <doc:deregisterReport name="Cobertura" /> + <doc:deregisterReport name="Cobertura check" /> </j:if> </goal> @@ -154,9 +161,23 @@ Fail the build if the test coverage is lower than a threshold ======================================================================== --> - <goal name="cobertura:check" + <goal name="cobertura:check" prereqs="cobertura:check-report-text" description="Fail the build if the coverage is lower than the specified threshold"> + <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> @@ -188,10 +209,21 @@ </j:if> </j:forEach> - <j:if test="${checkFailed}"> - <fail message="Some files don't met required test coverage levels ${checkFailedLines}"/> - </j:if> + </goal> + + <!-- + ======================================================================== + Make a xdoc report from the text report + ======================================================================== + --> + <goal name="cobertura:check-report" prereqs="cobertura:check-report-text" + description="Create a xdoc report with classes not meeting the test coverage requirements"> + <doc:text-xdoc + title="Cobertura Check Report" + section="Cobertura Report" + inputText="${checkFailedLines}" + output="${maven.gen.docs}/cobertura-check.xml"/> </goal> @@ -245,6 +277,9 @@ <ant:fail message="${ex}" /> </j:if> + <!-- report the check failures --> + <attainGoal name="cobertura:check-report"/> + </j:when> <j:otherwise> 1.7 +3 -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.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- changes.xml 12 Jul 2005 21:22:16 -0000 1.6 +++ changes.xml 12 Jul 2005 22:09:47 -0000 1.7 @@ -25,6 +25,9 @@ <body> <release version="1.1-SNAPSHOT" date="in SVN"> <action dev="carlossg" type="add"> + Added cobertura check reports with classes that don't meet test coverage requirements. + </action> + <action dev="carlossg" type="add"> Added cobertura:check goal. </action> </release> 1.5 +12 -1 maven-plugins/cobertura/xdocs/goals.xml Index: goals.xml =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/cobertura/xdocs/goals.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- goals.xml 12 Jul 2005 21:22:16 -0000 1.4 +++ goals.xml 12 Jul 2005 22:09:47 -0000 1.5 @@ -30,7 +30,10 @@ </goal> <goal> <name>cobertura:report</name> - <description>Generate HTML and XML test coverage reports with Cobertura</description> + <description> + Generate HTML and XML test coverage reports with Cobertura and a + list of tests that don't meet the minimum test coverage requirements + </description> </goal> <goal> <name>cobertura:on</name> @@ -56,6 +59,14 @@ <name>cobertura:check</name> <description>Fail the build if any class doesn't meet the minimum code coverage requirements.</description> </goal> + <goal> + <name>cobertura:check-report-text</name> + <description>Create a text report with classes not meeting the test coverage requirements.</description> + </goal> + <goal> + <name>cobertura:check-report</name> + <description>Create a xdoc report with classes not meeting the test coverage requirements.</description> + </goal> </goals> </body> </document> \ No newline at end of file |