UITest: disable screenshots by default

This commit is contained in:
Yuriy Artamonov 2011-08-03 11:55:37 +00:00
parent 607de81bc7
commit 36cc92bde9

View File

@ -56,6 +56,8 @@ public abstract class UITestCase extends TestCase {
private Process clientRunner; private Process clientRunner;
private boolean makeScreenshot = false;
public UITestCase() { public UITestCase() {
super(); super();
} }
@ -79,17 +81,16 @@ public abstract class UITestCase extends TestCase {
StringBuilder info = new StringBuilder(); StringBuilder info = new StringBuilder();
executeTestScript(executorScript, testFileName, errors, info); executeTestScript(executorScript, testFileName, errors, info);
String outDirPath = getOutputPath();
List<UITestStep> testSteps = analyzeTestSteps(info.toString(), errors.toString()); List<UITestStep> testSteps = analyzeTestSteps(info.toString(), errors.toString());
for (UITestStep testStep : testSteps) { int i = 0;
if (!testStep.isSuccess()) { while (i < testSteps.size() && testSteps.get(i).isSuccess()) {
captureScreen(outDirPath + getName() + ".png"); i++;
break;
}
} }
String outDirPath = getOutputPath();
saveLog(testSteps, outDirPath + getName() + ".log"); saveLog(testSteps, outDirPath + getName() + ".log");
if (i < testSteps.size() && makeScreenshot)
captureScreen(outDirPath + getName() + ".png");
return testSteps; return testSteps;
} }
@ -311,4 +312,12 @@ public abstract class UITestCase extends TestCase {
} }
return result; return result;
} }
protected boolean isMakeScreenshot() {
return makeScreenshot;
}
protected void setMakeScreenshot(boolean makeScreenshot) {
this.makeScreenshot = makeScreenshot;
}
} }