ASF Bugzilla – Attachment 27948 Details for
Bug 52151
[PATCH] A code-coverage tool for code analysis
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
code coverage tool
jacoco.patch (text/plain), 8.80 KB, created by
Mehdi Houshmand
on 2011-11-16 11:44:14 UTC
(
hide
)
Description:
code coverage tool
Filename:
MIME Type:
Creator:
Mehdi Houshmand
Created:
2011-11-16 11:44:14 UTC
Size:
8.80 KB
patch
obsolete
>Index: test/java/org/apache/fop/layoutengine/HyphenationLayoutTestCase.java >=================================================================== >--- test/java/org/apache/fop/layoutengine/HyphenationLayoutTestCase.java (revision 0) >+++ test/java/org/apache/fop/layoutengine/HyphenationLayoutTestCase.java (revision 0) >@@ -0,0 +1,53 @@ >+/* >+ * Licensed to the Apache Software Foundation (ASF) under one or more >+ * contributor license agreements. See the NOTICE file distributed with >+ * this work for additional information regarding copyright ownership. >+ * The ASF licenses this file to You under the Apache License, Version 2.0 >+ * (the "License"); you may not use this file except in compliance with >+ * the License. You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable law or agreed to in writing, software >+ * distributed under the License is distributed on an "AS IS" BASIS, >+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ * See the License for the specific language governing permissions and >+ * limitations under the License. >+ */ >+ >+/* $Id$ */ >+ >+package org.apache.fop.layoutengine; >+ >+import java.io.File; >+import java.io.IOException; >+import java.util.Collection; >+ >+import org.junit.runners.Parameterized.Parameters; >+ >+/** >+ * Class for testing the FOP's hyphenation layout engine using testcases specified in XML >+ * files. >+ */ >+public class HyphenationLayoutTestCase extends LayoutEngineTestCase { >+ >+ /** >+ * Creates the parameters for this test. >+ * >+ * @return the list of file arrays populated with test files >+ * @throws IOException if an I/O error occurs while reading the test file >+ */ >+ @Parameters >+ public static Collection<File[]> getParameters() throws IOException { >+ return LayoutEngineTestUtils.getLayoutTestFiles("hyphenation-testcases"); >+ } >+ >+ /** >+ * Constructor >+ * @param testFile the file to test >+ */ >+ public HyphenationLayoutTestCase(File testFile) { >+ super(testFile); >+ } >+ >+} >Index: test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java >=================================================================== >--- test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java (revision 1202587) >+++ test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java (working copy) >@@ -172,15 +172,26 @@ > * @return A collection of file arrays that contain the test files > */ > public static Collection<File[]> getLayoutTestFiles() { >- TestFilesConfiguration.Builder builder = new TestFilesConfiguration.Builder(); > String testSet = System.getProperty("fop.layoutengine.testset"); > testSet = (testSet != null ? testSet : "standard") + "-testcases"; >+ return getLayoutTestFiles(testSet); >+ } > >+ /** >+ * This is a helper method that uses the standard parameters for FOP's layout engine tests, >+ * given a test set name returns a set of test files. >+ * >+ * @param testSetName the name of the test set >+ * @return A collection of file arrays that contain the test files >+ */ >+ public static Collection<File[]> getLayoutTestFiles(String testSetName) { >+ TestFilesConfiguration.Builder builder = new TestFilesConfiguration.Builder(); >+ > builder.testDir("test/layoutengine") > .singleProperty("fop.layoutengine.single") > .startsWithProperty("fop.layoutengine.starts-with") > .suffix(".xml") >- .testSet(testSet) >+ .testSet(testSetName) > .disabledProperty("fop.layoutengine.disabled", > "test/layoutengine/disabled-testcases.xml") > .privateTestsProperty("fop.layoutengine.private"); >Index: jacoco.xml >=================================================================== >--- jacoco.xml (revision 0) >+++ jacoco.xml (revision 0) >@@ -0,0 +1,48 @@ >+<?xml version="1.0"?> >+<project xmlns:jacoco="antlib:org.jacoco.ant" xmlns:ivy="antlib:org.apache.ivy.ant" name="jacoco" default="code-coverage"> >+ <import file="build.xml"/> >+ <property name="result.jacoco.report" value="${build.dir}/jacoco-report"/> >+ <property name="result.jacoco.dir" value="${build.dir}/jacoco"/> >+ <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml"> >+ <classpath> >+ <fileset dir="${jacoco.lib}"> >+ <include name="**/*.jar"/> >+ </fileset> >+ </classpath> >+ </taskdef> >+ <target name="test-coverage" depends="junit-compile, setup-xml-schema"> >+ <jacoco:coverage destfile="${result.jacoco.dir}/jacoco-standard.exec"> >+ <junit dir="${basedir}" haltonfailure="yes" fork="on" forkmode="once" errorproperty="fop.junit.error" failureproperty="fop.junit.failure"> >+ <sysproperty key="jawa.awt.headless" value="true"/> >+ <formatter type="brief" usefile="false"/> >+ <formatter type="plain" usefile="true"/> >+ <formatter type="xml" usefile="true"/> >+ <classpath> >+ <path refid="standard-junit-classpath"/> >+ </classpath> >+ <batchtest todir="${junit.reports.dir}"> >+ <fileset dir="${build.unit.tests.dir}" includes="**/*TestCase.class"/> >+ </batchtest> >+ </junit> >+ </jacoco:coverage> >+ </target> >+ <target name="code-coverage" depends="test-coverage"> >+ <jacoco:merge destfile="${result.jacoco.dir}/jacoco.exec"> >+ <fileset dir="${result.jacoco.dir}" includes="*.exec"/> >+ </jacoco:merge> >+ <jacoco:report> >+ <executiondata> >+ <file file="${result.jacoco.dir}/jacoco.exec"/> >+ </executiondata> >+ <structure name="Jacoco"> >+ <classfiles> >+ <fileset dir="${build.classes.dir}"/> >+ </classfiles> >+ <sourcefiles> >+ <fileset dir="${src.java.dir}"/> >+ </sourcefiles> >+ </structure> >+ <html destdir="${result.jacoco.dir}"/> >+ </jacoco:report> >+ </target> >+</project> >Index: build.xml >=================================================================== >--- build.xml (revision 1202587) >+++ build.xml (working copy) >@@ -151,7 +151,7 @@ > <property name="javac.source" value="1.5"/> > <property name="javac.target" value="1.5"/> > <property name="javac.fork" value="no"/> >- <property name="junit.fork" value="on"/> >+ <property name="junit.fork" value="yes"/> > <property name="junit.haltonfailure" value="off"/> > <property name="javadoc.packages" value="org.apache.fop.*"/> > <property name="src.dir" value="${basedir}/src"/> >@@ -784,7 +784,7 @@ > </sequential> > </macrodef> > <target name="junit-all" depends="junit-compile, junit-transcoder, junit-layout-hyphenation, setup-xml-schema" description="Runs FOP's JUnit basic tests" if="junit.present"> >- <junit dir="${basedir}" haltonfailure="yes" fork="${junit.fork}" errorproperty="fop.junit.error" failureproperty="fop.junit.failure"> >+ <junit dir="${basedir}" haltonfailure="yes" fork="${junit.fork}" forkmode="once" errorproperty="fop.junit.error" failureproperty="fop.junit.failure"> > <sysproperty key="jawa.awt.headless" value="true"/> > <formatter type="brief" usefile="false"/> > <formatter type="plain" usefile="true"/> >@@ -807,8 +807,7 @@ > <junit-run title="standard layout engine" testsuite="org.apache.fop.layoutengine.LayoutEngineTestSuite" outfile="TEST-layoutengine-standard"/> > </target> > <target name="junit-layout-hyphenation" depends="hyphenation-present, junit-compile" if="hyphenation.present" description="Runs FOP's JUnit hyphenation layout tests"> >- <property name="fop.layoutengine.testset" value="hyphenation"/> >- <junit-run title="hyphenation layout engine" testsuite="org.apache.fop.layoutengine.LayoutEngineTestSuite" outfile="TEST-layoutengine-hyphenation"/> >+ <junit-run title="hyphenation layout engine" testsuite="org.apache.fop.layoutengine.HyphenationLayoutTestCase" outfile="TEST-layoutengine-hyphenation"/> > </target> > <target name="junit-layout" depends="junit-layout-standard, junit-layout-hyphenation" description="Runs all FOP's JUnit layout tests"/> > <target name="junit-fotree" depends="junit-compile" description="Runs FOP's FO tree JUnit tests" if="junit.present"> >@@ -851,7 +850,8 @@ > <junit-run title="render-pdf" testsuite="org.apache.fop.render.pdf.RenderPDFTestSuite" outfile="TEST-render-pdf"/> > </target> > <target name="junit-reduced" depends="junit-userconfig, junit-basic, junit-transcoder, junit-text-linebreak, junit-fotree, junit-render-pdf"/> >- <target name="junit" depends="junit-all" description="Runs all of FOP's JUnit tests" if="junit.present"> >+ <target name="junit" depends="junit-all" description="Runs all of FOP's JUnit tests" >+ if="junit.present"> > <fail><condition><or><isset property="fop.junit.error"/><isset property="fop.junit.failure"/><not><isset property="hyphenation.present"/></not></or></condition> > NOTE: > **************************************************************************
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 52151
:
27909
| 27948