From cc7df1d5f6316438299537b492aafd1613c93316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Sat, 17 Oct 2026 23:27:14 +0300 Subject: [PATCH 1/2] Expand documentation and tests for coverage filters. Expand the README section on includeSchemaExpr, excludeSchemaExpr, includeObjectExpr and excludeObjectExpr - link to the utPLSQL guide. Add missing integration tests include_schema_expr and exclude_schema_expr. --- README.md | 28 ++++++++-- .../utplsql/maven/plugin/UtPlsqlMojoIT.java | 14 +++++ .../utplsql/coverage-sonar-report.xml | 2 + .../utplsql/sonar-test-report.xml | 11 ++++ .../UtPlsqlMojoIT/exclude_schema_expr/pom.xml | 52 +++++++++++++++++++ .../utplsql/coverage-sonar-report.xml | 1 + .../utplsql/sonar-test-report.xml | 11 ++++ .../UtPlsqlMojoIT/include_schema_expr/pom.xml | 52 +++++++++++++++++++ 8 files changed, 168 insertions(+), 3 deletions(-) create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/expected-output/utplsql/coverage-sonar-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/expected-output/utplsql/sonar-test-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/pom.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/coverage-sonar-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/sonar-test-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/pom.xml diff --git a/README.md b/README.md index deab128..323f0cd 100644 --- a/README.md +++ b/README.md @@ -198,8 +198,27 @@ described in [Coverage](https://www.utplsql.org/utPLSQL/latest/userguide/coverag | `includeObjectExpr` | Regular expression for the names of objects to include | | `excludeObjectExpr` | Regular expression for the names of objects to exclude | -The regular expression filters need a utPLSQL version that supports them. See -[Coverage reporting options](https://www.utplsql.org/utPLSQL/latest/userguide/coverage.html#coverage-reporting-options). +The plugin passes these values unchanged to utPLSQL, which defines their exact semantics. See +[Filtering objects in coverage reports](https://www.utplsql.org/utPLSQL/latest/userguide/coverage.html#filtering-objects-in-coverage-reports) +in the utPLSQL documentation. The points that matter most in practice: + +* The `*Expr` parameters are regular expressions, matched case-insensitively. They are matched against the schema + name (`*SchemaExpr`) or the object name **without** the schema (`*ObjectExpr`). Use `^` and `$` to anchor them, + otherwise any partial match counts (`APP` also matches `MY_APP_TEST`). +* If `includeSchemaExpr` or `includeObjectExpr` is set, utPLSQL ignores `includeObject`. All exclude parameters are + always applied and can be combined. +* utPLSQL ignores all include/exclude filters when file mappings are in use, that is when the plugin finds files for + `sources` (explicitly configured, or in the default `src/main/plsql` directory). See + [Mapping project files to database objects](#mapping-project-files-to-database-objects). Use the filters when + your project does not provide source files to map. +* Blank values are ignored. + +Example: report coverage of all packages in the `APP` schema except those ending in `_TMP`: + +```xml +^APP$ +_TMP$ +``` ### Mapping project files to database objects @@ -466,7 +485,10 @@ The plugin's integration tests double as examples, in | `--ora-stuck-timeout` | `oraStuckTimeout` | | `-include` | `includeObject` | | `-exclude` | `excludeObject` | -| not available | `includeSchemaExpr`, `excludeSchemaExpr`, `includeObjectExpr`, `excludeObjectExpr` | +| `-include-schema-expr` | `includeSchemaExpr` | +| `-exclude-schema-expr` | `excludeSchemaExpr` | +| `-include-object-expr` | `includeObjectExpr` | +| `-exclude-object-expr` | `excludeObjectExpr` | | not available | `skipUtplsqlTests` | | `--coverage-schemes` | not available | | `-t`, `--timeout` | not available | diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java index 310a22e..3416961 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -98,6 +98,20 @@ void include_object_expr(MavenExecutionResult result) { assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); } + @MavenTest + void include_schema_expr(MavenExecutionResult result) { + assertThat(result).isSuccessful(); + + assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); + } + + @MavenTest + void exclude_schema_expr(MavenExecutionResult result) { + assertThat(result).isSuccessful(); + + assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); + } + @MavenTest @SystemProperty(value = "skipTests", content = "true") void skip_tests(MavenExecutionResult result) { diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/expected-output/utplsql/coverage-sonar-report.xml new file mode 100644 index 0000000..cf7a48f --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/expected-output/utplsql/coverage-sonar-report.xml @@ -0,0 +1,2 @@ + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/expected-output/utplsql/sonar-test-report.xml new file mode 100644 index 0000000..04708f1 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/expected-output/utplsql/sonar-test-report.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/pom.xml new file mode 100644 index 0000000..fa64793 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_schema_expr/pom.xml @@ -0,0 +1,52 @@ + + 4.0.0 + + org.utplsql + owner-param + 1.0.0 + pom + + + jdbc:oracle:thin:@//localhost:1521/FREEPDB1 + UT3 + ut3 + + + + + + org.utplsql + utplsql-maven-plugin + @project.version@ + + + + test + + + false + + TESTS_OWNER + + + + UT_COVERAGE_SONAR_REPORTER + utplsql/coverage-sonar-report.xml + true + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + ^app$ + + + + + + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/coverage-sonar-report.xml new file mode 100644 index 0000000..f59ddcf --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/coverage-sonar-report.xml @@ -0,0 +1 @@ + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/sonar-test-report.xml new file mode 100644 index 0000000..04708f1 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/sonar-test-report.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/pom.xml new file mode 100644 index 0000000..9c908bd --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/pom.xml @@ -0,0 +1,52 @@ + + 4.0.0 + + org.utplsql + owner-param + 1.0.0 + pom + + + jdbc:oracle:thin:@//localhost:1521/FREEPDB1 + UT3 + ut3 + + + + + + org.utplsql + utplsql-maven-plugin + @project.version@ + + + + test + + + false + + TESTS_OWNER + + + + UT_COVERAGE_SONAR_REPORTER + utplsql/coverage-sonar-report.xml + true + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + ^app$ + + + + + + + From 2abb3152099a6272932a79b3979d73f0266d54c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Sat, 17 Oct 2026 23:38:15 +0300 Subject: [PATCH 2/2] Fixing expected for integration tests. --- .../expected-output/utplsql/coverage-sonar-report.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/coverage-sonar-report.xml index f59ddcf..0700c46 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/coverage-sonar-report.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_schema_expr/expected-output/utplsql/coverage-sonar-report.xml @@ -1 +1 @@ - +