### Eclipse Workspace Patch 1.0
#P net.sf.swtbot.build
Index: libs/junit-4.4.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: libs\junit-4.4.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
#P examples
Index: .project
===================================================================
--- .project (revision 0)
+++ .project (revision 0)
@@ -0,0 +1,11 @@
+
+
+ examples
+
+
+
+
+
+
+
+
#P net.sf.swtbot.finder
Index: .classpath
===================================================================
--- .classpath (revision 1233)
+++ .classpath (working copy)
@@ -1,11 +1,12 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
Index: src/net/sf/swtbot/SWTBotRunner.java
===================================================================
--- src/net/sf/swtbot/SWTBotRunner.java (revision 0)
+++ src/net/sf/swtbot/SWTBotRunner.java (revision 0)
@@ -0,0 +1,41 @@
+package net.sf.swtbot;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import net.sf.swtbot.utils.ClassUtils;
+
+import org.junit.internal.runners.InitializationError;
+import org.junit.internal.runners.JUnit4ClassRunner;
+import org.junit.internal.runners.TestMethod;
+
+public class SWTBotRunner extends JUnit4ClassRunner {
+
+ public SWTBotRunner(Class> klass) throws InitializationError {
+ super(klass);
+ }
+
+ @Override
+ protected TestMethod wrapMethod(final Method method) {
+ return new TestMethod(method, getTestClass()) {
+ @Override
+ public void invoke(Object test) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
+ try {
+ method.invoke(test);
+ } catch (Throwable e) {
+ captureScreenshot();
+ throw new InvocationTargetException(e);
+ }
+ }
+ };
+ }
+
+ private void captureScreenshot() {
+ String fileName = "screenshots/screenshot-" + ClassUtils.simpleClassName(getClass()) + "." + getName() + ".png";
+ new File("screenshots").mkdirs();
+ SWTBotTestCase.captureScreenshot(fileName);
+ }
+
+}
+