Ant + Jenkins

есть набор тестов, есть ант, есть дженкинс. нужно запукать тесты через дженкинс при помощи анта. но не выходит. через консоль тесты запустить могу, а вот при запуске через дженкинс пишет следующее

Started by user anonymous
[TestTesttest] $ cmd.exe /C '"ant.bat -file build.xml test && exit %%ERRORLEVEL%%"'
"ant.bat" ­Ґ пў«пҐвбп ў­гв७­Ґ© Ё«Ё ў­Ґи­Ґ©
Є®¬ ­¤®©, ЁбЇ®«­пҐ¬®© Їа®Ја ¬¬®© Ё«Ё Ї ЄҐв­л¬ д ©«®¬.
Build step 'Вызвать Ant' marked build as failure
Finished: FAILURE

Проверьте установлен ли у вас ant плагин в Jenkins. Если нет, то установите

Затем в конфигурации джобы сделайте Invoke ant script и передадите ему таргет и путь к build.xml

Судя по тому, что в ругательстве упоминается ant.bat, то вероятно, что сам плагин установлен и jenkins таки пытается вызвать ant, да проблема в том, что путь к папке с антом не прописан в системных переменных - добавьте ANT_HOME и это должно помочь.

Если, конечно, эта проблема еще актуальна :)

тесты запустил. поставил hudson, подключил муравья и все работает. 
есть другой вопрос, запускаю тесты через testng, при неудачном тесте искусственно его заваливаю через Assert.fail() в java.
однако билд все равно считается успешным. как от этого избавится?
необходимо чтобы билд считался зафейленым.

RoutesTestsuite
: [testng] [TestNG] Running: [testng] [testng] TEST FAILED. for more information see log [testng] Test took 212 seconds [testng] Test took 212 seconds [testng] Report Generated Succesfully [testng] [testng] =============================================== [testng] Total tests run: 1, Failures: 1, Skips: 0 [testng] =============================================== [testng] [testng] The tests failed. BUILD SUCCESSFUL

Вот вырезка из моего скрипта (если что-то непонятно, почитать можно больше в хелпе по командам ant):

<java fork="true" failonerror="false" resultproperty="java.result" ... >

...

</java>

<if>
  <not>
    <equals arg1="${java.result}" arg2="0"/>
  </not>
  <then>
    <fail message="TESTS FAILED"/>
  </then>
</if>

 

все, нашел, если кому-то понадобится то я заменил  <testng> на     <testng failureProperty="tests.failed" haltOnFailure="true">

Создала в Eclipse build.xml, запускает и прогоняет тесты нормально, а Jenkins выдает ошибку. В чем может быть дело?

[Ant example] $ cmd.exe /C '"C:\Tools\apache-ant-1.9.3\bin\ant.bat run && exit %%ERRORLEVEL%%"'
Buildfile: C:\Users\Dlt\.jenkins\workspace\Ant example\build.xml
[taskdef] Could not load definitions from resource testngtasks. It could not be found.

BUILD FAILED C:\Users\Dlt\.jenkins\workspace\Ant example\build.xml:137: Problem: failed to create task or type testng
Cause: The name is undefined.

В путях и зависимостях, а также возможно в уровне доступа аккаунта под которым запускается. Покажите build.xml

@polusok

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
              Any modifications will be overwritten.
              To include a user specific buildfile here, simply create one in the same
              directory with the processing instruction <?eclipse.ant.import?>
              as the first entry and export the buildfile again. --><project basedir="." default="build" name="spo">
    <property environment="env"/>
    <property name="M2_REPO" value="../../../Users/Dlt/.m2/repository"/>
    <property name="junit.output.dir" value="junit"/>
    <property name="debuglevel" value="source,lines,vars"/>
    <property name="target" value="1.6"/>
    <property name="source" value="1.6"/>
    <path id="spo.classpath">
        <pathelement location="target/test-classes"/>
        <pathelement location="target/classes"/>
        <pathelement location="${M2_REPO}/org/testng/testng/6.8.8/testng-6.8.8.jar"/>
        <pathelement location="${M2_REPO}/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/>
        <pathelement location="${M2_REPO}/com/beust/jcommander/1.27/jcommander-1.27.jar"/>
        <pathelement location="${M2_REPO}/junit/junit/4.11/junit-4.11.jar"/>
        <pathelement location="${M2_REPO}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
        <pathelement location="${M2_REPO}/org/seleniumhq/selenium/selenium-java/2.40.0/selenium-java-2.40.0.jar"/>
        <pathelement location="${M2_REPO}/org/seleniumhq/selenium/selenium-chrome-driver/2.40.0/selenium-chrome-driver-2.40.0.jar"/>
        <pathelement location="${M2_REPO}/org/seleniumhq/selenium/selenium-remote-driver/2.40.0/selenium-remote-driver-2.40.0.jar"/>
        <pathelement location="${M2_REPO}/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar"/>
        <pathelement location="${M2_REPO}/org/json/json/20080701/json-20080701.jar"/>
        <pathelement location="${M2_REPO}/org/seleniumhq/selenium/selenium-api/2.40.0/selenium-api-2.40.0.jar"/>
        <pathelement location="${M2_REPO}/com/google/guava/guava/14.0/guava-14.0.jar"/>
        <pathelement location="${M2_REPO}/org/apache/httpcomponents/httpclient/4.3.1/httpclient-4.3.1.jar"/>
        <pathelement location="${M2_REPO}/org/apache/httpcomponents/httpcore/4.3/httpcore-4.3.jar"/>
        <pathelement location="${M2_REPO}/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar"/>
        <pathelement location="${M2_REPO}/commons-codec/commons-codec/1.8/commons-codec-1.8.jar"/>
        <pathelement location="${M2_REPO}/org/apache/commons/commons-exec/1.1/commons-exec-1.1.jar"/>
        <pathelement location="${M2_REPO}/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar"/>
        <pathelement location="${M2_REPO}/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar"/>
        <pathelement location="${M2_REPO}/org/seleniumhq/selenium/selenium-htmlunit-driver/2.40.0/selenium-htmlunit-driver-2.40.0.jar"/>
        <pathelement location="${M2_REPO}/net/sourceforge/htmlunit/htmlunit/2.13/htmlunit-2.13.jar"/>
        <pathelement location="${M2_REPO}/xalan/xalan/2.7.1/xalan-2.7.1.jar"/>
        <pathelement location="${M2_REPO}/xalan/serializer/2.7.1/serializer-2.7.1.jar"/>
        <pathelement location="${M2_REPO}/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar"/>
        <pathelement location="${M2_REPO}/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar"/>
        <pathelement location="${M2_REPO}/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar"/>
        <pathelement location="${M2_REPO}/org/apache/httpcomponents/httpmime/4.3.1/httpmime-4.3.1.jar"/>
        <pathelement location="${M2_REPO}/net/sourceforge/htmlunit/htmlunit-core-js/2.13/htmlunit-core-js-2.13.jar"/>
        <pathelement location="${M2_REPO}/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar"/>
        <pathelement location="${M2_REPO}/net/sourceforge/nekohtml/nekohtml/1.9.19/nekohtml-1.9.19.jar"/>
        <pathelement location="${M2_REPO}/net/sourceforge/cssparser/cssparser/0.9.11/cssparser-0.9.11.jar"/>
        <pathelement location="${M2_REPO}/org/w3c/css/sac/1.3/sac-1.3.jar"/>
        <pathelement location="${M2_REPO}/commons-io/commons-io/2.2/commons-io-2.2.jar"/>
        <pathelement location="${M2_REPO}/org/eclipse/jetty/jetty-websocket/8.1.12.v20130726/jetty-websocket-8.1.12.v20130726.jar"/>
        <pathelement location="${M2_REPO}/org/eclipse/jetty/jetty-util/8.1.12.v20130726/jetty-util-8.1.12.v20130726.jar"/>
        <pathelement location="${M2_REPO}/org/eclipse/jetty/jetty-io/8.1.12.v20130726/jetty-io-8.1.12.v20130726.jar"/>
        <pathelement location="${M2_REPO}/org/eclipse/jetty/jetty-http/8.1.12.v20130726/jetty-http-8.1.12.v20130726.jar"/>
        <pathelement location="${M2_REPO}/org/seleniumhq/selenium/selenium-firefox-driver/2.40.0/selenium-firefox-driver-2.40.0.jar"/>
        <pathelement location="${M2_REPO}/org/seleniumhq/selenium/selenium-ie-driver/2.40.0/selenium-ie-driver-2.40.0.jar"/>
        <pathelement location="${M2_REPO}/org/seleniumhq/selenium/selenium-safari-driver/2.40.0/selenium-safari-driver-2.40.0.jar"/>
        <pathelement location="${M2_REPO}/org/webbitserver/webbit/0.4.14/webbit-0.4.14.jar"/>
        <pathelement location="${M2_REPO}/io/netty/netty/3.5.2.Final/netty-3.5.2.Final.jar"/>
        <pathelement location="${M2_REPO}/org/seleniumhq/selenium/selenium-support/2.40.0/selenium-support-2.40.0.jar"/>
        <pathelement location="${M2_REPO}/com/opera/operadriver/1.5/operadriver-1.5.jar"/>
        <pathelement location="${M2_REPO}/com/opera/operalaunchers/1.1/operalaunchers-1.1.jar"/>
        <pathelement location="${M2_REPO}/com/google/protobuf/protobuf-java/2.4.1/protobuf-java-2.4.1.jar"/>
        <pathelement location="${M2_REPO}/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar"/>
        <pathelement location="${M2_REPO}/org/ini4j/ini4j/0.5.2/ini4j-0.5.2.jar"/>
        <pathelement location="${M2_REPO}/com/github/detro/ghostdriver/phantomjsdriver/1.1.0/phantomjsdriver-1.1.0.jar"/>
    </path>
    <target name="init">
        <mkdir dir="target/test-classes"/>
        <mkdir dir="target/classes"/>
        <copy includeemptydirs="false" todir="target/test-classes">
            <fileset dir="src/test/java">
                <include name="**/*.java"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
        <copy includeemptydirs="false" todir="target/test-classes">
            <fileset dir="src/test/resources">
                <exclude name="**/*.java"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
        <copy includeemptydirs="false" todir="target/classes">
            <fileset dir="src/main/java">
                <include name="**/*.java"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
        <copy includeemptydirs="false" todir="target/classes">
            <fileset dir="src/main/resources">
                <exclude name="**/*.java"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
    </target>
    <target name="clean">
        <delete dir="target/test-classes"/>
        <delete dir="target/classes"/>
    </target>
    <target depends="clean" name="cleanall"/>
    <target depends="build-subprojects,build-project" name="build"/>
    <target name="build-subprojects"/>
    <target depends="init" name="build-project">
        <echo message="${ant.project.name}: ${ant.file}"/>
        <javac debug="true" debuglevel="${debuglevel}" destdir="target/test-classes" includeantruntime="false" source="${source}" target="${target}">
            <src path="src/test/java"/>
            <src path="src/test/resources"/>
            <include name="**/*.java"/>
            <exclude name="**/*.java"/>
            <classpath refid="spo.classpath"/>
        </javac>
        <javac debug="true" debuglevel="${debuglevel}" destdir="target/classes" includeantruntime="false" source="${source}" target="${target}">
            <src path="src/main/java"/>
            <src path="src/main/resources"/>
            <include name="**/*.java"/>
            <exclude name="**/*.java"/>
            <classpath refid="spo.classpath"/>
        </javac>
    </target>
    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
    <target name="EquipmentCreate (2)">
        <mkdir dir="${junit.output.dir}"/>
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="xml"/>
            <test name="FirstLineSoftware.pages.EquipmentCreate" todir="${junit.output.dir}"/>
            <classpath refid="spo.classpath"/>
        </junit>
    </target>
    <target name="junitreport">
        <junitreport todir="${junit.output.dir}">
            <fileset dir="${junit.output.dir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report format="frames" todir="${junit.output.dir}"/>
        </junitreport>
    </target>
              	<taskdef resource="testngtasks" classpath="${M2_REPO}/org/testng/testng/6.8.8/testng-6.8.8.jar"></taskdef>
              	<target name="run" depends="build"></target>
              	<testng><classpath refid="spo.classpath" />
              	<xmlfileset dir="." includes="package.xml" />
              	</testng>

</project>