Note that there are some explanatory texts on larger screens.

plurals
  1. POwhy my test case under ant always runs twice?
    primarykey
    data
    text
    <p>I'm try to configured webdriver+testNG working with Ant. It's a simple test case, launch FF and open <a href="http://www.google.com" rel="nofollow">http://www.google.com</a>. But when I executed the build.xml with ant,the test case executed twice! It's puzzle to me, I suspect something wrong in "Ant suite", and I don't know how to disable it.here is my code.</p> <p>Eclipse Console output:</p> <pre><code> init: compile: [javac] D:\Workspace\HelloAnt\build.xml:23: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds run_tests: [echo] running tests [testng] ... [testng] ... TestNG 6.8beta 20120825_1010 by C?dric Beust (cedric@beust.com) [testng] ... [testng] [TestNG] Running: [testng] D:\Workspace\HelloAnt\src\example\testng.xml [testng] =============================================== [testng] reportng demo [testng] Total tests run: 1, Failures: 0, Skips: 0 [testng] =============================================== [testng] [TestNG] Running: [testng] Ant suite [testng] =============================================== [testng] Ant suite [testng] Total tests run: 1, Failures: 0, Skips: 0 [testng] =============================================== [echo] zip [zip] Building zip: D:\Workspace\HelloAnt\test-output\html.zip BUILD SUCCESSFUL Total time: 38 seconds </code></pre> <p>testng.xml code:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;suite name="reportng demo" verbose="2"&gt; &lt;test name="test"&gt; &lt;classes&gt; &lt;class name="example.NewTest"&gt; &lt;methods&gt; &lt;include name="setup"/&gt; &lt;include name="verifyTitle"/&gt; &lt;include name="clean"/&gt; &lt;/methods&gt; &lt;/class&gt; &lt;/classes&gt; &lt;/test&gt; &lt;/suite&gt; </code></pre> <p>and the build.xml code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;project name="HelloReportng" default="run_tests" basedir="."&gt; &lt;property name="src" value="src" /&gt; &lt;property name="dest" value="classes" /&gt; &lt;property name="hello_jar" value="NewTest.jar" /&gt; &lt;property name="lib.dir" value="lib" /&gt; &lt;property name="output.dir" value="test-output"/&gt; &lt;property name="testng.dir" value="D:/Workspace/testng.jar"/&gt; &lt;!-- import testng jar package --&gt; &lt;taskdef resource="testngtasks" classpath="${testng.dir}"/&gt; &lt;path id="test.classpath"&gt; &lt;fileset dir="${lib.dir}" includes="*.jar"/&gt; &lt;pathelement path="${dest}"/&gt; &lt;/path&gt; &lt;target name="init"&gt; &lt;mkdir dir="${dest}" /&gt; &lt;/target&gt; &lt;target name="compile" depends="init"&gt; &lt;javac srcdir="${src}" destdir="${dest}" &gt; &lt;classpath refid="test.classpath"/&gt; &lt;/javac&gt; &lt;/target&gt; &lt;target name="compress" depends="compile"&gt; &lt;jar jarfile="${hello_jar}" basedir="${dest}" /&gt; &lt;/target&gt; &lt;target name="run" depends="compress"&gt; &lt;java classname="example.NewTest" &gt; &lt;classpath refid="test.classpath"/&gt; &lt;/java&gt; &lt;/target&gt; &lt;target name ="clean"&gt; &lt;delete dir="${dest}" /&gt; &lt;delete dir="${hello_jar}" /&gt; &lt;/target&gt; &lt;target name="return" depends="clean"&gt; &lt;ant target="clean" /&gt; &lt;ant target="run" /&gt; &lt;/target&gt; &lt;!-- run tests --&gt; &lt;target name="run_tests" depends="compile"&gt; &lt;echo&gt;running tests&lt;/echo&gt; &lt;testng classpathref="test.classpath" outputdir="${output.dir}" haltonfailure="true" usedefaultlisteners="false" listeners="org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter" failureproperty="test.failed" &gt; &lt;classfileset dir="${dest}" includes="**/*.class" /&gt; &lt;sysproperty key="org.uncommons.reportng.title" value="All Page Tests"&gt;&lt;/sysproperty&gt; &lt;sysproperty key="org.uncommons.reportng.escape-output" value="off"&gt;&lt;/sysproperty&gt; &lt;xmlfileset dir="${src}/example" &gt; &lt;include name="testng.xml" /&gt; &lt;/xmlfileset&gt; &lt;/testng&gt; &lt;echo&gt;zip&lt;/echo&gt; &lt;zip destfile="${output.dir}/html.zip" basedir="test-output/html" includes="**/*"&gt;&lt;/zip&gt; &lt;fail message="test failed.." if="test.failed" /&gt; &lt;/target&gt; &lt;/project&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload