Skip to content

Commit

Permalink
Clarify test counts
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAure committed May 1, 2024
1 parent 0cedef2 commit 4be78ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ $ mvn clean test

=== Expected Output

Here is example output when the starter runner runs successfully:
Here is example output when the starter runner runs successfully in full mode:

include::generated/expected-output.adoc[]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2023, 2024 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -110,6 +111,10 @@ public static void main(final String[] args) throws Exception {
writeSigOutput(new File(adocGeneratedLocation, SIG_OUTPUT_FILE));
writeOutput(testMetaData, new File(adocGeneratedLocation, EXPECTED_OUTPUT_FILE));
writeGitIgnore(new File(adocGeneratedLocation, ".gitignore"), RUNTIME_TESTS_FILE, CHALLENGED_TESTS_FILE, SIG_OUTPUT_FILE, EXPECTED_OUTPUT_FILE, TEST_PROPERTIES_FILE);

for (TestMetaData data: testMetaData) {
debug(data.debugString());
}
}

/**
Expand Down Expand Up @@ -201,7 +206,7 @@ private static String getIndividualTests(final List<TestMetaData> testMetaData)
* @return String output
*/
private static String getTotalTests(final List<TestMetaData> testMetaData) {
long totalTestCount = testMetaData.stream().filter(metaData -> !metaData.isDisabled).count();
long totalTestCount = testMetaData.stream().count();
long totalDisabledCount = testMetaData.stream().filter(metaData -> metaData.isDisabled).count();

if (totalDisabledCount > 0) {
Expand Down Expand Up @@ -298,9 +303,9 @@ private static void writeTestCounts(final List<TestMetaData> testMetaData, final
String output =
"""
|===
|standalone |core |web |full
|standalone |core |web |full |skipped
|%d |%d |%d |%d
|%d |%d |%d |%d |%d
|===""".formatted(getTestCounts(testMetaData));
try (BufferedWriter writer = new BufferedWriter(new FileWriter(outputLocation))) {
Expand All @@ -317,6 +322,7 @@ private static Object[] getTestCounts(final List<TestMetaData> testMetaData) {
results.add(runnableTestMetaData.stream().filter(TestMetaData::isCore).count());
results.add(runnableTestMetaData.stream().filter(TestMetaData::isWeb).count());
results.add(runnableTestMetaData.stream().filter(TestMetaData::isFull).count());
results.add(testMetaData.stream().filter(Predicate.not(TestMetaData::isRunnable)).count());

return results.toArray();
}
Expand Down Expand Up @@ -472,6 +478,10 @@ boolean isRunnable() {
return !isDisabled;
}

public String debugString() {
return "TestMetaData [testName=" + testName + ", isDisabled=" + isDisabled + ", tags=" + tags + "]";
}

@Override
public String toString() {
return "TestMetaData [testName=" + testName + ", assertion=" + assertion + ", isDisabled=" + isDisabled
Expand Down

0 comments on commit 4be78ce

Please sign in to comment.