Skip to content

Commit

Permalink
Make logging of skipped tests less verbose in the build (#1397)
Browse files Browse the repository at this point in the history
Override parameterized test names to make logging of skipped tests less verbose
  • Loading branch information
antvaset authored Aug 2, 2024
1 parent f06fabe commit dfafdb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public static Object[][] dataMethod() {
for (Group group : loadTestsFile(file).getGroup()) {
for (org.hl7.fhirpath.tests.Test test : group.getTest()) {
if (!"2.1.0".equals(test.getVersion())) { // unsupported version
testsToRun.add(new Object[] {file, group, test});
var name = getTestName(file, group, test);
testsToRun.add(new Object[] {name, test});
}
}
}
Expand Down Expand Up @@ -146,17 +147,16 @@ public static Object[][] dataMethod() {
"stu3/tests-fhir-r3/testWhere(Patient.name.where(given = 'Jim').count() = 1)",
"stu3/tests-fhir-r3/testWhere(Patient.name.where(given = 'X').count() = 0)");

public String getTestName(String file, Group group, org.hl7.fhirpath.tests.Test test) {
public static String getTestName(String file, Group group, org.hl7.fhirpath.tests.Test test) {
return file.replaceAll(".xml", "")
+ "/" + group.getName()
+ (test.getName() != null ? "/" + test.getName() : "")
+ "(" + test.getExpression().getValue() + ")";
}

@ParameterizedTest
@ParameterizedTest(name = "{0}")
@MethodSource("dataMethod")
void test(String file, Group group, org.hl7.fhirpath.tests.Test test) throws UcumException {
var name = getTestName(file, group, test);
void test(String name, org.hl7.fhirpath.tests.Test test) throws UcumException {
Assumptions.assumeFalse(SKIP.contains(name), "Skipping " + name);
runTest(test, "stu3/input/", fhirContext, provider, fhirModelResolver);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public static Object[][] dataMethod() {
for (Group group : loadTestsFile(file).getGroup()) {
for (org.hl7.fhirpath.tests.Test test : group.getTest()) {
if (!"2.1.0".equals(test.getVersion())) { // unsupported version
testsToRun.add(new Object[] {file, group, test});
var name = getTestName(file, group, test);
testsToRun.add(new Object[] {name, test});
}
}
}
Expand Down Expand Up @@ -273,18 +274,17 @@ public static Object[][] dataMethod() {
"r4/tests-fhir-r4/testWhere/testWhere3",
"r4/tests-fhir-r4/testWhere/testWhere4");

public String getTestName(String file, Group group, org.hl7.fhirpath.tests.Test test) {
public static String getTestName(String file, Group group, org.hl7.fhirpath.tests.Test test) {
return file.replaceAll(".xml", "") + "/" + group.getName()
+ "/"
+ (test.getName() != null
? test.getName()
: test.getExpression().getValue());
}

@ParameterizedTest
@ParameterizedTest(name = "{0}")
@MethodSource("dataMethod")
void test(String file, Group group, org.hl7.fhirpath.tests.Test test) throws UcumException {
var name = getTestName(file, group, test);
void test(String name, org.hl7.fhirpath.tests.Test test) throws UcumException {
Assumptions.assumeFalse(SKIP.contains(name), "Skipping " + name);
runTest(test, "r4/input/", fhirContext, provider, fhirModelResolver);
}
Expand Down

0 comments on commit dfafdb9

Please sign in to comment.