Skip to main content

utPLSQL annotations should not be placed in package bodies

ZPA rule for PL/SQL and Oracle SQL · IneffectiveUtPlSqlAnnotation

utPLSQL reads annotations from package specifications only. An annotation written in a package body is a comment the compiler accepts and utPLSQL never sees: the procedure is not run as a test, or the setting is not applied.

This rule reports a utPLSQL annotation written in a package body. Move it to the procedure's declaration in the specification.

Examples​

Noncompliant Code Example
create package body crate_test as
--%test(Creates a crate) -- Noncompliant
procedure creates_crate is
begin
ut.expect(crate_count).to_equal(1);
end;
end;
Compliant Solution
create package crate_test as
--%suite
--%test(Creates a crate)
procedure creates_crate;
end;