2
我有這樣的JUnit測試套件,硒測試:如何在Ant中運行JUnit測試套件?
@RunWith(Suite.class)
@SuiteClasses({ Test1.class, Test2.class})
public class TestSuite {
}
我想通過螞蟻運行測試套件,所以我補充這樣的目標:
<property environment="environm"/>
<property name="ROOT_PATH" value="../../../../.."/>
<property name="ECLIPSE" value="${ROOT_PATH}/eclipse-kepler/eclipse"/>
<property name="junit" value="junit"/>
<property name="target" value="1.7"/>
<property name="source" value="1.7"/>
<path id="JUnit.library>
<pathelement location="${ECLIPSE}/plugins/org.junit_4.11.0.v201303080030/junit.jar"/>
<pathelement location="${ECLIPSE}/plugins/org.hamcrest.core_1.3.0.v201303031735.jar"/>
</path>
<path id="Tests.classpath">
<pathelement location="bin"/>
<path refid="JUnit.library"/>
<pathelement location="${ROOT_PATH}/selenium-server-standalone-2.37.0.jar"/>
</path>
<target name="TestSuite">
<mkdir dir="${junit}"/>
<junit fork="yes" printsummary="withOutAndErr">
<sysproperty key="variable" value="${value}"/>
<formatter type="xml"/>
<batchtest todir="${junit}">
<fileset dir="src">
<include name="**/TestSuite.class"/>
</fileset>
</batchtest>
<classpath refid="Tests.classpath"/>
</junit>
</target>
我運行這樣的命令:
ant build TestSuite -Dvariable="value"
但是測試根本不運行。這是輸出:
C:\Selenium>ant build TestSuite -Dvariable="value"
Buildfile: C:\Selenium\build.xml
build-subprojects:
init:
build-project:
[echo] Selenium: C:\Selenium\build.xml
build:
TestSuite:
BUILD SUCCESSFUL
我是新來的螞蟻。我做錯了什麼?
我已經build.xml文件 – khris
更新類路徑,我認爲你的文件集是空的。嘗試使用,因爲您似乎將代碼編譯到bin目錄。 –