我目前正在编写 Fest Junit 测试用例,稍后将在 Hudson 测试服务器上运行。如果任何测试用例失败,我想让他们拍摄桌面屏幕截图。我发现这个网址有一个关于如何设置它的教程:http: //fest.codehaus.org/Taking+Screenshots+of+JUnit+Test+Failures但测试甚至不在本地运行。
这是我尝试运行的 java 代码的简要副本:
@RunWith(GUITestRunner.class)
public class AddingNewUserTest extends FestTest {
@Before
public void setup(){
super.setup(constants.users.name);
}
@After
public void cleanup(){super.shutDown();
}
@GUITest
public void testAddingNewUser() throws InterruptedException{
//java code
}
还有我试图运行的 JUnit Ant 任务:
<target name="run.tests" description="Runs all the junit tests.">
<echo message="Run the tests"/>
<taskdef resource="festjunittasks" classpathref="classpath" />
<junit printsummary="true" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="yes">
<classpath refid="classpath" />
<formatter classname="org.fest.swing.junit.ant.ScreenshotOnFailureResultFormatter" extension=".xml" />
<batchtest todir="${test.output.reports.test.dir}" unless="testcase" fork="true">
<fileset dir="${output.mainclasses.dir}" includes="**/AddingNewUserTest.class" excludes="**/FestTest.class,**/DefaultsTest.class"/>
</batchtest>
</junit>
<festreport todir="${test.output.reports.dir}">
<classpath refid="classpath" />
<fileset dir="${test.output.reports.test.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${test.output.reports.dir}/html" />
</festreport>
<antcall target="kill.server"/>
</target>
任何帮助都会很棒。
Junit在报告中抛出的错误截图