Есть отличная удаленная работа для php+codeception+jenkins+allure+docker спецов. 100% remote! Присоединиться к проекту

Java + SeleniumWD + TestNG + Ant не могу подружить

webdriver
testng
java
Теги: #<Tag:0x00007f7b64ee44e0> #<Tag:0x00007f7b64ee43a0> #<Tag:0x00007f7b64ee4260>

(Алексей Якуничкин) #1

Добрый день, коллеги!
Никак не удается разобраться с этой связкой, а точнее собрать проект удалось (правда не уверен, что всё верно, но ошибок нет), а вот запустить пока не удается:

   [testng] [TestNGClassFinder] Warning: Can't link and determine methods of class test.cases.NewTP_CheckElements
   [testng] [[TestNGClassFinder]] Unable to read methods on class test.cases.NewTP_CheckElements - unable to resolve class reference org/apache/avalon/framework/configuration/ConfigurationException

Файл build.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!--========================================================================
                            Properties
=========================================================================-->

<property name="src.dir" location="${basedir}/src"/>
<property name="bin.dir" value="${basedir}/bin"/>
<property name="lib.dir" location="${basedir}/lib"/>
<property name="release.dir" value="${basedir}/release/"/>
<property name="xml.dir" value="${basedir}/projects/NewTP/test/"/>
<property name="log.dir" value="${basedir}/projects/NewTP/log/"/>
<property name="build.dir" value="${release.dir}/bin/"/>
<property name="eclipse.lib.dir" value="${ECLIPSE_HOME}plugins/org.testng.eclipse_6.9.11.201604020423/lib/" />
<property name="TestNG.report.dir" value="${build.dir}/TestNGreport"/>


<!--========================================================================
                            Creating folders
=========================================================================-->
    
<target name = "MakeDirs" description = "Making of the auxillary dirs">
    <mkdir dir="${log.dir}"/>
    <mkdir dir="${release.dir}"/>
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${release.dir}/projects/"/>
    <mkdir dir="${release.dir}/projects/NewTP/"/>
    <mkdir dir="${release.dir}/projects/NewTP/test/"/>
    <mkdir dir="${release.dir}/projects/NewTP/log/"/>
</target>

<!--========================================================================
                            Classpath
=========================================================================-->
<path id="classpath">
        <pathelement path="${classpath}"/>
        <pathelement location="${lib.dir}/selenium-java-2.53.0.jar"/>
        <pathelement location="${lib.dir}/selenium-server-standalone-2.53.0.jar"/>
        <pathelement location="${lib.dir}/avalon-framework-4.1.4.jar"/>
        <pathelement location="${lib.dir}/testng-6.8.7-sources.jar"/>
        <pathelement location="${lib.dir}/testng-6.8.7.jar"/>
        <pathelement location="${eclipse.lib.dir}testng.jar"/>
        <pathelement location="${eclipse.lib.dir}jcommander.jar"/>
           <pathelement location="${eclipse.lib.dir}bsh-2.0b4.jar"/>
           <pathelement location="${eclipse.lib.dir}snakeyaml.jar"/>
</path>
    
<!--========================================================================
                               Copy
=========================================================================-->  

<copy todir="${release.dir}/projects/NewTP/test/">
    <fileset dir="${xml.dir}" includes="*.xml"/>
</copy>
<copy todir="${release.dir}">
    <fileset dir="${basedir}" includes="*.properties"/>
    <fileset dir="${basedir}" includes="*.xml"/>
</copy>

<!--========================================================================
                        Compilation of the classes
=========================================================================-->

<target name = "compile" description = "Compilation of the classes" depends="MakeDirs">
    <javac includeantruntime = "false" srcdir="${src.dir}" destdir="${build.dir}" debug="off">
        <classpath id="classpath">
            <fileset dir="${lib.dir}">
                <include name="selenium-java-2.53.0.jar"/>
                <include name="selenium-server-standalone-2.53.0.jar"/>
                <include name="avalon-framework-4.1.4.jar"/>
                <include name="testng-6.8.7-sources.jar"/>
                <include name="testng-6.8.7.jar"/>
            </fileset>
        </classpath>
    </javac>
</target>

<!--========================================================================
                               TESTING
=========================================================================-->  
<taskdef resource="testngtasks" classpathref="classpath"/>
<target name="testng" description="Start tests" depends="compile">
        <mkdir dir="${TestNG.report.dir}"/>
        <testng haltonfailure="true" outputdir="${TestNG.report.dir}" >
            <classpath>
                <path id="classpath" />
                <pathelement location="${TestNG.report.dir}" />
                <pathelement location="${build.dir}" />
            </classpath>
            <classfileset dir="${build.dir}">
            </classfileset>
            <xmlfileset dir="${basedir}" includes="testng.xml"/>
        </testng>
</target>

Файл testng.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Default suite">
<parameter name="configFile" value="NewTP_application.properties"></parameter>
  <test verbose="2" name="NewTP_CheckElements">
    <classes>
      <class name="test.cases.NewTP_CheckElements"/>
    </classes>
</test>
</suite>

(Ray Romanov) #3

Первое, что я не увидел в build.xml, это:
<target name="build" depends="................" />