Hi!
I just noticed that the number of tests shown in our SonarQube instance is a bit lower than the actual number of tests. Looking at the output generated by SonarQube reporter (ut_sonar_test_reporter) I found out that's being generated incorrectly when the test package uses the %context annotation.
Example:
ut_demo.pks
create or replace package ut_demo is
-- %suite
-- %test
procedure test1;
-- %context(first_context)
-- %test
procedure test2;
-- %endcontext
end ut_demo;
ut_demo.pkb
create or replace package body ut_demo is
procedure test1 is begin null; end;
procedure test2 is begin null; end;
end ut_demo;
Then, run the tests using:
begin
ut.run('ut_demo', ut_sonar_test_reporter());
end;
Currently, this is the output:
<?xml version="1.0"?>
<testExecutions version="1">
<file path="ut_demo.first context">
<testCase name="test2" duration="1" >
</testCase>
</file>
<file path="ut_demo">
<testCase name="test1" duration="1" >
</testCase>
</file>
</testExecutions>
Note that it have two <file> tags, one of them has the context name. SonarQube will only import the data inside the <file path="ut_demo"> (which corresponds to a file on the disk). Since SonarQube requires a filename in the <file> tag, the output should be:
<?xml version="1.0"?>
<testExecutions version="1">
<file path="ut_demo">
<testCase name="test1" duration="1" >
</testCase>
<testCase name="test2" duration="1" >
</testCase>
</file>
</testExecutions>
I'm using utPLSQL 3.1.2.2134.
Hi!
I just noticed that the number of tests shown in our SonarQube instance is a bit lower than the actual number of tests. Looking at the output generated by SonarQube reporter (ut_sonar_test_reporter) I found out that's being generated incorrectly when the test package uses the
%contextannotation.Example:
ut_demo.pks
ut_demo.pkb
Then, run the tests using:
Currently, this is the output:
Note that it have two
<file>tags, one of them has the context name. SonarQube will only import the data inside the<file path="ut_demo">(which corresponds to a file on the disk). Since SonarQube requires a filename in the<file>tag, the output should be:I'm using utPLSQL 3.1.2.2134.