From d9ced04bd31e52f1cca1aa6dd0146233cd844d45 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 3 Sep 2013 10:11:37 +0300 Subject: [PATCH] Add check for screenshot parameter and creation of error folder Change-Id: Iaf1c3e4e49b74e1e72d5b43958f8e7ee5b7af4cc --- .../src/com/vaadin/tests/tb3/PrivateTB3Configuration.java | 7 ++++++- uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java index 3ad0fba68b..b908786036 100644 --- a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java +++ b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java @@ -54,7 +54,12 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { @Override protected String getScreenshotDirectory() { - return getProperty("com.vaadin.testbench.screenshot.directory"); + String screenshotDirectory = getProperty("com.vaadin.testbench.screenshot.directory"); + if (screenshotDirectory == null) { + throw new RuntimeException( + "No screenshot directory defined. Use -Dcom.vaadin.testbench.screenshot.directory="); + } + return screenshotDirectory; } @Override diff --git a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java index 175c1cef5d..3510fe326c 100644 --- a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java @@ -303,6 +303,11 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { // before running it. Leave unrelated files as-is File errorDirectory = new File(getScreenshotErrorDirectory()); + // Create errors directory if it does not exist + if (!errorDirectory.exists()) { + errorDirectory.mkdirs(); + } + final String errorBase = getScreenshotErrorBaseName() .replace("\\", "/"); File[] files = errorDirectory.listFiles(new FileFilter() { -- 2.39.5