Skip to content

Internal variable that stores test case name #781

Closed

Description

@MS-24

Hi 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!!

Activity

  1. lwasylow commented on Nov 9, 2018

    @lwasylow
    Member

    Hi
    Can you clarify what you mean ?
    If you could let us know what at are your trying to achieve , so sample scenario/ mockup ?

  2. MS-24 commented on Nov 9, 2018

    @MS-24
    Author

    Hi @lwasylow ,
    This is related to data setup.
    For my test scenario , I need to insert rows in 20 tables. My approach is

    1. 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'.
    
    1. 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.
    2. With this my data creation part is done. Now I will clear all the data from original tables . i.e delete from employee.
    3. 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.
    4. 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 .
    5. 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 .
    6. 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.

  3. lwasylow commented on Nov 9, 2018

    @lwasylow
    Member

    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.

  4. MS-24 commented on Nov 10, 2018

    @MS-24
    Author

    Ok ,Thank you

  5. jgebal commented on Nov 28, 2018

    @jgebal
    Member

    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. 😀

  6. lwasylow commented on Nov 28, 2018

    @lwasylow
    Member

    Application info is restricted to 30 char, not sure if that would be enough.

  7. Shoelace commented on Dec 3, 2018

    @Shoelace
    Member

    i think a session context is a good idea.. application_inof/module/action can be overwritten by the procedure under test anyway

  8. added 2 commits that reference this issue on Jul 2, 2019
    e172d40
    f5fa468
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions