[NO ISSUE][*DB][TEST] Minor test framework fixes

Ext-ref: MB-65861
Change-Id: I5cad75b8263f8461a73405531beeb056254ae47e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20023
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Tested-by: Michael Blow <mblow@apache.org>
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
index f9d0efb..8d943bf 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
@@ -2254,16 +2254,22 @@
                         }
                         fail(true, testCaseCtx, cUnit, testFileCtxs, pb, testFile, e);
                     } else {
-                        LOGGER.info("testFile {} raised an (expected) exception", testFile, e.toString());
+                        LOGGER.info("testFile {} raised an (expected) exception: {}", testFile, e.toString());
                     }
                 }
                 if (numOfFiles == testFileCtxs.size()) {
-                    if (testCaseCtx.numOfErrors < cUnit.getExpectedError().size()) {
+                    int numExpectedErrors = cUnit.getExpectedError().size();
+                    if (testCaseCtx.numOfErrors < numExpectedErrors) {
                         LOGGER.error("Test {} failed to raise (an) expected exception(s)", cUnit.getName());
                         throw new Exception(
                                 "Test \"" + cUnit.getName() + "\" FAILED; expected exception was not thrown...");
                     }
                     ensureWarnings(testCaseCtx.expectedWarnings, cUnit);
+                    if (testCaseCtx.numOfErrors > numExpectedErrors) {
+                        LOGGER.error("Test {} raised more exceptions than expected", cUnit.getName());
+                        throw new Exception(
+                                "Test \"" + cUnit.getName() + "\" FAILED; too many exceptions were thrown...");
+                    }
                     LOGGER.info(
                             "[TEST]: " + testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName() + " PASSED ");
                     if (passedGroup != null) {