Skip to main content

Conflicting utPLSQL annotations

ZPA rule for PL/SQL and Oracle SQL · ConflictingUtPlSqlAnnotations

utPLSQL accepts some annotations only once per suite, context or procedure. For a repeated one it keeps the first and warns about the others, and a procedure annotated with %test cannot also be a setup or cleanup procedure: utPLSQL ignores the %beforeall, %afterall, %beforeeach or %aftereach on it. The package compiles, but the ignored annotation does nothing.

This rule reports a repeated annotation that utPLSQL accepts only once in its scope, and a setup or cleanup annotation on a %test procedure. Several distinct procedures annotated with %beforeall, %afterall, %beforeeach, %aftereach, %beforetest or %aftertest are valid and are not reported.

Examples​

Noncompliant Code Example
create package crate_test as
--%suite
--%test(Creates a crate)
--%test(Creates a crate with a label) -- Noncompliant
procedure creates_crate;
end;
Compliant Solution
create package crate_test as
--%suite
--%test(Creates a crate)
procedure creates_crate;
end;