Skip to content

Commit 6251d0c

Browse files
authored
Small logging improvements for spec tests. (#1373)
- Include the file name in the error message of a failed spec test. - Log the total pass and skip count after running all spec tests.
1 parent f79cf6b commit 6251d0c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

firebase-firestore/src/test/java/com/google/firebase/firestore/spec/SpecTestCase.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,8 +1109,7 @@ public void testSpecTests() throws Exception {
11091109
parsedSpecFiles.add(new Pair<>(f.getName(), fileJSON));
11101110
}
11111111

1112-
String testNameFilterFromSystemProperty =
1113-
emptyToNull(System.getProperty(TEST_FILTER_PROPERTY));
1112+
String testNameFilterFromSystemProperty = emptyToNull(System.getProperty(TEST_FILTER_PROPERTY));
11141113
Pattern testNameFilter;
11151114
if (testNameFilterFromSystemProperty == null) {
11161115
testNameFilter = null;
@@ -1119,6 +1118,9 @@ public void testSpecTests() throws Exception {
11191118
testNameFilter = Pattern.compile(testNameFilterFromSystemProperty);
11201119
}
11211120

1121+
int testPassCount = 0;
1122+
int testSkipCount = 0;
1123+
11221124
for (Pair<String, JSONObject> parsedSpecFile : parsedSpecFiles) {
11231125
String fileName = parsedSpecFile.first;
11241126
JSONObject fileJSON = parsedSpecFile.second;
@@ -1157,18 +1159,21 @@ public void testSpecTests() throws Exception {
11571159
info("Spec test: " + name);
11581160
runSteps(steps, config);
11591161
ranAtLeastOneTest = true;
1162+
testPassCount++;
11601163
} catch (AssertionError e) {
1161-
throw new AssertionError("Spec test failure: " + name, e);
1164+
throw new AssertionError("Spec test failure: " + name + " (" + fileName + ")", e);
11621165
}
11631166
long end = System.currentTimeMillis();
11641167
if (measureRuntime) {
11651168
info("Runtime: " + (end - start) + " ms");
11661169
}
11671170
} else {
1171+
testSkipCount++;
11681172
info(" [SKIPPED] Spec test: " + name);
11691173
}
11701174
}
11711175
}
1176+
info(getClass().getName() + " completed; pass=" + testPassCount + " skip=" + testSkipCount);
11721177
assertTrue(ranAtLeastOneTest);
11731178
}
11741179

0 commit comments

Comments
 (0)