I'd like to suggest the following to the before..., after... annotations.
- add ability to reference procedures from other packages
- add ability to call multiple procedures
Additionally, beforeall, afterall, beforeeach, aftereach, we could be suite level annotations with similar syntax as beforetest/aftertest.
Example below:
package test_departments_api is
--%suite(Departments API)
--%beforeall(common_data_helper.data_setup, privileges_helper.setup)
--%afterall(privileges_helper.cleanup, common_data_helper.data_cleanup)
procedure setup_manager;
--%test(Adds department)
--%beforetest(some_package.add_employee, some_package.add_location, setup_manager)
procedure successfully_add_department;
--%test(Fails to add depatrment when no manager found)
--%beforetest(common_employee_helper.setup_employee, common_location_helper.setup_location)
procedure fail_to_add_department;
--%test(Returns department by name)
--%beforetest(common_department_helper.setup_depatment)
procedure get_department_by_name;
end;
This way, we can allow for even better separation of common things.
It is still possible to achieve the same without before/after annotations referencing procedures outside of package, but it requires a lot of bolierplate code as below.
package test_departments_api is
--%suite(Departments API)
--%beforeall
procedure common_setup;
--%afterall
procedure common_cleanup;
procedure setup_manager;
--%test(Adds department)
--%beforetest(some_package.add_employee, some_package.add_location, setup_manager)
procedure successfully_add_department;
--%test(Fails to add depatrment when no manager found)
--%beforetest(common_employee_helper.setup_employee, common_location_helper.setup_location)
procedure fail_to_add_department;
--%test(Returns department by name)
--%beforetest(common_department_helper.setup_depatment)
procedure get_department_by_name;
end;
/
...
package body test_departments_api is
procedure common_setup is
begin
common_data_helper.data_setup;
privileges_helper.setup;
end;
procedure common_cleanup is
begin
privileges_helper.cleanup;
common_data_helper.data_cleanup;
end;
...
Would it make sence and add value to have this kind of flexibility in annotations?
The down side I see is that we would only know at runtime if the dependencies to other packages defined by before/after are valid.
I'd like to suggest the following to the
before...,after...annotations.Additionally,
beforeall,afterall,beforeeach,aftereach, we could be suite level annotations with similar syntax asbeforetest/aftertest.Example below:
This way, we can allow for even better separation of common things.
It is still possible to achieve the same without
before/afterannotations referencing procedures outside of package, but it requires a lot of bolierplate code as below.Would it make sence and add value to have this kind of flexibility in annotations?
The down side I see is that we would only know at runtime if the dependencies to other packages defined by before/after are valid.