Allow beforetest/aftertest procedures to accept parameters #1328
Replies: 4 comments
-
|
@Hkyle |
Beta Was this translation helpful? Give feedback.
-
|
I am having a second thought now. create or replace package my_test is
--%suite
procedure build_user(a_param varchar2);
--%test
--%beforetest( build_user(123) )
procedure do_the_test;
end;
/
create or replace package body my_test is
procedure build_user(a_param varchar2) is
begin
--do some stuff here
null;
end;
procedure do_the_test is
begin
--Assert
ut.expect(get_user()).to_equal('123');
end;
end;
/You could have: create or replace package my_test is
--%suite
--%test
procedure do_the_test;
end;
/
create or replace package body my_test is
procedure build_user(a_param varchar2) is
begin
--do some stuff here
null;
end;
procedure do_the_test is
begin
--Arrange
build_user(123);
--Assert
ut.expect(get_user()).to_equal('123');
end;
end;
/ |
Beta Was this translation helpful? Give feedback.
-
|
@Hkyle |
Beta Was this translation helpful? Give feedback.
-
|
Since at least in version 3.1.13 it is possible to pass parameters to procedures called in But I have a follow-up question:
Also note the capitalization of the passed value. This could sometimes lead to confusion 😅 Is there any way to pass more than one value? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
You can call procedures with beforetest or aftertest annotation, but it doesn't seem possible to pass any parameters through them. Is it possible to add this capability?
For example -
--% beforetest(build_user(123))--% beforetest(build_user('missing_name'))It would allow much greater reusability of setup procedures.
Beta Was this translation helpful? Give feedback.
All reactions