Ant Builds, aber alle Junit-Tests schlagen fehl

Georgios assiotis

Ich bin neu in der Verwendung von Ameise und Junit. Ich habe folgendes Problem. Meine ant build.xml wird erfolgreich erstellt, aber während der Ausführung der Junit-Tests wird die folgende Meldung angezeigt.

[echo] Running JUnit tests....
[mkdir] Created dir: /Users/george_ashiotis/Desktop/Coursework files-20180731/commons-validator-1.4.0/target/test-result
[junit] Running java.org.apache.commons.validator.AbstractCommonTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
[junit] Test java.org.apache.commons.validator.AbstractCommonTest FAILED
[junit] Running java.org.apache.commons.validator.AbstractNumberTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
[junit] Test java.org.apache.commons.validator.AbstractNumberTest FAILED
[junit] Running java.org.apache.commons.validator.ByteTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
[junit] Test java.org.apache.commons.validator.ByteTest FAILED

Hinweis: Dies geschieht für alle meine Testdateien.

Dies ist meine build.xml-Datei

    <!--
    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.
-->
<project name="Validator" default="dist" basedir=".">


<!--
        "Validator" component of the Apache Commons Subproject
        $Id$
        $Id$
-->


<!-- ========== Initialize Properties ===================================== -->


  <property file="build.properties"/>                <!-- Component local   -->
  <property file="../build.properties"/>             <!-- Commons local     -->
  <property file="${user.home}/build.properties"/>   <!-- User local        -->


<!-- ========== External Dependencies ===================================== -->


  <!-- The directories corresponding to your necessary dependencies -->
  <property name="commons.home"            value="../../jakarta-commons"/>
  <property name="sandbox.home"            value="../../jakarta-commons-sandbox"/>

<!-- ========== Component Declarations ==================================== -->


  <!-- The name of this component -->
  <property name="component.name"          value="validator"/>

  <!-- The primary package name of this component -->
  <property name="component.package"       value="org.apache.commons.validator"/>

  <!-- The title of this component -->
  <property name="component.title"         value="Commons Validator"/>

  <!-- The current version number of this component -->
  <property name="component.version"       value="1.4.0-SNAPSHOT"/>

  <!-- The base directory for compilation targets -->
  <property name="build.home"              value="target"/>

  <!-- The base directory for component resources -->
  <property name="resources.home"          value="src/main/resources"/>

  <!-- The base directory for distribution targets -->
  <property name="dist.home"               value="dist"/>

  <!-- The base directory for release targets -->
  <property name="release.home"            value="release" />

  <!-- The base directory for component sources -->
  <property name="source.home"             value="src/main/java"/>

  <!-- The base directory for javascript sources -->
  <property name="javascript.home"             value="src/javascript"/>

  <!-- The base directory for unit test sources -->
  <property name="test.home"               value="src/test"/>

  <!-- The base directory for example sources -->
  <property name="example.home"            value="src/example"/>

  <!-- Directory where binary release files are staged -->
  <property name="stage.bin.dir"           value="${release.home}/stage/bin"/>

  <!-- Directory where source release files are staged -->
  <property name="stage.src.dir"           value="${release.home}/stage/src"/>

  <!-- Directory where release builds are prepared for upload -->
  <property name="upload.dir"              value="${release.home}/upload"/>

  <!-- Base file name for upload files -->
  <property name="upload.file.base"        value="${component.name}-${component.version}"/>

  <!-- Download lib dir -->
  <property name="download.lib.dir"        value="lib"/>

<!-- ========== Compiler Defaults ========================================= -->


  <!-- source JDK version (should be same as maven.compile.source) -->
  <property name="compile.source"          value="1.4"/>

  <!-- target JDK version (should be same as maven.compile.target) -->
  <property name="compile.target"          value="1.4"/>

  <!-- Should Java compilations set the 'debug' compiler option? -->
  <property name="compile.debug"           value="true"/>

  <!-- Should Java compilations set the 'deprecation' compiler option? -->
  <property name="compile.deprecation"     value="false"/>

  <!-- Should Java compilations set the 'optimize' compiler option? -->
  <property name="compile.optimize"        value="true"/>

  <!-- Construct compile classpath -->
  <path id="compile.classpath">
    <pathelement location="${build.home}/classes"/>
    <pathelement location="${download.lib.dir}/commons-beanutils-1.8.3.jar"/>
    <pathelement location="${download.lib.dir}/commons-digester-1.8.jar"/>
    <pathelement location="${download.lib.dir}/commons-logging-1.1.1.jar"/>
    <path refid="downloaded.lib.classpath"/>
  </path>

  <!-- Construct compile classpath -->
  <path id="downloaded.lib.classpath">
      <pathelement location="${download.lib.dir}/commons-beanutils-1.8.3.jar"/>
      <pathelement location="${download.lib.dir}/commons-digester-1.8.jar"/>
      <pathelement location="${download.lib.dir}/commons-logging-1.1.1.jar"/>
      <pathelement location="${download.lib.dir}/junit-4.11.jar"/>
  </path>

<!-- ========== Test Execution Defaults =================================== -->

  <!--COURSEWORK MODIFICATION-->
  <!-- Construct unit test classpath -->
  <path id="test.classpath">
    <pathelement location="${build.home}/classes"/>
    <pathelement location="${build.home}/tests"/>
    <pathelement location="lib/commons-beanutils-1.8.3.jar"/>
    <pathelement location="lib/commons-digester-1.8.jar"/>
    <pathelement location="lib/commons-logging-1.1.1.jar"/>
    <pathelement location="lib/junit-4.11.jar"/>
    <pathelement location="${xerces.jar}"/>
    <pathelement location="lib/ant-junit-1.9.2.jar"/>
    <pathelement location="lib/assertj-core-1.0.0.jar"/>
    <pathelement location="lib/mockito-all-1.9.5.jar"/>
    <pathelement location="lib/pitest-1.1.4.jar"/>
    <pathelement location="lib/pitest-ant-1.1.4.jar"/>
    <pathelement location="lib/quickbuilder-1.2.jar"/>
    <pathelement location="lib/xmlpull-1.1.3.1.jar"/>
    <pathelement location="lib/xstream-1.4.8.jar"/>
    <pathelement location="lib/commons-collections-3.2.1-1.0.0.jar" />
    <!--<path refid="downloaded.lib.classpath"/>-->
  </path>

  <!-- Should all tests fail if one does? -->
  <property name="test.failonerror"        value="true"/>

  <!-- The test runner to execute -->
  <property name="test.runner"             value="junit.textui.TestRunner"/>

  <!-- create pitest task -->
  <taskdef name="pitest" classpathref="test.classpath" classname="org.pitest.ant.PitestTask" />

  <taskdef name="junit" classpathref="test.classpath" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>


<!-- ========== Executable Targets ======================================== -->


  <target name="init"
   description="Initialize and evaluate conditionals">
    <echo message="-------- ${component.name} ${component.version} --------"/>
    <filter  token="name"                  value="${component.name}"/>
    <filter  token="package"               value="${component.package}"/>
    <filter  token="version"               value="${component.version}"/>
    <filter  token="compilesource"         value="${compile.source}"/>
    <filter  token="compiletarget"         value="${compile.target}"/>
    <available property="jsdoc.found" type="file" file="${jsdoc.home}/jsdoc.pl"/>
  </target>


  <target name="prepare" depends="init"
   description="Prepare build directory">
    <mkdir dir="${build.home}"/>
    <mkdir dir="${build.home}/classes"/>
    <mkdir dir="${build.home}/tests"/>
  </target>


  <target name="static" depends="prepare"
   description="Copy static files to build directory">
    <tstamp/>
  </target>


  <target name="compile" depends="static" description="Compile shareable components">
      <mkdir dir="${build.home}/classes"/>
      <javac    srcdir="${source.home}"
                includeantruntime="false"
                destdir="${build.home}/classes"
                source="${compile.source}"
                target="${compile.target}"
                debug="true"
                debuglevel="source,lines"
                encoding="cp1252"
                deprecation="${compile.deprecation}"
                optimize="${compile.optimize}">
                <classpath refid="compile.classpath"/>
      </javac>
    <copy    todir="${build.home}/classes" filtering="on">
      <fileset dir="${source.home}"
          excludes="**/*.java"/>
    </copy>
    <copy    todir="${build.home}/classes">
      <fileset dir="${resources.home}" includes="**/*.dtd,**/*.xml"/>
    </copy>
    <copy    todir="${build.home}/classes/">
      <fileset dir="${javascript.home}"
          includes="**/*.js"/>
    </copy>
  </target>


  <target name="clean"
   description="Clean build and distribution directories">
    <delete    dir="${build.home}"/>
    <delete    dir="${dist.home}"/>
    <delete    dir="${release.home}"/>
    <delete    dir="pitReports" />
  </target>


  <target name="all" depends="clean,compile"
   description="Clean and compile all components"/>


  <target name="javadoc.init" 
   description="Initializes Javadoc directories">
    <mkdir      dir="${dist.home}"/>
    <mkdir      dir="${dist.home}/docs"/>
    <mkdir      dir="${dist.home}/docs/apidocs"/>
    <mkdir      dir="${dist.home}/docs/javascript"/>
    <mkdir      dir="${dist.home}/docs/javascript/org/apache/commons/validator/javascript/doc-files"/>
  </target>  

  <target name="javadoc.js" depends="javadoc.js.unix,javadoc.js.windows"
   description="Create Javascript Javadoc documentation">

    <copy todir="${dist.home}/docs/javascript/org/apache/commons/validator/javascript/doc-files">
      <fileset dir="${javascript.home}/org/apache/commons/validator/javascript/doc-files" includes="*.gif"/>
    </copy>

  </target>

  <target name="javadoc.js.unix" depends="javadoc.init" if="jsdoc.found"
   description="Create Javascript Javadoc documentation">
    <exec  executable="bash" failifexecutionfails="false">
         <arg line="-c 'etc/jsdoc.sh ${jsdoc.home} ${javascript.home} ${dist.home}/docs/javascript' "/>
    </exec>
  </target>

  <target name="javadoc.js.windows" depends="javadoc.init" if="jsdoc.found"
   description="Windows Create Javascript Javadoc documentation">
    <exec  executable="etc/jsdoc.bat" failifexecutionfails="false">
         <arg line="${jsdoc.home} ${javascript.home} ${dist.home}/docs/javascript"/>
    </exec>
  </target>

  <target name="javadoc" depends="compile, javadoc.js"
   description="Create component Javadoc documentation">
    <!--javadoc sourcepath="${source.home}"
                destdir="${dist.home}/docs/apidocs"
           packagenames="org.apache.commons.*"
                 author="true"
                private="true"
                version="true"
               doctitle="&lt;h1&gt;${component.title} (Version ${component.version})&lt;/h1&gt;"
            windowtitle="${component.title} (Version ${component.version})"
                 bottom="Copyright (c) 2001-2004  Apache Software Foundation"
           classpathref="compile.classpath" / -->
  </target>



  <target name="change-log" >
    <cvschangelog destfile="changelog.xml" start="${cvs.start}" />
     <style in="changelog.xml" out="changelog.html" style="${ant.home}/etc/changelog.xsl">
          <param name="title" expression="Validator ChangeLog"/>
          <param name="module" expression="commons"/>
          <param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
    </style>
  </target>



  <target name="dist" depends="compile,javadoc"
   description="Create binary distribution">
    <mkdir      dir="${dist.home}"/>

    <ant antfile="build-javascript.xml" target="compress">
        <property name="source.dir" value="${javascript.home}"/>
        <property name="dist.dir"   value="${dist.home}"/>
        <property name="build.dir"  value="${build.home}"/>
        <property name="final.name" value="commons-${component.name}-${component.version}"/>
    </ant>

    <copy      file="LICENSE.txt"
              todir="${dist.home}"/>
    <copy      file="NOTICE.txt"
              todir="${dist.home}"/>
    <copy      file="RELEASE-NOTES.txt"
              todir="${dist.home}"/>
    <mkdir      dir="${build.home}/classes/META-INF"/>
    <copy      file="LICENSE.txt"
             tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
    <copy      file="NOTICE.txt"
             tofile="${build.home}/classes/META-INF/NOTICE.txt"/>

    <manifest file="${build.home}/MANIFEST.MF">
        <attribute name="Specification-Title"      value="${component.title}"/>
        <attribute name="Specification-Version"    value="${component.version}"/>
        <attribute name="Specification-Vendor"     value="Apache Software Foundation"/>
        <attribute name="Implementation-Title"     value="${component.title}"/>
        <attribute name="Implementation-Version"   value="${component.version}"/> 
        <attribute name="Implementation-Vendor"    value="Apache Software Foundation"/>
        <attribute name="Implementation-Vendor-Id" value="org.apache"/>
        <attribute name="X-Compile-Source-JDK"     value="${compile.source}"/>
        <attribute name="X-Compile-Target-JDK"     value="${compile.target}"/>
    </manifest>

    <jar    jarfile="${dist.home}/commons-${component.name}-${component.version}.jar"
            basedir="${build.home}/classes"
           manifest="${build.home}/MANIFEST.MF"/>
  </target>

<!-- ========== Unit Test Targets ========================================= -->


  <target name="compile.tests" depends="compile" description="Compile unit test cases">
      <javac    srcdir="${test.home}"
                destdir="${build.home}/tests"
                debug="true"
                debuglevel="source,lines"
                source="${compile.source}"
                target="${compile.target}"
                deprecation="${compile.deprecation}"
                includeantruntime="false"
                encoding="cp1252"
                optimize="${compile.optimize}">
                <classpath refid="test.classpath"/>
      </javac>

      <copy    todir="${build.home}/tests" filtering="on">
          <fileset dir="${test.home}/resources"/>
      </copy>

  </target>


  <target name="test"  depends="compile.tests" description="Run all unit test cases">
        <echo message ="Running JUnit tests...." />
        <mkdir dir="${build.home}/test-result" />

        <junit printsummary="yes" showoutput="true">
            <classpath refid="test.classpath" />
            <formatter type="xml" />
            <!-- If test.entry is defined, run a single test, otherwise run all valid tests -->
            <test name="${test.entry}" todir="${build.home}/test-result" if="test.entry"/>
            <batchtest fork="yes" todir="${build.home}/test-result" unless="test.entry">
                <fileset dir="${test.home}">
                    <include name="**/*Test.java"/>
                </fileset>
            </batchtest>
        </junit>
        <!-- junitreport omitted for coursework -->
  </target>

  <!-- ========== MUTATION TESTS =========================================== -->

  <target name="pit" depends="clean,test,compile">
      <echo message="Running mutation tests ..."/>
      <pitest   pitClasspath="test.classpath"
                threads="2"
                classPath="test.classpath"
                targetTests="org.apache.commons.validator.*"
                targetClasses="org.apache.commons.validator.*"
                reportDir="pitReports"
                sourceDir="${source.home}" />
  </target>

  <!-- ========== MUTATION TESTS =========================================== -->


<!-- ========== Release Targets =========================================== -->


    <target name="release" depends="clean,dist"
    description="Construct release distribution">
        <mkdir dir="${stage.bin.dir}/${upload.file.base}"/>
        <mkdir dir="${stage.src.dir}/${upload.file.base}-src"/>
        <copy todir="${stage.bin.dir}/${upload.file.base}">
            <fileset dir="${dist.home}"/>
        </copy>
        <copy todir="${stage.src.dir}/${upload.file.base}-src">
            <fileset dir=".">
                <exclude name="build.properties"/>
                <exclude name="${build.home}/**"/>
                <exclude name="${dist.home}/**"/>
                <exclude name="${build.home}/**"/>
            </fileset>
        </copy>
        <mkdir dir="${upload.dir}"/>
        <zip  zipfile="${upload.dir}/${upload.file.base}.zip"
              basedir="${stage.bin.dir}"/>
        <zip  zipfile="${upload.dir}/${upload.file.base}-src.zip"
              basedir="${stage.src.dir}"/>
        <tar  tarfile="${upload.dir}/${upload.file.base}.tar"
              basedir="${stage.bin.dir}"
             longfile="gnu"/>
        <tar  tarfile="${upload.dir}/${upload.file.base}-src.tar"
              basedir="${stage.src.dir}"
             longfile="gnu"/>
        <gzip     src="${upload.dir}/${upload.file.base}.tar"
              zipfile="${upload.dir}/${upload.file.base}.tar.gz"/>
        <gzip     src="${upload.dir}/${upload.file.base}-src.tar"
              zipfile="${upload.dir}/${upload.file.base}-src.tar.gz"/>
    </target>


</project>

Weiß jemand, was das Problem sein könnte? Jede Hilfe wird geschätzt

Danke im Voraus.

Georgios assiotis

Ich habe die gleiche Frage an https://issues.apache.org/jira/browse/VALIDATOR-443 gesendet . Dort finden Sie auch die Antwort.

Grundsätzlich besteht das Problem darin, dass der Ant Build aus dem Projekt 1.4.0 entfernt wurde. und das schlug mir vor, die neueste Version zu verwenden und sie mit maven zu erstellen.

Ich hoffe das hilft.

Dieser Artikel stammt aus dem Internet. Bitte geben Sie beim Nachdruck die Quelle an.

Bei Verstößen wenden Sie sich bitte [email protected] Löschen.

bearbeiten am
0

Lass mich ein paar Worte sagen

0Kommentare
LoginNach der Teilnahme an der Überprüfung

Verwandte Artikel

Warum schlagen JUnit-Tests in Ant Build System fehl?

Unit-Tests schlagen fehl, wenn ich alle Tests ausführe, aber beim Debuggen bestehen

Alle Visual Studio 2013-Builds schlagen jetzt fehl

Meine JUnit-Tests funktionieren, wenn sie in Eclipse ausgeführt werden, schlagen jedoch manchmal zufällig über Ant fehl

Schienen 6 Alle validate_presence_of-Tests schlagen fehl

Schienen 4 - Alle Tests schlagen fehl (sogar wahr bestätigen)

JUnit-Tests schlagen nach dem Definieren der Instanz fehl

VTK, Mayavi BUG: Alle "ButtonReleaseEvents" schlagen fehl, aber alle "ButtonPressEvents" funktionieren?

Tests schlagen zufällig fehl

Android Unit-Testlauf Alle Klassentests schlagen fehl, aber jede einzelne Methode wird erfolgreich ausgeführt

pytest und argparse: Code funktioniert im Einsatz, aber Tests schlagen fehl

Tests bestehen beim lokalen AS-Emulator, schlagen aber beim Firebase-Testlabor fehl

Wie man FacesContext mit JMockit verspottet, Alle Tests schlagen mit NullPointerException fehl

Android Instrumented-Tests schlagen fehl, wenn alle zusammen ausgeführt werden

Meine Junit-Tests schlagen immer wieder fehl, obwohl der Code korrekt ist

Lokal durchgeführte Tests bestehen, aber Jenkins-Tests schlagen fehl. warum und wie kann ich das beheben?

Alle Hive-Funktionen schlagen fehl

MacOS Swift Framework-Tests schlagen fehl

Hamcrest-Tests schlagen immer fehl

Parametrisierte Tests schlagen mit mvn test fehl

Jest TypeScript-Tests schlagen in Jenkins fehl

Robolectric Unit Tests schlagen nach Multidex fehl

Jestjs-Tests schlagen in Gitlab CI fehl

Jhipster Java-Tests schlagen fehl - Anwendungseigenschaften

Warum schlagen diese Python-Tests fehl?

clientseitige Tests schlagen mit jhipster 5.1.0 fehl

Flatter goldene Tests schlagen auf CI fehl

Qunit-Tests schlagen abwechselnd fehl

Ant, führen Sie alle jUnit-Tests aus

TOP Liste

  1. 1

    So legen Sie mit dem Interface Builder unterschiedliche führende Speicherplätze für unterschiedliche Geräte fest

  2. 2

    Fügen Sie eine weitere Schaltfläche zu gwt Suggest Box hinzu

  3. 3

    Wie konvertiere ich einen Vektor von Bytes (u8) in eine Zeichenfolge?

  4. 4

    Wie kann ich in SCSS mehrere Klassen zu einer einzigen kombinieren?

  5. 5

    Wie konvertiert man einen Datenrahmen im langen Format in eine Liste mit einem geeigneten Format?

  6. 6

    Speichern Sie ein MPAndroidChart-Diagramm in einem Bild, ohne es in einer Aktivität anzuzeigen

  7. 7

    Gruppieren Sie Datenrahmenspalten nach ihrem Datum (die Spaltentitel enthalten) und fassen Sie die Instanzen von Einsen und Nullen in R . zusammen

  8. 8

    Tomcat - Leiten Sie den alten Kontextstamm zum neuen Kontextstamm um

  9. 9

    Eclipse Oxygen - Projekte verschwinden

  10. 10

    Wie wählt man Unterschiede mit drei Tabellen aus?

  11. 11

    Tic Tac Toe-Spiel im React-Reset-Button funktioniert nicht

  12. 12

    So berechnen Sie die Verfügbarkeit von Anwendungen (SLA)

  13. 13

    ElasticSearch BulkShardRequest ist aufgrund von org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor fehlgeschlagen

  14. 14

    Wie kann ich den Kaskadenmodus global einstellen?

  15. 15

    Python: Spalten mit demselben Namen zusammenführen, wobei der Mindestwert beibehalten wird

  16. 16

    So erhalten Sie eine gleichmäßige Höhe für alle Eingabefelder

  17. 17

    Wie erstelle ich einen neuen übergeordneten Knoten außerhalb der .ref (/ path) in der Firebase-Echtzeitdatenbank mithilfe von Cloud-Funktionen (Typescript)?

  18. 18

    Was ist schneller: SUM über NULL oder über 0?

  19. 19

    Wie kann ich eine verschachtelte Schleife mit lapply in R ersetzen?

  20. 20

    Kann ich ein Tkinter-Canvas erstellen, das mehrere Zeilen in einem Text-Widget umfasst?

  21. 21

    Ärgerliches Problem mit yaml, das ich nicht lösen kann

heißlabel

Archiv