GeezerVison is showing github.com — Internal variable that stores test case name · Issue #781 · utPLSQL/utPLSQL
Internal variable that stores test case name #781DescriptionHi there ,
I would like to if there is any internal variable that stores the test case name in it , so that I could use this in my --%beforetest annotation , to handle input data.
Thanks!! Activitylwasylow commented on Nov 9, 2018 Hi
Can you clarify what you mean ?
If you could let us know what at are your trying to achieve , so sample scenario/ mockup ? MS-24 commented on Nov 9, 2018 Hi @lwasylow ,
This is related to data setup.
For my test scenario , I need to insert rows in 20 tables. My approach is
- Create external tables for each of the table for the first time and store the data in it and use it each time the test runs . This is kind of one time setup for that test case.
for example for the original table employee , I will create an external table as tst_employee using "orgnization external" .
Create table tst_employee
organization external
( type oracle_datapump
default directory TEST_LOG
location ('tst_employee.dmp' )
) as select * from employee where customer_ref= 'tst_bv_spend_cap'.
- Store this tst_employee.dmp file in a directory called 'test_case_name' in unix.
3.Likewise if there are 10 test cases I would like to create 10 tst_employee.dmp files with relevant to each of the test cases and keep in each of those directories.
- With this my data creation part is done. Now I will clear all the data from original tables . i.e delete from employee.
- When I ran my test case , as part of --%beforetest , I am calling my data_setup procedure , in which I am planning to use
'insert into employee select * from tst_employee'to populate the data in employee so that my original code to be test would use.
- Now I have 10 unix directories in which 10 different data setup files are present which will be used by 10 different test cases.
7.For each test case I will copy the relevant file .dmp file to a directory called working directory and will remove once the test is completed .
- As my test_case_name and unix directory name are same here I am planning to use the test_case_name in a script to copy the file from test case unix directory to working directory. In this way I don't have to create multiple all_directory entries .
- As my data_setup procedure doesn't know which test currently being executed (or does it know?) it is difficult to achieve the above copying files to working directory. So , if there is any internal variable that stores the test_case_name which is available in data_setup procedure , it would be handy.
Hope my explanation is clear . Please suggest. lwasylow commented on Nov 9, 2018 I don't think we support functions with parameters as part of before or after at the moment.
What I would suggest as workaround is to create a one procedure that accepts filename and create it.
And then for each test create a wrapper procedure without parameter but with hardcoded file name.
As for your request this is something that have to be looked and investigated a bit further in terms of impact and feasibility. MS-24 commented on Nov 10, 2018 jgebal commented on Nov 28, 2018 I see two options, probably both would be useful.
- We could improve the way we use
dbms_application_info
- We could create a dedicated utPLSQL session context that would be able to hold important information durong test execution.
The more i think about it the more i like it. 😀 lwasylow commented on Nov 28, 2018 Application info is restricted to 30 char, not sure if that would be enough. Shoelace commented on Dec 3, 2018 i think a session context is a good idea.. application_inof/module/action can be overwritten by the procedure under test anyway added 2 commits that reference this issue on Jul 2, 2019This issue will close once commit e172d40 is merged into the 'develop' branch.e172d40 This issue will close once commit f5fa468 is merged into the 'develop' branch.f5fa468
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|