Build.xml проблема - PullRequest
       14

Build.xml проблема

0 голосов
/ 20 марта 2012

Селен - ANT -TestNG

Я написал build.xml, где он выдает ошибку о том, что «атрибут имени класса элемента taskdef не определен»

Вот мой build.xml

<?xml version="1.0" encoding="UTF-8"?> 
 <project name ="AutomationScripts" default="test" basedir=".">
 <echo message ="Testing selenium server... Plz wait"/>
 <target name="startServer">
 <echo message ="Start selenium server... Plz wait"/>  
 <java jar="..\lib\selenium-server-standalone-2.19.0.jar" fork="true">
 <jvmarg value="-Dhttp.proxyHost=192.168.0.200"/>
 <jvmarg value="-Dhttp.proxyPort=3128"/> </java>
 <echo message ="Started selenium server"/>
 </target>
 <target name="test" depends="startServer">
 <echo message="Test run. Please wait"/>
 <mkdir dir="out" />
 <java classname="RosettastoneMain" classpath="..\AutomationScripts\bin" 
 dir="C:\Program Files\Java\jdk1.6.0_11\bin">
 <classpath>
<fileset dir="..\AutomationScripts\lib" includes="*.*"/>
 </classpatha></java>
 <taskdef name="testng" classpath="org.testng.TestNG">     ---------> It produces 
 error in this stmt 
 <classpath>
 <pathelement location="../lib/testng-6.2.jar"/>
 </classpath>
 </taskdef>
 <property name="testng.output.dir" value="testngOutput"/>
 <path id="classes">
 <fileset dir="../lib">
  <include name="*.jar"/>
 </fileset>
 <pathelement location="${bin.dir}"/>
 </path>
 <mkdir dir="${testng.output.dir}"/>
 <testng outputdir="${testng.output.dir}" classpathref="classes">  
 <xmlfileset dir="." includes="testng.xml"/>  
 </testng> </target>
<target name="stopServer">
 <echo message="stop selenium server. Plz wait"/>
 <get taskname="selenium-shutdown" 
 src="http://localhost:4444/selenium-server-standalone-2.0rc2/driver/?cmd=shutDown"
 dest="./out/sever.stop.status.txt" ignoreerrors="true"/>
</target>
</project>

Может ли кто-нибудь помочь мне заранее спасибо

1 Ответ

0 голосов
/ 06 июля 2012

Вам необходимо указать класс, реализующий тип данных, в атрибуте 'classname'.Согласно документации Ant taskdef (а точнее typedef ), эта задача имеет два обязательных атрибута - 'name' и 'classname', если не указано 'file' или 'resource'указано.Атрибут «classpath» определяет только места, где можно найти класс, указанный в «classname».

...