You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2004/09/02 19:08:12 UTC

[jira] Created: (MPJCOVERAGE-14) Invalid Overview and packages rates

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MPJCOVERAGE-14

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MPJCOVERAGE-14
    Summary: Invalid Overview and packages rates
       Type: Bug

     Status: Open
   Priority: Major

 Original Estimate: 30 minutes
 Time Spent: Unknown
  Remaining: 30 minutes

    Project: maven-jcoverage-plugin
   Versions:
             1.0.7

   Assignee: Emmanuel Venisse
   Reporter: Thomas Recloux

    Created: Thu, 2 Sep 2004 1:07 PM
    Updated: Thu, 2 Sep 2004 1:07 PM
Environment: Maven 1.0 jcoverage 1.0.5

Description:
First, please excuse me for my poor English.

Maven jcoverage plugins generate an html report using xml data generated by jcoverage.

The overwiew and packages rates are not the sames as with jcoverage alone. This difference is due to the maven plugin algorythm wich ignores the "weight" (number of lines) of the classes.

If a package contains two classes one which contains 200 lines is tested at 80% and an other wich contains 10 lines tested at 0%, the plugin will compute a package rate of 40%, jcoverage alone will compute a rate of 76%.

I have modified the plugin in order to compute the good rates.

Here are the changes :

Coverage.java :

    public String getCoveredPercentBranch()
    {
    	double totalLines = 0.00d;
    	double total = 0.00d;

        if (getLineCoverage() > 0.00d)
        {
            for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
            {
                Clazz theClass = (Clazz) iter.next();
                int classLines = theClass.getLines().size();
                double rate = 0;
                try
                {
                    rate = new Double(theClass.getBranchRate()).floatValue();
                }
                catch(NumberFormatException e)
                {
                    rate = 0;
                }
                total += (rate*classLines);
                totalLines += classLines;
            }

            total /= totalLines;
        }

        return String.valueOf(total);
    }
    
    private double getLineCoverage()
    {
        double totalLines = 0.00d;
        double totalTestedLines = 0.00d;        
        for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
        {
            Clazz theClass = (Clazz) iter.next();
            int classLines = theClass.getLines().size();
            double rate = 0;
            try
			{
                rate = new Double(theClass.getLineRate()).floatValue();
            }
            catch(NumberFormatException e)
            {
                rate = 0;
            }
            totalTestedLines += (rate * classLines);
            totalLines += classLines;
        }

        return (totalTestedLines / totalLines);

    }

Package.java :

   public String getCoveredPercentBranch()
    {
    	double pckgLines = 0.00d;
    	double total = 0.00d;

        if (getLineCoverage() > 0.00d)
        {
            for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
            {
                Clazz theClass = (Clazz) iter.next();
                int classLines = theClass.getLines().size();
                double rate = 0;
                try
                {
                    rate = new Double(theClass.getBranchRate()).floatValue();
                }
                catch(NumberFormatException e)
                {
                    rate = 0;
                }
                total += (rate*classLines);
                pckgLines += classLines;
            }

            total /= pckgLines;
        }

        return String.valueOf(total);
    }

    private double getLineCoverage()
    {
        double pckgLines = 0.00d;
        double pckgTestedLines = 0.00d;        
        for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
        {
            Clazz theClass = (Clazz) iter.next();
            int classLines = theClass.getLines().size();
            double rate = 0;
            try
			{
                rate = new Double(theClass.getLineRate()).floatValue();
            }
            catch(NumberFormatException e)
            {
                rate = 0;
            }
            pckgTestedLines += (rate * classLines);
            pckgLines += classLines;
        }

        return (pckgTestedLines / pckgLines);
    }

May be branches rates could be "weighted" by the number of branches and not by the number of lines.

Thanks, Thomas


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (MPJCOVERAGE-14) Invalid Overview and packages rates

Posted by ji...@codehaus.org.
The following issue has been updated:

    Updater: Thomas Recloux (mailto:trecloux@norsys.fr)
       Date: Thu, 2 Sep 2004 1:09 PM
    Changes:
             Attachment changed to Coverage.java
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://jira.codehaus.org/browse/MPJCOVERAGE-14?page=history

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MPJCOVERAGE-14

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MPJCOVERAGE-14
    Summary: Invalid Overview and packages rates
       Type: Bug

     Status: Open
   Priority: Major

 Original Estimate: 30 minutes
 Time Spent: Unknown
  Remaining: 30 minutes

    Project: maven-jcoverage-plugin
   Versions:
             1.0.7

   Assignee: Emmanuel Venisse
   Reporter: Thomas Recloux

    Created: Thu, 2 Sep 2004 1:07 PM
    Updated: Thu, 2 Sep 2004 1:09 PM
Environment: Maven 1.0 jcoverage 1.0.5

Description:
First, please excuse me for my poor English.

Maven jcoverage plugins generate an html report using xml data generated by jcoverage.

The overwiew and packages rates are not the sames as with jcoverage alone. This difference is due to the maven plugin algorythm wich ignores the "weight" (number of lines) of the classes.

If a package contains two classes one which contains 200 lines is tested at 80% and an other wich contains 10 lines tested at 0%, the plugin will compute a package rate of 40%, jcoverage alone will compute a rate of 76%.

I have modified the plugin in order to compute the good rates.

Here are the changes :

Coverage.java :

    public String getCoveredPercentBranch()
    {
    	double totalLines = 0.00d;
    	double total = 0.00d;

        if (getLineCoverage() > 0.00d)
        {
            for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
            {
                Clazz theClass = (Clazz) iter.next();
                int classLines = theClass.getLines().size();
                double rate = 0;
                try
                {
                    rate = new Double(theClass.getBranchRate()).floatValue();
                }
                catch(NumberFormatException e)
                {
                    rate = 0;
                }
                total += (rate*classLines);
                totalLines += classLines;
            }

            total /= totalLines;
        }

        return String.valueOf(total);
    }
    
    private double getLineCoverage()
    {
        double totalLines = 0.00d;
        double totalTestedLines = 0.00d;        
        for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
        {
            Clazz theClass = (Clazz) iter.next();
            int classLines = theClass.getLines().size();
            double rate = 0;
            try
			{
                rate = new Double(theClass.getLineRate()).floatValue();
            }
            catch(NumberFormatException e)
            {
                rate = 0;
            }
            totalTestedLines += (rate * classLines);
            totalLines += classLines;
        }

        return (totalTestedLines / totalLines);

    }

Package.java :

   public String getCoveredPercentBranch()
    {
    	double pckgLines = 0.00d;
    	double total = 0.00d;

        if (getLineCoverage() > 0.00d)
        {
            for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
            {
                Clazz theClass = (Clazz) iter.next();
                int classLines = theClass.getLines().size();
                double rate = 0;
                try
                {
                    rate = new Double(theClass.getBranchRate()).floatValue();
                }
                catch(NumberFormatException e)
                {
                    rate = 0;
                }
                total += (rate*classLines);
                pckgLines += classLines;
            }

            total /= pckgLines;
        }

        return String.valueOf(total);
    }

    private double getLineCoverage()
    {
        double pckgLines = 0.00d;
        double pckgTestedLines = 0.00d;        
        for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
        {
            Clazz theClass = (Clazz) iter.next();
            int classLines = theClass.getLines().size();
            double rate = 0;
            try
			{
                rate = new Double(theClass.getLineRate()).floatValue();
            }
            catch(NumberFormatException e)
            {
                rate = 0;
            }
            pckgTestedLines += (rate * classLines);
            pckgLines += classLines;
        }

        return (pckgTestedLines / pckgLines);
    }

May be branches rates could be "weighted" by the number of branches and not by the number of lines.

Thanks, Thomas


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (MPJCOVERAGE-14) Invalid Overview and packages rates

Posted by ji...@codehaus.org.
The following issue has been updated:

    Updater: Thomas Recloux (mailto:trecloux@norsys.fr)
       Date: Thu, 2 Sep 2004 1:09 PM
    Changes:
             Attachment changed to Package.java
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://jira.codehaus.org/browse/MPJCOVERAGE-14?page=history

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MPJCOVERAGE-14

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MPJCOVERAGE-14
    Summary: Invalid Overview and packages rates
       Type: Bug

     Status: Open
   Priority: Major

 Original Estimate: 30 minutes
 Time Spent: Unknown
  Remaining: 30 minutes

    Project: maven-jcoverage-plugin
   Versions:
             1.0.7

   Assignee: Emmanuel Venisse
   Reporter: Thomas Recloux

    Created: Thu, 2 Sep 2004 1:07 PM
    Updated: Thu, 2 Sep 2004 1:09 PM
Environment: Maven 1.0 jcoverage 1.0.5

Description:
First, please excuse me for my poor English.

Maven jcoverage plugins generate an html report using xml data generated by jcoverage.

The overwiew and packages rates are not the sames as with jcoverage alone. This difference is due to the maven plugin algorythm wich ignores the "weight" (number of lines) of the classes.

If a package contains two classes one which contains 200 lines is tested at 80% and an other wich contains 10 lines tested at 0%, the plugin will compute a package rate of 40%, jcoverage alone will compute a rate of 76%.

I have modified the plugin in order to compute the good rates.

Here are the changes :

Coverage.java :

    public String getCoveredPercentBranch()
    {
    	double totalLines = 0.00d;
    	double total = 0.00d;

        if (getLineCoverage() > 0.00d)
        {
            for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
            {
                Clazz theClass = (Clazz) iter.next();
                int classLines = theClass.getLines().size();
                double rate = 0;
                try
                {
                    rate = new Double(theClass.getBranchRate()).floatValue();
                }
                catch(NumberFormatException e)
                {
                    rate = 0;
                }
                total += (rate*classLines);
                totalLines += classLines;
            }

            total /= totalLines;
        }

        return String.valueOf(total);
    }
    
    private double getLineCoverage()
    {
        double totalLines = 0.00d;
        double totalTestedLines = 0.00d;        
        for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
        {
            Clazz theClass = (Clazz) iter.next();
            int classLines = theClass.getLines().size();
            double rate = 0;
            try
			{
                rate = new Double(theClass.getLineRate()).floatValue();
            }
            catch(NumberFormatException e)
            {
                rate = 0;
            }
            totalTestedLines += (rate * classLines);
            totalLines += classLines;
        }

        return (totalTestedLines / totalLines);

    }

Package.java :

   public String getCoveredPercentBranch()
    {
    	double pckgLines = 0.00d;
    	double total = 0.00d;

        if (getLineCoverage() > 0.00d)
        {
            for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
            {
                Clazz theClass = (Clazz) iter.next();
                int classLines = theClass.getLines().size();
                double rate = 0;
                try
                {
                    rate = new Double(theClass.getBranchRate()).floatValue();
                }
                catch(NumberFormatException e)
                {
                    rate = 0;
                }
                total += (rate*classLines);
                pckgLines += classLines;
            }

            total /= pckgLines;
        }

        return String.valueOf(total);
    }

    private double getLineCoverage()
    {
        double pckgLines = 0.00d;
        double pckgTestedLines = 0.00d;        
        for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
        {
            Clazz theClass = (Clazz) iter.next();
            int classLines = theClass.getLines().size();
            double rate = 0;
            try
			{
                rate = new Double(theClass.getLineRate()).floatValue();
            }
            catch(NumberFormatException e)
            {
                rate = 0;
            }
            pckgTestedLines += (rate * classLines);
            pckgLines += classLines;
        }

        return (pckgTestedLines / pckgLines);
    }

May be branches rates could be "weighted" by the number of branches and not by the number of lines.

Thanks, Thomas


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


[jira] Closed: (MPJCOVERAGE-14) Invalid Overview and packages rates

Posted by ji...@codehaus.org.
Message:

   The following issue has been closed.

   Resolver: Emmanuel Venisse
       Date: Fri, 3 Sep 2004 4:05 AM

Applied. Thanks.
---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MPJCOVERAGE-14

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MPJCOVERAGE-14
    Summary: Invalid Overview and packages rates
       Type: Bug

     Status: Closed
   Priority: Major
 Resolution: FIXED

 Original Estimate: 30 minutes
 Time Spent: Unknown
  Remaining: 30 minutes

    Project: maven-jcoverage-plugin
   Fix Fors:
             1.0.8
   Versions:
             1.0.7

   Assignee: Emmanuel Venisse
   Reporter: Thomas Recloux

    Created: Thu, 2 Sep 2004 1:07 PM
    Updated: Fri, 3 Sep 2004 4:05 AM
Environment: Maven 1.0 jcoverage 1.0.5

Description:
First, please excuse me for my poor English.

Maven jcoverage plugins generate an html report using xml data generated by jcoverage.

The overwiew and packages rates are not the sames as with jcoverage alone. This difference is due to the maven plugin algorythm wich ignores the "weight" (number of lines) of the classes.

If a package contains two classes one which contains 200 lines is tested at 80% and an other wich contains 10 lines tested at 0%, the plugin will compute a package rate of 40%, jcoverage alone will compute a rate of 76%.

I have modified the plugin in order to compute the good rates.

Here are the changes :

Coverage.java :

    public String getCoveredPercentBranch()
    {
    	double totalLines = 0.00d;
    	double total = 0.00d;

        if (getLineCoverage() > 0.00d)
        {
            for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
            {
                Clazz theClass = (Clazz) iter.next();
                int classLines = theClass.getLines().size();
                double rate = 0;
                try
                {
                    rate = new Double(theClass.getBranchRate()).floatValue();
                }
                catch(NumberFormatException e)
                {
                    rate = 0;
                }
                total += (rate*classLines);
                totalLines += classLines;
            }

            total /= totalLines;
        }

        return String.valueOf(total);
    }
    
    private double getLineCoverage()
    {
        double totalLines = 0.00d;
        double totalTestedLines = 0.00d;        
        for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
        {
            Clazz theClass = (Clazz) iter.next();
            int classLines = theClass.getLines().size();
            double rate = 0;
            try
			{
                rate = new Double(theClass.getLineRate()).floatValue();
            }
            catch(NumberFormatException e)
            {
                rate = 0;
            }
            totalTestedLines += (rate * classLines);
            totalLines += classLines;
        }

        return (totalTestedLines / totalLines);

    }

Package.java :

   public String getCoveredPercentBranch()
    {
    	double pckgLines = 0.00d;
    	double total = 0.00d;

        if (getLineCoverage() > 0.00d)
        {
            for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
            {
                Clazz theClass = (Clazz) iter.next();
                int classLines = theClass.getLines().size();
                double rate = 0;
                try
                {
                    rate = new Double(theClass.getBranchRate()).floatValue();
                }
                catch(NumberFormatException e)
                {
                    rate = 0;
                }
                total += (rate*classLines);
                pckgLines += classLines;
            }

            total /= pckgLines;
        }

        return String.valueOf(total);
    }

    private double getLineCoverage()
    {
        double pckgLines = 0.00d;
        double pckgTestedLines = 0.00d;        
        for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
        {
            Clazz theClass = (Clazz) iter.next();
            int classLines = theClass.getLines().size();
            double rate = 0;
            try
			{
                rate = new Double(theClass.getLineRate()).floatValue();
            }
            catch(NumberFormatException e)
            {
                rate = 0;
            }
            pckgTestedLines += (rate * classLines);
            pckgLines += classLines;
        }

        return (pckgTestedLines / pckgLines);
    }

May be branches rates could be "weighted" by the number of branches and not by the number of lines.

Thanks, Thomas


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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