栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

JUnit4测试类是否需要公共的无参数构造函数?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

JUnit4测试类是否需要公共的无参数构造函数?

谢谢大家的时间和回答。我现在找到了解决方案。以前,我认为我的ant目标的batchtest部分的输入应该是.class文件,但也可以使用.java文件。

那解决了问题。现在,它不再抱怨内部类缺少公共构造函数。

<target name="junit" description="Execute unit tests"> <delete dir="tmp/rawtestoutput"/> <delete dir="test-reports"/>    <mkdir dir="tmp/rawtestoutput"/>         <junit printsummary="on" failureproperty="junit.failure" fork="true">      <jvmarg value="-Duser=TBA -Dpassword=ibber11"/>        <classpath refid="class.path.test"/>        <classpath refid="class.path.model"/>        <classpath refid="class.path.gui"/>        <classpath refid="class.path.jfreereport"/>     <classpath path="tmp/${test.jar}"/>      <batchtest todir="tmp/rawtestoutput">        <fileset dir="src/test"> <include name="**SessionHelper.java"/>         <exclude name="**/TestHelper.java"/>        </fileset>      </batchtest>     <sysproperty key="user" value="tba"/>     <sysproperty key="password" value="ibber11"/>    </junit>    <junitreport todir="tmp">      <fileset dir="tmp/rawtestoutput"/>      <report todir="test-reports"/>    </junitreport>    <fail if="junit.failure" message="Unit test(s) failed.  See reports!"/></target>

我现在唯一的问题是,必须过滤掉没有测试的测试类,以免出现“无可运行方法”错误。也就是说,helper和util类。

助手类不包含@Test注释。必须有可能以某种方式利用这一点…



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/498441.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号