51Testing软件测试论坛
标题:
ant调用junit报错了,求大神指导
[打印本页]
作者:
hustar0102
时间:
2016-6-30 10:57
标题:
ant调用junit报错了,求大神指导
ant脚本
<?xml version="1.0" encoding="UTF-8" ?>
<project name="tibim" default="jar" basedir=".">
<description>
building tibim project!
</description>
<!-- set global properties for this build -->
<property name="src" location="src" />
<property name="classDir" location="target/classes" />
<property name="testlog" location="testlog" />
<property name="testloghtml" location="${testlog}/html" />
<property name="dist" location="War_Package" />
<property name="dir" location="." />
<property name="lib" location="lib" />
<property name="extrlib" location="E:\antspace\tibim2\webapps\web\WEB-INF\lib" />
<target name="clean" description="clean up">
<delete dir="${classDir}" />
<delete dir="${testlog}" />
<delete dir="${dist}" />
</target>
<path id="compile.classpath">
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${extrlib}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="init" depends="clean">
<!-- Create the classes directory structure used by compile -->
<mkdir dir="${classDir}" />
<mkdir dir="${testlog}" />
<mkdir dir="${testloghtml}" />
<mkdir dir="${dist}" />
</target>
<target name="build" depends="init" description="build the source code">
<!-- Compile the java code from ${src} into ${classDir} -->
<javac destdir="${classDir}" noWarn="true" source="1.8" fork="true" memoryMaximumSize="500M" includeAntRuntime="false" encoding="UTF-8">
<classpath refid="compile.classpath" />
<src path="${src}"/>
</javac>
<!-- copy -->
<copy todir="${classDir}">
<fileset dir="${src}">
<patternset>
<exclude name="**/*.java" />
<exclude name="**/*.bak" />
</patternset>
</fileset>
</copy>
</target>
<target name="jar" depends="build,test,test-report" description="generate the distribution">
<!-- Put everything in ${classDir} into the war file -->
<jar destfile="${dist}/tibim.jar" basedir="${classDir}">
</jar>
</target>
<target name="test" depends="build" description="Run unit tests">
<junit printsummary="on" haltonerror="off" haltonfailure="off" fork="off" failureproperty="test.failures">
<formatter type="xml" usefile="on" />
<batchtest todir="${testlog}">
<fileset dir="${classDir}">
<include name="**/TEST/**.class"/>
</fileset>
</batchtest>
<classpath refid="compile.classpath"></classpath>
</junit>
</target>
<target name="test-report" depends="test" description="generate HTML unit test reports">
<junitreport todir="${testlog}">
<fileset dir="${testlog}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${testloghtml}" />
</junitreport>
<fail if="test.failures" message="There were test failures."/>
</target>
</project>
报错如下图
[attach]101678[/attach]
找不到com.thit.tibim.TEST.ALLTessts。而代码里有的是com.thit.tibim.TEST.ALLTests。多了个字母s。
[attach]101679[/attach]这里多了个字母X
后面每个类都报错了,都是多了一个字母。
这写单元测试在eclipse执行是成功的,只有在ant执行它时报错
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2