-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from adangel:update-manual-integration-test
Update manual integration test for PMD 7 #119
- Loading branch information
Showing
14 changed files
with
180 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s| | |
s.metadata = { "bug_tracker_uri" => "https://github.com/pmd/pmd-regression-tester/issues", "homepage_uri" => "https://pmd.github.io", "source_code_uri" => "https://github.com/pmd/pmd-regression-tester" } if s.respond_to? :metadata= | ||
s.require_paths = ["lib".freeze] | ||
s.authors = ["Andreas Dangel".freeze, "Binguo Bao".freeze, "Cl\u00E9ment Fournier".freeze] | ||
s.date = "2023-05-26" | ||
s.date = "2023-05-27" | ||
s.description = "A regression testing tool ensure that new problems and unexpected behaviors will not be introduced to PMD project after fixing an issue , and new rules can work as expected.".freeze | ||
s.email = ["[email protected]".freeze, "[email protected]".freeze, "[email protected]".freeze] | ||
s.executables = ["pmdtester".freeze] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,29 +46,34 @@ def test_case_1_single_java_rule_changed | |
assert_equal(0, @summary[:violations][:changed], 'found changed violations') | ||
assert_equal(0, @summary[:violations][:new], 'found new violations') | ||
# These are the artificially created false-negatives for AbstractClassWithoutAbstractMethod rule | ||
# checkstyle: 204 violations | ||
# checkstyle: 195 violations | ||
# spring-framework: 280 violations | ||
# openjdk11: 29 violations | ||
# -> total = 513 | ||
assert_equal(204 + 280 + 29, @summary[:violations][:removed], 'found removed violations') | ||
# -> total = 504 | ||
assert_equal(195 + 280 + 29, @summary[:violations][:removed], 'found removed violations') | ||
|
||
# errors might have been caused in the baseline for other rules (only visible in the stacktrace) | ||
# hence they might appear as removed | ||
|
||
# project "apex-link" has 2 errors, since we only executed java rules, 2 errors are removed | ||
assert_equal(2, @summary[:errors][:removed], 'found removed errors') | ||
assert_equal(0, @summary[:errors][:changed], 'found changed errors') | ||
# project "apex-link" has 2 errors removed, since we only executed java rules | ||
# project "checkstyle" has 10 errors removed and 1 changed | ||
# project "openjdk-11" has 0 error removed or changed | ||
# project "spring-framework" has 1 error removed | ||
# each project has 1 config error removed (LoosePackageCoupling dysfunctional): in total 7 config errors removed | ||
assert_equal(13, @summary[:errors][:removed], 'found removed errors') | ||
# The stack overflow exception might vary in the beginning/end of the stack frames shown | ||
# This stack overflow error is from checkstyle's InputIndentationLongConcatenatedString.java | ||
# instead of assert_equal(0, @summary[:errors][:changed], 'found changed errors') | ||
# allow 0 or 1 changed errors | ||
assert @summary[:errors][:changed] <= 1 | ||
assert_equal(0, @summary[:errors][:new], 'found new errors') | ||
assert_equal(0, @summary[:configerrors][:changed], 'found changed configerrors') | ||
assert_equal(0, @summary[:configerrors][:new], 'found new configerrors') | ||
# Only the rule AbstractClassWithoutAbtractMethod has been executed, so the | ||
# configerrors about LoosePackageCoupling are gone, one for each project | ||
# we now have 7 projects in total (4 java, 3 apex) | ||
assert_equal(7, @summary[:configerrors][:removed], 'found removed configerrors') | ||
|
||
assert_equal("This changeset changes 0 violations,\n" \ | ||
"introduces 0 new violations, 0 new errors and 0 new configuration errors,\n" \ | ||
'removes 513 violations, 2 errors and 7 configuration errors.', | ||
'removes 504 violations, 13 errors and 7 configuration errors.', | ||
create_summary_message) | ||
|
||
assert_file_equals("#{PATCHES_PATH}/expected_patch_config_1.xml", 'target/reports/diff/patch_config.xml') | ||
|
@@ -93,20 +98,25 @@ def test_case_2_single_xpath_rule_changed | |
# errors might have been caused in the baseline for other rules (only visible in the stacktrace) | ||
# hence they might appear as removed | ||
|
||
# project "apex-link" has 2 errors, since we only executed java rules, 2 errors are removed | ||
assert_equal(2, @summary[:errors][:removed], 'found removed errors') | ||
assert_equal(0, @summary[:errors][:changed], 'found changed errors') | ||
# project "apex-link" has 2 errors removed, since we only executed java rules | ||
# project "checkstyle" has 5 errors removed and 1 errors changed | ||
# project "openjdk-11" has 0 error removed or changed | ||
# project "spring-framework" has 1 error removed | ||
# each project has 1 config error removed (LoosePackageCoupling dysfunctional): in total 7 config errors removed | ||
assert_equal(8, @summary[:errors][:removed], 'found removed errors') | ||
# The stack overflow exception might vary in the beginning/end of the stack frames shown | ||
# This stack overflow error is from checkstyle's InputIndentationLongConcatenatedString.java | ||
# instead of assert_equal(0, @summary[:errors][:changed], 'found changed errors') | ||
# allow 0 or 1 changed errors | ||
assert @summary[:errors][:changed] <= 1 | ||
assert_equal(0, @summary[:errors][:new], 'found new errors') | ||
assert_equal(0, @summary[:configerrors][:changed], 'found changed configerrors') | ||
assert_equal(0, @summary[:configerrors][:new], 'found new configerrors') | ||
# Only the rule AvoidMessageDigestField and all other rules from bestpractices have been executed, so the | ||
# configerrors about LoosePackageCoupling are gone, one for each project | ||
# we now have 7 projects in total (4 java, 3 apex) | ||
assert_equal(7, @summary[:configerrors][:removed], 'found removed configerrors') | ||
|
||
assert_equal("This changeset changes 0 violations,\n" \ | ||
"introduces 0 new violations, 0 new errors and 0 new configuration errors,\n" \ | ||
'removes 22 violations, 2 errors and 7 configuration errors.', | ||
'removes 22 violations, 8 errors and 7 configuration errors.', | ||
create_summary_message) | ||
|
||
assert_file_equals("#{PATCHES_PATH}/expected_patch_config_2.xml", 'target/reports/diff/patch_config.xml') | ||
|
@@ -115,7 +125,7 @@ def test_case_2_single_xpath_rule_changed | |
|
||
def test_case_3_change_in_core | ||
checkout_pmd_branch | ||
prepare_patch_branch('patch_test_case_3_modify_PMD.patch', 'test-case-3') | ||
prepare_patch_branch('patch_test_case_3_modify_pmd-core.patch', 'test-case-3') | ||
|
||
run_pmd_tester | ||
|
||
|
@@ -125,7 +135,11 @@ def test_case_3_change_in_core | |
assert_equal(0, @summary[:violations][:new], 'found new violations') | ||
assert_equal(0, @summary[:violations][:removed], 'found removed violations') | ||
assert_equal(0, @summary[:errors][:removed], 'found removed errors') | ||
assert_equal(0, @summary[:errors][:changed], 'found changed errors') | ||
# The stack overflow exception might vary in the beginning/end of the stack frames shown | ||
# This stack overflow error is from checkstyle's InputIndentationLongConcatenatedString.java | ||
# instead of assert_equal(0, @summary[:errors][:changed], 'found changed errors') | ||
# allow 0 or 1 changed errors | ||
assert @summary[:errors][:changed] <= 1 | ||
assert_equal(0, @summary[:errors][:new], 'found new errors') | ||
assert_equal(0, @summary[:configerrors][:changed], 'found changed configerrors') | ||
assert_equal(0, @summary[:configerrors][:new], 'found new configerrors') | ||
|
@@ -231,7 +245,7 @@ def checkout_pmd_branch(branch = 'master') | |
system('git config user.email "[email protected]"') | ||
system('git config user.name "PMD CI (pmd-bot)"') | ||
# remove any already existing binary to force a rebuild | ||
FileUtils.rm Dir.glob('pmd-dist/target/pmd-bin-*.zip') | ||
FileUtils.rm Dir.glob('pmd-dist/target/pmd-*.zip') | ||
end | ||
end | ||
|
||
|
@@ -248,19 +262,19 @@ def prepare_patch_branch(patch_file, local_branch, base_branch = 'master') | |
end | ||
|
||
def assert_master_baseline | ||
assert_path_exist('target/reports/master/checkstyle/config.xml') | ||
assert_path_exist('target/reports/master/checkstyle/report_info.json') | ||
assert_path_exist('target/reports/master/checkstyle/pmd_report.xml') | ||
assert(File.size('target/reports/master/checkstyle/pmd_report.xml') > 50 * 1024 * 1024) | ||
|
||
assert_path_exist('target/reports/master/openjdk-11/config.xml') | ||
assert_path_exist('target/reports/master/openjdk-11/report_info.json') | ||
assert_path_exist('target/reports/master/openjdk-11/pmd_report.xml') | ||
assert(File.size('target/reports/master/openjdk-11/pmd_report.xml') > 100 * 1024 * 1024) | ||
|
||
assert_path_exist('target/reports/master/spring-framework/config.xml') | ||
assert_path_exist('target/reports/master/spring-framework/report_info.json') | ||
assert_path_exist('target/reports/master/spring-framework/pmd_report.xml') | ||
assert(File.size('target/reports/master/spring-framework/pmd_report.xml') > 150 * 1024 * 1024) | ||
assert_master_baseline_project('checkstyle', 40 * 1024 * 1024) | ||
assert_master_baseline_project('openjdk-11', 80 * 1024 * 1024) | ||
assert_master_baseline_project('spring-framework', 100 * 1024 * 1024) | ||
assert_master_baseline_project('java-regression-tests', 100 * 1024) | ||
assert_master_baseline_project('apex-link', 10 * 1024) | ||
assert_master_baseline_project('fflib-apex-common', 400 * 1024) | ||
assert_master_baseline_project('Schedul-o-matic-9000', 20 * 1024) | ||
end | ||
|
||
def assert_master_baseline_project(project_name, report_size_in_bytes) | ||
assert_path_exist("target/reports/master/#{project_name}/config.xml") | ||
assert_path_exist("target/reports/master/#{project_name}/report_info.json") | ||
assert_path_exist("target/reports/master/#{project_name}/pmd_report.xml") | ||
assert(File.size("target/reports/master/#{project_name}/pmd_report.xml") > report_size_in_bytes) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From df7e43732794442b7c787493a2189b0c4a0e3f85 Mon Sep 17 00:00:00 2001 | ||
From ab94c0fed1813eb5e8376be51a7c93164652e26b Mon Sep 17 00:00:00 2001 | ||
From: Andreas Dangel <[email protected]> | ||
Date: Thu, 14 Jan 2021 11:25:58 +0100 | ||
Subject: [PATCH] pmd-regression-test: test case 1 - single java rule changed | ||
Date: Thu, 4 May 2023 19:44:31 +0200 | ||
Subject: [PATCH] test case 1 - single java rule changed | ||
|
||
A single rule (java class) is changed. Only this rule should be executed | ||
and only this rule should be compared (ruleset is filtered). | ||
|
@@ -15,34 +15,33 @@ exactly this rule. | |
2 files changed, 4 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AbstractClassWithoutAbstractMethodRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AbstractClassWithoutAbstractMethodRule.java | ||
index 3f20b559d5..4ef489c23b 100644 | ||
index 0d0d8c33e4..972e1bd62a 100644 | ||
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AbstractClassWithoutAbstractMethodRule.java | ||
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AbstractClassWithoutAbstractMethodRule.java | ||
@@ -35,7 +35,7 @@ public class AbstractClassWithoutAbstractMethodRule extends AbstractJavaRule { | ||
} | ||
@@ -22,7 +22,7 @@ public class AbstractClassWithoutAbstractMethodRule extends AbstractJavaRulechai | ||
} | ||
if (countOfAbstractMethods == 0) { | ||
|
||
if (node.getDeclarations(ASTMethodDeclaration.class).none(ASTMethodDeclaration::isAbstract)) { | ||
- addViolation(data, node); | ||
+ //addViolation(data, node); | ||
} | ||
return data; | ||
} | ||
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AbstractClassWithoutAbstractMethodTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AbstractClassWithoutAbstractMethodTest.java | ||
index a7ff179f29..ac4d852e26 100644 | ||
index b319c5e9f1..77698edb60 100644 | ||
--- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AbstractClassWithoutAbstractMethodTest.java | ||
+++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AbstractClassWithoutAbstractMethodTest.java | ||
@@ -4,8 +4,11 @@ | ||
|
||
package net.sourceforge.pmd.lang.java.rule.bestpractices; | ||
|
||
+import org.junit.Ignore; | ||
+import org.junit.jupiter.api.Disabled; | ||
+ | ||
import net.sourceforge.pmd.testframework.PmdRuleTst; | ||
|
||
+@Ignore | ||
public class AbstractClassWithoutAbstractMethodTest extends PmdRuleTst { | ||
+@Disabled | ||
class AbstractClassWithoutAbstractMethodTest extends PmdRuleTst { | ||
// no additional unit tests | ||
} | ||
-- | ||
2.29.2 | ||
|
||
2.39.2 |
Oops, something went wrong.