java - cobertura instrument caused some of my Junit tests failure -


i have cobertrua 2.0.3 , java 1.6.45 on linux os 2.6.32.45-0.3-xen #1 smp 2011-08-22 10:12:58 +0200 x86_64 x86_64 x86_64 gnu/linux

if not instrument classes exclude , junit tests works fine. long instrument include classes , junit tests fail.

it seemed me instrument not complete or wrongly of classes not of them.

====== run target instrument ====

    <!--                         remove coverage data file , old instrumentation.                 -->     <delete file="${basedir}/cobertura.ser" />     <delete dir="${instrumented.dir}" />      <!--                         instrument application classes, writing                         instrumented classes ${build.instrumented.dir}.                 -->     <cobertura-instrument todir="${instrumented.dir}">         <!--                                 following line causes instrument ignore                                 source line containing reference log4j,                                 purposes of coverage reporting.                         -->         <ignore regex="org.apache.log4j.*" />          <fileset dir="${classes.dir}">             <!--                                         instrument application classes,                                         don't instrument test classes.                                 -->             <include name="**/*.class" />             <exclude name="**/*test*.class" />             <exclude name="**/*helloworld*.class" />             <exclude name="**/*mock*.class" />         </fileset>     </cobertura-instrument> </target> 

my helloworld.java

    import java.io.ioexception; //import java.util.logging.filehandler; //import java.util.logging.handler; //import java.util.logging.level; import java.util.logging.logger;   public class helloworld {      private static final logger logger = logger.getlogger(helloworld.class.getname());      private string hello_world = "hello world";     private string hello_sweden = "hello sweden";     private string message = "default message";      public void printhello() throws securityexception, ioexception {         logger.entering(this.getclass().getname(), "entering printhello()"); //      handler fh = new filehandler("%h/java%u.log"); //      fh.setlevel (level.fine); //      logger.addhandler(fh);         setmessage(hello_world);         //system.out.println("from printhello():" + getmessage());         logger.info("message is: " + hello_world);         logger.info("print message:" + getmessage());          logger.finest("this finest");         logger.finer("this finer");         logger.fine("this fine");         logger.config("this config");         logger.info("this info");         logger.warning("this warning");         logger.severe("this severe");          trace.fine(this, "trace fine print out");         logger.exiting(this.getclass().getname(), "exiting printhello()");     }      public void printsweden() {          setmessage(hello_sweden);         system.out.println("from printsweden():" +getmessage());     }      public string getmessage() {         return this.message;     }      public void setmessage(string message) {         this.message = message;     } } 


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -