Browse Source

PityTest: TestUnit fix bug, not displaying exception on CTX_FAIL

JNI-118
heck 5 years ago
parent
commit
3cfe31f3e4
  1. 11
      test/java/foundation/pEp/pitytest/TestUnit.java

11
test/java/foundation/pEp/pitytest/TestUnit.java

@ -90,7 +90,11 @@ public class TestUnit<T extends TestContextInterface> implements Runnable {
} }
public Throwable getLastException() { public Throwable getLastException() {
return lastException; Throwable ret = new Throwable("No Exception caught");
if(lastException != null) {
ret = lastException;
}
return ret;
} }
public TestUnit<T> add(TestSuite suite) { public TestUnit<T> add(TestSuite suite) {
@ -115,7 +119,7 @@ public class TestUnit<T extends TestContextInterface> implements Runnable {
public void run() { public void run() {
TestUtils.standardOutErrEnabled(verboseMode); TestUtils.standardOutErrEnabled(verboseMode);
if (ctx.isUninitializable()) { if (ctx.isUninitializable()) {
setTestState(TestState.CTX_FAIL); setTestState(TestState.SKIPPED);
TestUtils.standardOutErrEnabled(true); TestUtils.standardOutErrEnabled(true);
} else { } else {
try { try {
@ -177,7 +181,6 @@ public class TestUnit<T extends TestContextInterface> implements Runnable {
} }
case CTX_FAIL: { case CTX_FAIL: {
setTestResult(TestState.SKIPPED); setTestResult(TestState.SKIPPED);
// logH1(makeLogString());
break; break;
} }
} }
@ -188,7 +191,7 @@ public class TestUnit<T extends TestContextInterface> implements Runnable {
result = r; result = r;
TestUtils.standardOutErrEnabled(true); TestUtils.standardOutErrEnabled(true);
logH1(makeLogString()); logH1(makeLogString());
if (result == TestState.FAILED || result == TestState.CTX_FAIL) { if (result == TestState.FAILED || state == TestState.CTX_FAIL) {
log("ERROR: " + getLastException().toString()); log("ERROR: " + getLastException().toString());
} }
if (verboseMode) logRaw("\n\n"); if (verboseMode) logRaw("\n\n");

Loading…
Cancel
Save