X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Ftest%2FTestLauncher.java;h=895b565ae0f607522e494d92c8bc87541c672f51;hb=a97f9702eae2b51ee64a163f92ec4d72a216e958;hp=3741e976a54dada71bb9fa37f3fa7a07f5e5cafa;hpb=0988831f084e27de9927c1bb29e338e9263bfa42;p=fanfix.git diff --git a/src/be/nikiroo/utils/test/TestLauncher.java b/src/be/nikiroo/utils/test/TestLauncher.java index 3741e97..895b565 100644 --- a/src/be/nikiroo/utils/test/TestLauncher.java +++ b/src/be/nikiroo/utils/test/TestLauncher.java @@ -40,6 +40,8 @@ public class TestLauncher { private List series; private List tests; + private TestLauncher parent; + private int columns; private String okString; private String koString; @@ -50,6 +52,7 @@ public class TestLauncher { protected int total; private int currentSeries = 0; + private boolean details = false; /** * Create a new {@link TestLauncher} with default parameters. @@ -90,13 +93,39 @@ public class TestLauncher { cont = true; } + /** + * Display the details of the errors + * + * @return TRUE to display them, false to simply mark the test as failed + */ + public boolean isDetails() { + if (parent != null) { + return parent.isDetails(); + } + + return details; + } + + /** + * Display the details of the errors + * + * @param details + * TRUE to display them, false to simply mark the test as failed + */ + public void setDetails(boolean details) { + if (parent != null) { + parent.setDetails(details); + } + + this.details = details; + } + /** * Called before actually starting the tests themselves. * * @throws Exception * in case of error */ - @SuppressWarnings("unused") protected void start() throws Exception { } @@ -106,7 +135,6 @@ public class TestLauncher { * @throws Exception * in case of error */ - @SuppressWarnings("unused") protected void stop() throws Exception { } @@ -116,6 +144,7 @@ public class TestLauncher { protected void addSeries(TestLauncher series) { this.series.add(series); + series.parent = this; } /** @@ -306,12 +335,14 @@ public class TestLauncher { private void print(int depth, Throwable error) { if (error != null) { System.out.println(" " + koString); - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - error.printStackTrace(pw); - String lines = sw.toString(); - for (String line : lines.split("\n")) { - System.out.println(prefix(depth, false) + "\t\t" + line); + if (isDetails()) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + error.printStackTrace(pw); + String lines = sw.toString(); + for (String line : lines.split("\n")) { + System.out.println(prefix(depth, false) + "\t\t" + line); + } } } else { System.out.println(" " + okString);