<target name="init" description = "create classes file">
<!--mkdir means : create file:classes-->
<mkdir dir="${dest}" />
</target>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${dest}" classpathref="compile.path" encoding="UTF-8"/>
</target>
<!--run testng ant task-->
<taskdef resource="testngtasks" classpath="${lib.dir}/testng-6.4.jar" />
<target name="start_server_and_run_tests" depends="compile" description="start selenium server and run tests">
<parallel>
<antcall target="run_tests">
</antcall>
</parallel>
</target>
<target name="run_tests" depends="compile">
<testng classpathref="compile.path" failureproperty="test.failed">
<!--xml test suite file -->
<xmlfileset dir="${basedir}">
<include name="testng.xml" />
</xmlfileset>
</testng>
<antcall target="sendReport" />
<fail message="ERROR: test failed!!!!!" if="test.failed" />
</target>
<target name="sendReport">
<delete dir="${dest}"/>
<antcall target="transform" />
</target>
<target name="transform">
<xslt in="${basedir}/test-output/testng-results.xml" style="${basedir}/test-output/testng-results.xsl" out="${basedir}/test-output/index1.html" classpathref="compile.path">
<!-- you need to specify the directory here again -->
<param name="testNgXslt.outputDir" expression="${basedir}/test-output/" />
<param name="testNgXslt.showRuntimeTotals" expression="true"/>
<!--<classpath refid="compile.path" />-->
</xslt>
</target>
</project>
這樣我的整個(gè)環(huán)境搭成了,寫代碼及調(diào)試用了將近一周,而配置實(shí)際上只用了一個(gè)上午;
希望你也能成功;從此不用打開idea直接用jenkins可以搞定了。