Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify test counts in TCK documentation #484

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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