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目录。 –