GeezerVison is showing github.com — [test] Improve xml test schema · Issue #3302 · pmd/pmd
[test] Improve xml test schema #3302Labels an:enhancementAn improvement on existing features / rulesin:testingAbout tests of pmd, eg the module pmd-lang-test or pmd-test [test] DescriptionIs your feature request related to a problem? Please describe.
Currently there's a few things that are not so great with the test schema
- the only way to ignore a test is to set the attribute
regressionTest to false, which is... weird
- there's no way to execute a single test ("focus" a test). Some IDEs may provide this facility (eclipse), but some don't (intellij), and having an ide-independent way to do this would be nice
- the attribute
reinitializeRule of test-code is useless. I can't see a reason not to reinitialize the rule.
- we could remove the pattern from the
source-type element, as we do the validation at runtime anyway. This means we wouldn't have to update the schema when we add/remove languages, which makes pmd easier to extend
- validation of consistency between expected-problems, expected-messages and expected-linenumbers is buggy. Sometimes it throws a validation error, sometimes it's silent. For instance
<expected-problems>0</expected-problems>
<expected-messages>
<message>1</message>
</expected-messages>
throws a validation error, but the following doesn't
<expected-problems>1</expected-problems>
<expected-linenumbers>1,2,3</expected-linenumbers>
<expected-messages>
<message>1</message>
</expected-messages>
Describe the solution you'd like Update the schema and its parser to support focus and disabled attributes, deprecate useless things
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Some other things that we should keep in mind and fix later:
- the
<rule-property> element has ad-hoc syntax, instead of just reusing the syntax for <property> that's from the ruleset schema. This will be awkward when the XSD for rulesets is updated ([core] Implementation plan for property framework changes #1432)
- the
useAuxClasspath attribute doesn't look useful. Related to [java] Improve rule tests with auxclasspath #2649
Activityadangel commented on Jul 21, 2022 The following points are addressed by #3976: 1 (regressionTest), 4 (source-type), 5 (validation of expected-problems, expected-linenumbers, expected-messages)
TODO is: 2 (focus), 3 (reinitializeRule) adangel commented on Jul 22, 2022 I noticed that point 3 is also done: reinitalizeRule and auxclasspath are deprecated oowekyala commented on Jul 22, 2022 @adangel I will follow up with a fix for point 2, and update the release notes with refs to 3 as well.
MetadataMetadataan:enhancementAn improvement on existing features / rulesin:testingAbout tests of pmd, eg the module pmd-lang-test or pmd-test [test] DevelopmentNo branches or pull requestsIssue actions
|