Skip to content

Migrate to JUnit5 - Part 3#4155

Merged
oowekyala merged 30 commits into
pmd:pmd/7.0.xfrom
adangel:pmd7-junit5-part3
Feb 1, 2023
Merged

Migrate to JUnit5 - Part 3#4155
oowekyala merged 30 commits into
pmd:pmd/7.0.xfrom
adangel:pmd7-junit5-part3

Conversation

@adangel

@adangel adangel commented Oct 13, 2022

Copy link
Copy Markdown
Member

Describe the PR

Continuation of #4028

  • Migrate/Delete LocaleRule / DefaultLocaleRule in pmd-javascript
  • Migrate base tests in pmd-test (RuleSetFactory and LanguageVersions)
  • Migrate tests around ant tests (pmd-test, pmd-cli, pmd-ant, pmd-java, pmd-javascript, pmd-xml)
  • Update https://pmd.github.io/latest/pmd_userdocs_extending_testing.html
  • Maybe Add dogfood rule JUnit5TestShouldBePackagePrivate
  • Migrate tests around CLI base tests (pmd-test, pmd-cli, pmd-ant, pmd-java, pmd-javascript, pmd-xml)
  • Remove now unneeded junit4 dependency (might need to keep it in pmd-java for type resolution tests)
    • final search for usages, e.g. egrep -r "(org.junit.Test)|(org.junit.Assert)|(junit.framework)|(import org.junit.jupiter.api.Assertions)|(import org.hamcrest.MatcherAssert)|(import org.junit.jupiter.api.Assumptions)" *
    • also system-rules, junitparams can be removed
    • find -name "pom.xml"|grep -v target|xargs egrep "<groupId>junit|JUnitParams|system-rules|kotlin-test-junit|ant-testutil"
  • Remove explicit dependency config for surefire plugin
    • it should automatically pickup the correct platform using the test dependency in the project (junit5)
  • Remove deprecated test (base) classes from pmd-test
    • net.sourceforge.pmd.test.util.JavaUtilLoggingRule (on pmd6 only in pmd-core/test, on pmd7 in pmd-test/main)
    • net.sourceforge.pmd.testframework.PMDTestRunner (in pmd-test/main)
    • net.sourceforge.pmd.testframework.RuleTestRunner (in pmd-test/main)
    • net.sourceforge.pmd.testframework.TestDescriptor (in pmd-test/main)
    • remove dependencies junit and system-rules
    • Update release notes

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@adangel adangel added this to the 7.0.0 milestone Oct 13, 2022
@adangel adangel mentioned this pull request Oct 13, 2022
3 tasks
@ghost

ghost commented Oct 13, 2022

Copy link
Copy Markdown
2 Messages
📖 Compared to pmd/7.0.x:
This changeset changes 11 violations,
introduces 1 new violations, 0 new errors and 0 new configuration errors,
removes 1 violations, 0 errors and 0 configuration errors.
Full report
📖 Compared to master:
This changeset changes 50624 violations,
introduces 34682 new violations, 12 new errors and 0 new configuration errors,
removes 142045 violations, 4 errors and 7 configuration errors.
Full report
Compared to pmd/7.0.x:
This changeset changes 7 violations,
introduces 1 new violations, 0 new errors and 0 new configuration errors,
removes 1 violations, 2578 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 49641 violations,
introduces 33909 new violations, 1446 new errors and 0 new configuration errors,
removes 195793 violations, 4 errors and 7 configuration errors.
Full report
Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 2578 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 49641 violations,
introduces 33909 new violations, 1446 new errors and 0 new configuration errors,
removes 195793 violations, 4 errors and 7 configuration errors.
Full report
Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 49641 violations,
introduces 33909 new violations, 1446 new errors and 0 new configuration errors,
removes 195793 violations, 4 errors and 7 configuration errors.
Full report
Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 10270 new violations, 1 new errors and 0 new configuration errors,
removes 0 violations, 1446 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 33052 violations,
introduces 13139 new violations, 3 new errors and 0 new configuration errors,
removes 22938 violations, 6 errors and 7 configuration errors.
Full report
Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 10270 new violations, 1 new errors and 0 new configuration errors,
removes 0 violations, 1446 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 33052 violations,
introduces 13139 new violations, 3 new errors and 0 new configuration errors,
removes 22938 violations, 6 errors and 7 configuration errors.
Full report
Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 8 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 0 violations,
introduces 410326 new violations, 15 new errors and 0 new configuration errors,
removes 421704 violations, 39 errors and 7 configuration errors.
Full report

Generated by 🚫 Danger

@adangel adangel added the in:testing About tests of pmd, eg the module pmd-lang-test or pmd-test [test] label Jan 13, 2023
@adangel adangel marked this pull request as ready for review January 30, 2023 13:16
@adangel

adangel commented Jan 30, 2023

Copy link
Copy Markdown
Member Author

This is finally done now.

I've directly removed the old JUnit4 test runners and added a note in the release notes. They are not deprecated in PMD6 but maybe they should? At least, these classes are not supposed to be used directly, so could be considered internal api, that is removed with PMD 7. Wdyt?

@oowekyala oowekyala self-requested a review February 1, 2023 23:16

@oowekyala oowekyala 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.

Thanks for the huge effort Andreas! I'm certainly happy to see this completed.

I've directly removed the old JUnit4 test runners and added a note in the release notes.

I think what you wrote is fine, and we do not need to go out of our way to deprecate these in PMD 6. Potential users are few (none on github anyway)


import net.sourceforge.pmd.AbstractRuleSetFactoryTest;

class RuleSetFactoryTest extends AbstractRuleSetFactoryTest {

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.

I wonder if these test classes should be renamed. I think a name like "SwiftStandardRulesetsTests" would be more appropriate, RuleSetFactory is in pmd-core and is deprecated.

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.

Yes, probably. I think, we have this for most languages and it's also part of the howto (https://docs.pmd-code.org/pmd-doc-7.0.0-SNAPSHOT/pmd_devdocs_major_adding_new_language_javacc.html#15-test-the-rules). It really would help to use a naming pattern like your suggestion.

@oowekyala oowekyala merged commit 1077eba into pmd:pmd/7.0.x Feb 1, 2023
@adangel adangel deleted the pmd7-junit5-part3 branch February 2, 2023 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in:testing About tests of pmd, eg the module pmd-lang-test or pmd-test [test]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants