51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 3301|回复: 0

ant调用junit报错了,求大神指导

[复制链接]
  • TA的每日心情
    无聊
    2016-7-1 15:17
  • 签到天数: 16 天

    连续签到: 2 天

    [LV.4]测试营长

    发表于 2016-6-30 10:57:31 | 显示全部楼层 |阅读模式
    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>



    报错如下图

    找不到com.thit.tibim.TEST.ALLTessts。而代码里有的是com.thit.tibim.TEST.ALLTests。多了个字母s。
    这里多了个字母X
    后面每个类都报错了,都是多了一个字母。
    这写单元测试在eclipse执行是成功的,只有在ant执行它时报错

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

    x
    回复

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-3-29 16:23 , Processed in 0.069380 second(s), 24 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表