Unit Testing and APEX Global Variables
476328Mar 15 2013 — edited Mar 16 2013We've recently started to unit test our database level PL/SQL business logic.
As such we have a need to be able to simulate or provide output from PL/SQL APEX components in order to facilitate testing of these components.
Some of the most obvious portions that need simulation are:
1. The existence of a session
2. The current application ID
3. The current page ID.
We currently handle requirement #1 by using apex_040100.wwv_flow_session.create_new
We handle 2 and 3 using the apex_application.g_flow_id and g_flow_step_id global variables.
I'm just wondering, how safe is it for us to use wwv_flow_session.create_new to simulate the creation of a session at testing time for those things which need a session?
I've also noticed that there are apex_application.get_application_id and apex_application.get_page_id functions whose output is not tied to the global variables (at least in our current version).
Is it safe for us to expect that we can set these global variables for use in testing or is apex moving to get_application_id and get_page_id functions away from global variables?
Will there be corresponding set_application_id and set_page_id functions in the future?
Sorry for the question bomb. Thanks for any help.