0

I am currently writing Fest Junit test cases that will be later ran on a Hudson test server. I would like to have them take desktop screen shots if any test case fails. I found this url that has a tutorial on how to set this up: http://fest.codehaus.org/Taking+Screenshots+of+JUnit+Test+Failures but the tests don't even run locally.

Here is a skimmed down copy of the java code that I am attempting to run:

@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
}

And my JUnit Ant task that I am attempting to run:

<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>

Any help would be great.

enter image description here

A screen shot of the error thrown by Junit in the report

wmgeiger101x
  • 153
  • 3
  • 12

1 Answers1

0

Here is a quick solution that I found after stumbling upon some source code on the internet (if anyone stumbles upon this thread): the java code:

@GUITest
public void testAddingNewUser() throws InterruptedException{
      //java code

needed to be

@Test
@GUITest
public void testAddingNewUser() throws InterruptedException{
      //java code

Everything else seemed to be correct

wmgeiger101x
  • 153
  • 3
  • 12