Не удалось скомпилировать таблицу стилей во время создания отчета Junit - PullRequest
0 голосов
/ 06 июня 2018

Может ли кто-нибудь помочь мне в приведенном ниже исключении при создании отчета Junit?Я боролся с этим несколько дней, но до сих пор не знаю, как его решить.

[11:35:15][Step 4/8] [junitreport] java.lang.NullPointerException
[11:35:15][Step 4/8] [junitreport]  at gnu.xml.aelfred2.SAXDriver.getLineNumber(SAXDriver.java:1165)
[11:35:15][Step 4/8] [junitreport]  at com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.getLineNumber(Parser.java:1447)
[11:35:15][Step 4/8] [junitreport]  at com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.parseTopLevel(Parser.java:1146)
[11:35:15][Step 4/8] [junitreport]  at com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.parseExpression(Parser.java:1112)
[11:35:15][Step 4/8] [junitreport]  at com.sun.org.apache.xalan.internal.xsltc.compiler.VariableBase.parseContents(VariableBase.java:237)
[11:35:15][Step 4/8] [junitreport]  at com.sun.org.apache.xalan.internal.xsltc.compiler.Param.parseContents(Param.java:108)
[11:35:15][Step 4/8] [junitreport]  at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.parseOwnChildren(Stylesheet.java:586)
[11:35:15][Step 4/8] [junitreport]  at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.parseContents(Stylesheet.java:558)
[11:35:15][Step 4/8] [junitreport]  at com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.createAST(Parser.java:399)
[11:35:15][Step 4/8] [junitreport]  at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:483)
[11:35:15][Step 4/8] [junitreport]  at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:568)
[11:35:15][Step 4/8] [junitreport]  at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:974)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.taskdefs.optional.TraXLiaison.readTemplates(TraXLiaison.java:302)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.taskdefs.optional.TraXLiaison.createTransformer(TraXLiaison.java:319)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:180)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:878)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:416)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.taskdefs.optional.junit.AggregateTransformer.transform(AggregateTransformer.java:271)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator.execute(XMLResultAggregator.java:160)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
[11:35:15][Step 4/8] [junitreport]  at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
[11:35:15][Step 4/8] [junitreport]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[11:35:15][Step 4/8] [junitreport]  at java.lang.reflect.Method.invoke(Method.java:606)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.Task.perform(Task.java:348)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.Target.execute(Target.java:435)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.Target.performTasks(Target.java:456)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.Main.runBuild(Main.java:853)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.Main.startAnt(Main.java:235)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
[11:35:15][Step 4/8] [junitreport]  at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
[11:35:15][Step 4/8] [junitreport] : Error! Could not compile stylesheet
[11:35:15][Step 4/8] [junitreport] : Fatal Error! java.lang.NullPointerException Cause: java.lang.NullPointerException
[11:35:15][Step 4/8] [junitreport] Failed to process /export/lokiagt/BuildAgent/work/710bab37db72c5d1/build/test/result/TESTS-TestSuites.xml

Окружающая среда:

ANT -> 1.9.6

JDK -> 1.8.0_171X64

JUNIT -> 4.8.2

Ниже приведено мое задание модульного тестирования в ANT:

<target name="unit.test" depends="compile.test.src" description="Run Junit Test">
    <echo message="Running Junit Test" />
    <junit showoutput="true" printsummary="yes" fork="true" forkmode="once">
        <classpath refid="junit.runtime.classpath" />
        <sysproperty key="log4j.configuration" value="${test.src.dir}/log4j-unit-test.properties" />
        <sysproperty key="javax.xml.transform.TransformerFactory" value="com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl" />
        <batchtest haltonfailure="no" todir="${test.result.dir}">
            <fileset dir="${test.src.dir}">
                <include name="**/*Test.java" />
            </fileset>
            <formatter type="xml" />
        </batchtest>
    </junit>

    <junitreport todir="${test.result.dir}">
        <fileset dir="${test.result.dir}">
            <include name="TEST-*.xml" />
        </fileset>
        <report format="frames" todir="${test.report.dir}" />
    </junitreport>
</target>

Заранее спасибо!

Любой, у кого есть идея, будет оценен!

1 Ответ

0 голосов
/ 25 июня 2018

Наконец-то это работает хорошо после того, как я понизил версию Ant jar с 1.9.6 до 1.7.1.Нужна дополнительная проверка, чтобы найти основную причину.

...