Skip to content

[test] Extract xml schema module#3976

Merged
adangel merged 20 commits into
pmd:masterfrom
oowekyala:pmd6-extract-test-schema-module
Jul 21, 2022
Merged

[test] Extract xml schema module#3976
adangel merged 20 commits into
pmd:masterfrom
oowekyala:pmd6-extract-test-schema-module

Conversation

@oowekyala

@oowekyala oowekyala commented May 21, 2022

Copy link
Copy Markdown
Member

This is to be able to change the schema (#3302) without needing to update the designer as well. The designer will be able to depend on this module without depending on pmd-test (which itself depends on junit and other things). It also cleans up RuleTst which implemented the parsing adhoc.

There is now a copy of the schema in pmd-test and another in pmd-test-schema. The only functional change to the schema is the introduction of an disabled attribute to replace isRegressionTest (see #3302). isRegressionTest is still supported but produces a deprecation warning.

The PR is currently blocked on #2435. I need a Rule instance to write tests, but there is no language on the classpath. I really really don't want to have to write another dummy language module... update This PR contains #4024, which unblocks it.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • unblock [test] Remove duplicated Dummy language module #2435
  • Think about what APIs to deprecate in pmd-test
    • At least, TestDescriptor (in pmd-test) should be replaced by RuleTestDescriptor (in the new module). Currently changes are minimal in that module
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

oowekyala added 7 commits May 17, 2022 23:34
Need a release of nice-xml-messages
Need an update to pmd-test
Need to add the 'ignored' attribute to schema
(This is backward compatible)
@oowekyala oowekyala mentioned this pull request Jun 25, 2022
4 tasks
<attribute name="regressionTest" type="boolean" default="true"/>
<attribute name="useAuxClasspath" type="boolean" default="true"/>

<attribute name="ignored" type="string" default="">

@oowekyala oowekyala Jul 10, 2022

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo change that to bool, rename to disabled like junit 5

@oowekyala oowekyala added this to the 6.48.0 milestone Jul 13, 2022
@ghost

ghost commented Jul 13, 2022

Copy link
Copy Markdown
1 Message
📖 No regression tested rules have been changed.

Generated by 🚫 Danger

@oowekyala oowekyala marked this pull request as ready for review July 15, 2022 12:00
@adangel adangel self-requested a review July 18, 2022 19:32

@adangel adangel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

I'll do the change "ignored" -> "disabled" and update the release notes

Comment thread pmd-test-schema/pom.xml Outdated
parseBoolAttribute(testCode, "useAuxClasspath", true, err, "Attribute 'useAuxClasspath' is deprecated and ignored, assumed true");

boolean ignored = parseBoolAttribute(testCode, "ignored", false, err, null)
| !parseBoolAttribute(testCode, "regressionTest", true, err, "Attribute ''regressionTest'' is deprecated, use ''ignored'' with inverted value");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI - for this "regressionTest" flag, there is also a System.property that can disable the disabling...

public static boolean inRegressionTestMode() {
boolean inRegressionMode = true; // default
try {
// get the "pmd.regress" System property
String property = System.getProperty("pmd.regress");
if (property != null) {
inRegressionMode = Boolean.parseBoolean(property);
}
} catch (IllegalArgumentException e) {
throw new RuntimeException("Invalid system property 'pmd.regress'", e);
}
return inRegressionMode;
}

I personally never used this. The system property is used here when deciding whether to run the test or not:

return TestDescriptor.inRegressionTestMode() && !child.isRegressionTest();

And the property "pmd.regress" also not documented: https://pmd.github.io/latest/pmd_userdocs_extending_testing.html

Comment thread pmd-test/pom.xml
Comment thread pmd-test/src/main/java/net/sourceforge/pmd/testframework/TestDescriptor.java Outdated
@adangel adangel merged commit a8efa19 into pmd:master Jul 21, 2022
@oowekyala oowekyala deleted the pmd6-extract-test-schema-module branch July 21, 2022 20:59
adangel added a commit to oowekyala/pmd that referenced this pull request Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[test] Move pmd-test to java 8

2 participants