-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create test listing API #571
Comments
To check if executable tests exist for a given owner, I have to call How about disabled tests? Should they be included or ignored? Or should this be configurable? |
Will keep an eye on this and provide support in java-api as soon as it's ready |
I think the API should provide as much info as possible including objects and even lines (if able) of the test procedure declaration. The whole structure and parameters of the test should be provided including tags that will be introduced shortly and display names, setups/teardowns for each test etc |
The base for all the info about test/suite will this query on annotations API. select o.object_owner, o.object_name, a.subobject_name, a.name annotation, a.text annotation_text
from table(ut3.ut_annotation_manager.get_annotated_objects('UT3_TESTER', 'PACKAGE')) o,
table(o.annotations) a
where exists (select 1 from table(o.annotations) s where s.name='suite') We can make the API public "as-is", by just adding a pass-through function in Pass through seems a quick-win and puts the burden of interpreting annotations on the client-side. On the other side the well-defined API seems more elegant. |
I think flavor is easier to be done in java API. Would suggest to go for the quick win and Let me build the API around it while you focus on other things. |
Will this be sufficient? /**
* Returns a ref_cursor containing information about unit tests package(s) for given owner
*
* @param a_owner owner of unit tests to retrieve
* @param a_package_name optional name of unit test package to retrieve, if NULLm all unit test packages are returned
* @return sys_refcursor columns: OWNER, PACKAGE_NAME, PROCEDURE_NAME, ANNOTATION, ANNOTATION_TEXT
*/
function get_unit_tests_info(a_owner varchar2, a_package_name varchar2 := null) return sys_refcursor;
If you feel like it would be better, I could create a pipelined function. |
Technically yes.
I agree. I do not like a week cursor to be part of an API. A function returning a collection type would be better, makes the content explicit without relying on documentation. Personally I would also remove the following filter:
When the burden of interpreting annotations is on the client-side, then it should be completely on the client side. E.g. this way it would be possible to write code on the client side which identifies packages without suite annotations but with procedures annotated with test. |
I'll then expose just the get_annotated_packages ut3.ut_annotation_manager.get_annotated_objects(:user, 'PACKAGE') |
I have it now exposed as: type t_annotation_rec is record (
package_owner varchar2(250),
package_name varchar2(250),
procedure_name varchar2(250),
annotation_pos number(5,0),
annotation_name varchar2(1000),
annotation_text varchar2(4000)
);
type tt_annotations is table of t_annotation_rec;
/**
* Returns a pipelined collection containing information about unit tests package/packages for a given owner
*
* @param a_owner owner of unit tests to retrieve
* @param a_package_name optional name of unit test package to retrieve, if NULLm all unit test packages are returned
* @return tt_annotations table of records
*/
function get_unit_test_info(a_owner varchar2, a_package_name varchar2 := null) return tt_annotations pipelined; I have also removed the filter from query - so you get all the annotated packages. |
Example queries: select x.pacakge_owner, x.pacakge_name, a.procedure_name,
x.annotation_pos, x.annotation_name, a.annotation_text
from table(ut_runner.get_unit_test_info( :owner )) x or select x.pacakge_owner, x.pacakge_name, a.procedure_name,
x.annotation_pos, x.annotation_name, a.annotation_text
from table(ut_runner.get_unit_test_info( :owner, :package_name )) x |
Is the flattened structure any better than the original one in |
Looks good. I like this flattened structure. Thanks. Should be easy for @pesse to include in the Java API, which I will use in the extension. BTW: Is the annotation_position equal to the line of code where the annotation is found? If yes, I would rename it to annotation_line. |
Unfortunately, it's just an index number (1,2,3 ect.) |
Thanks @jgebal for the clarification. |
If line and column are of interest, you could replace the comment blocks with spaces. I've done that in the in method |
We need to expose following API within ut_runner:
is_suite
- return 'Y' if givenowner
,package
is a unit test suite, else return 'N'get_suites_list
- return a list ofpackage
with correspondingsuitepath
anddescription
for a given
owner
get_tests_list
- return a list oftest_procedure
with correspondingdescription
for a given
owner
andpackage
get_suitepaths
- return a list of suitepaths for a givenowner
All of functions should make use of
ut_annotation_manager
to assure retrieval of up-to-date informationThe text was updated successfully, but these errors were encountered: