ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: svn commit: r411613 - in /ant/antlibs/antunit/trunk: docs/expectfailure.html docs/index.html src/main/org/apache/ant/antunit/AntUnit.java src/main/org/apache/ant/antunit/AssertTask.java src/main/org/apache/ant/antunit/ExpectFailureTask.java
Date Mon, 05 Jun 2006 13:35:00 GMT
stevel@apache.org wrote:
> Author: stevel
> Date: Sun Jun  4 15:34:30 2006
> New Revision: 411613
> 
> URL: http://svn.apache.org/viewvc?rev=411613&view=rev
> Log:
> 1. typos in assertTask
> 2. ExpectFailure now does a substring check for the expectedMessage, not a simple exact
match
> 3. AntUnit actually fails the build if the tests failed.
> 

> 
> Modified: ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
> URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java?rev=411613&r1=411612&r2=411613&view=diff
> ==============================================================================
> --- ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java (original)
> +++ ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java Sun Jun  4
15:34:30 2006
> @@ -55,6 +55,10 @@
>  
>      private ArrayList listeners = new ArrayList();
>  
> +    private int failures=0;
> +    private int errors=0;
> +    private boolean failOnError=true;
> +    
>      public void add(FileSet fs) {
>          filesets.add(fs);
>      }
> @@ -63,6 +67,10 @@
>          listeners.add(al);
>      }
>  
> +    public void setFailOnError(boolean failOnError) {
> +        this.failOnError = failOnError;
> +    }
> +
>      public void execute() {
>          if (filesets.size() == 0) {
>              throw new BuildException("You must specify at least one nested"
> @@ -72,6 +80,12 @@
>          while (iter.hasNext()) {
>              doFileSet((FileSet) iter.next());
>          }
> +        if (failOnError && (failures > 0 || errors > 0)) {
> +            throw new BuildException("Tests failed with "
> +                    + failures + " failure" + (failures != 1 ? "s" : "")
> +                    + " and "
> +                    + errors + " error" + (errors != 1 ? "s" : ""));
> +        }
>      }



There is one big change here; a failing antunit test does now actually 
halt the build. the other one matters less, as it makes the 
expectedMessage string in <expectFailure> a substring search on the 
failure message, not a complete match. this is useful if part of the 
message varies depending upon the target platform

what is the release status of Antunit? Is is formally released? There is 
no obvious JAR on the web page...

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message