我有这样一个用于selenium测试的junit测试套件:
@RunWith(Suite.class)
@SuiteClasses({ Test1.class, Test2.class})
public class TestSuite {
}我想通过ant运行测试套件,所以我添加了这样的目标:
<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"但是没有在all.This上运行的测试是输出的:
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我是个蚂蚁新手。我做错了什么?
发布于 2014-12-09 16:24:19
如下所示定位类路径
<target name="TestSuite">
<mkdir dir="${junit}"/>
<junit fork="yes" printsummary="withOutAndErr">
<sysproperty key="variable" value="${value}"/>
<formatter type="xml"/>
<classpath refid="Tests.classpath"/>
<batchtest todir="${junit}">
<fileset dir="src">
<include name="**/TestSuite.class"/>
</fileset>
</batchtest>
</junit>
https://stackoverflow.com/questions/20248924
复制相似问题