-
Notifications
You must be signed in to change notification settings - Fork 185
Multiple (stacked) before/after annotations #335
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
Comments
I like the second one more |
It's good idea however there is no reason why developer cannot wrap add_employee,add_location etc. into single package add_data and call it beforetest. But second one looks a bit cleaner and more readable as well. |
We could also allow stacked form for |
I think that should be a syntax error or warning at least. If before all means to be executed before all elements of the suite then having more than one creates a bit of confusion. E.g. in which order beforeall will run and if something run before it is no longer before all. |
@lwasylow RSpec allows multiple |
On the other hand, as you said, one can always stack/combine multiple procedures into Currently if you have several |
This is moved to separate issue: #649 After having a bit more thought on the topic I'd like to suggest the following to the
Additionally, 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. 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 like this.. mainly because i just tried to do it and didnt understand why it didnt work i would suggest to add it to I also like the idea of being able to refer to other packages. |
I was thinking of the same |
I got a request to add ability to have more than one
beforetest
annotation.This way you can have multiple, named, shared setup scenarios and compose your test setup by specifying multiple
beforetest
annotations for a test. Some dummy example below.The text was updated successfully, but these errors were encountered: