diff options
| author | J08nY | 2018-05-28 21:45:19 +0200 |
|---|---|---|
| committer | J08nY | 2018-05-28 21:45:19 +0200 |
| commit | 298ffc18e590d07eb04d2c5c2b1d553f8fba71bd (patch) | |
| tree | 3eccc379deb68a920951cc29c7bcb17368933fde /src/cz/crcs/ectester/standalone/output/XMLTestWriter.java | |
| parent | a4e52b21b1dad5f96df409c44e5b4d611bba01b9 (diff) | |
| download | ECTester-298ffc18e590d07eb04d2c5c2b1d553f8fba71bd.tar.gz ECTester-298ffc18e590d07eb04d2c5c2b1d553f8fba71bd.tar.zst ECTester-298ffc18e590d07eb04d2c5c2b1d553f8fba71bd.zip | |
Implement tracking and writing of exceptions in standalone tests.
Diffstat (limited to '')
| -rw-r--r-- | src/cz/crcs/ectester/standalone/output/XMLTestWriter.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/cz/crcs/ectester/standalone/output/XMLTestWriter.java b/src/cz/crcs/ectester/standalone/output/XMLTestWriter.java index 9332759..1458a12 100644 --- a/src/cz/crcs/ectester/standalone/output/XMLTestWriter.java +++ b/src/cz/crcs/ectester/standalone/output/XMLTestWriter.java @@ -104,10 +104,22 @@ public class XMLTestWriter extends BaseXMLTestWriter { return result; } + private String causeObject(Object cause) { + if (cause == null) { + return ""; + } else if (cause instanceof Exception) { + Exception ex = ((Exception) cause); + return ex.getClass().getCanonicalName() + " : " + ex.getMessage(); + } else { + return cause.toString(); + } + } + @Override protected Element testableElement(Testable t) { Element result = doc.createElement("test"); if (t instanceof StandaloneTestable) { + StandaloneTestable<?> testable = (StandaloneTestable) t; if (t instanceof KeyGeneratorTestable) { result.setAttribute("type", "key-pair-generator"); result.appendChild(kgtElement((KeyGeneratorTestable) t)); @@ -118,7 +130,10 @@ public class XMLTestWriter extends BaseXMLTestWriter { result.setAttribute("type", "signature"); result.appendChild(sigElement((SignatureTestable) t)); } - result.appendChild(stageElement((StandaloneTestable) t)); + result.appendChild(stageElement(testable)); + Element exception = doc.createElement("exception"); + exception.setTextContent(causeObject(testable.getException()) + causeObject(testable.errorCause())); + result.appendChild(exception); } return result; } |
