JMeter Template for Oracle APEX Applications

With around 20 years on the job, Matt is one of the most experienced software developers at Pretius. He likes meeting new people, traveling to conferences, and working on different projects.
He’s also a big sports fan (regularly watches Leeds United, Formula 1, and boxing), and not just as a spectator – he often starts his days on a mountain bike, to tune his mind.
As Oracle APEX developers, ensuring our applications can handle real-world usage is a technical necessity.
Load testing is an essential part of this process, yet it often involves complicated manual setups or reliance on commercial tools.
The Pretius JMeter APEX Template addresses this need, by providing a configurable, open-source starter project designed specifically for Oracle APEX load testing using Apache JMeter.
Purpose and Features
This project implements a JMeter login/logout script for APEX environments:
Automates login, home page navigation, and logout for your APEX application.
Provides ready-made configuration to minimize manual edits.
Allows quick ramp-up for both functional and basic performance/load tests.
The idea is that you use a sample APEX application to peform this test on.
You can ramp up the number of users and scale-up, so imagine 100 users simultanuously trying to login and logout of your APEX environment. Now image how that would fair? JMeter can answer these questions.
You can additionally add some DB intensive activivites (script provded) on the Home Page to simulate load. Now run it with 100 users and see how that goes.
WARNING: Performing Performance Testing on oracleapex.com violates the ORACLE APEX SERVICE AGREEMENT that you accepted when you signed up.
Version Compatibility
The template supports Oracle APEX 24.2 out of the box.
For earlier or later versions, slight adjustments may be necessary.
Quick Start Guide
You can find the same guide here
Preparation
Download this repo
Download the latest JMeter binaries on the https://jmeter.apache.org/download_jmeter.cgi website (do not download the source)
Extract the binaries to the root folder i.e
/pretius-jmeter-apex-template/apache-jmeter-x.x.x
Start & Configure JMeter Project
Navigate to
/pretius-jmeter-apex-template/apache-jmeter-x.x.x/binand run command./jmeterOpen the project
/jmx/Pretius Starter.jmxExpand tree to find
User Defined Variables& change the variable values to refer to your app e.ghttps://example.com/ords/r/jmeter/jmeter-demoFind
CSV Data Set Configand use the Browse button to change the File Name to point at/users/users.csvModify file
/users/users.csvto add your Usernames & Passwords you want to use.username,password enter_username_here,password_goes_hereAlternatively create a new Default Custom APEX Authentication scheme of:
function my_authentication ( p_username in varchar2, p_password in varchar2 ) return boolean is begin return true; end;Find
JSR223 PostProcessorand use the Browse button to change the File Name to point at/groovy/jsr223.groovyFile > Save
Running the Project
Click on
View Results TreeClick
Clear Allicon in the toolbar
Click
Starticon in the toolbar
Observe the results. Specifically you are looking for a valid redirectURL in the Response Body of the
POST Credentialsstep
Adding Load (users)
Find
Thread GroupAdjust the
Number of Threads (Users)e.g 3Adjust the
Ramp-up period (Seconds)e.g 3Run the Project (see steps above)
Adding Load (DB Load)
In APEX, edit your Home Page.
Add a
Dynamic Content Regionwith the following codeDECLARE l_collection_name VARCHAR2(100) := 'TEST_COLLECTION'; l_member_id NUMBER; l_start_time PLS_INTEGER; l_end_time PLS_INTEGER; l_elapsed_seconds NUMBER; l_result VARCHAR2(4000); BEGIN -- Record start time l_start_time := DBMS_UTILITY.GET_TIME; -- Enable debug logging APEX_DEBUG.ENABLE(p_level => APEX_DEBUG.c_log_level_info); -- 1. Delete the collection if it exists IF APEX_COLLECTION.COLLECTION_EXISTS(p_collection_name => l_collection_name) THEN APEX_COLLECTION.DELETE_COLLECTION(p_collection_name => l_collection_name); APEX_DEBUG.INFO('Collection deleted: %s', l_collection_name); END IF; -- 2. Create a new empty collection APEX_COLLECTION.CREATE_COLLECTION(p_collection_name => l_collection_name); APEX_DEBUG.INFO('Collection created: %s', l_collection_name); -- 3. Fill the collection with 2500 members FOR i IN 1..2500 LOOP l_member_id := APEX_COLLECTION.ADD_MEMBER( p_collection_name => l_collection_name, p_c001 => 'Member_' || i, p_c002 => 'Description for member ' || i, p_c003 => 'Category_' || MOD(i, 10), p_n001 => i, p_n002 => i * 1000, p_n003 => ROUND(i / 10, 2), p_d001 => SYSDATE + i ); IF MOD(i, 500) = 0 THEN APEX_DEBUG.MESSAGE('Added %s members to collection', i); END IF; END LOOP; -- Get final count SELECT COUNT(*) INTO l_member_id FROM apex_collections WHERE collection_name = l_collection_name; APEX_DEBUG.MESSAGE('Total members in collection: %s', l_member_id); -- 4. Delete the collection APEX_COLLECTION.DELETE_COLLECTION(p_collection_name => l_collection_name); APEX_DEBUG.INFO('Collection deleted: %s', l_collection_name); -- Calculate elapsed time l_end_time := DBMS_UTILITY.GET_TIME; l_elapsed_seconds := (l_end_time - l_start_time) / 100; -- Build detailed result message l_result := 'SUCCESS: Created collection with ' || l_member_id || ' members and deleted it. ' || 'Execution time: ' || ROUND(l_elapsed_seconds, 3) || ' seconds (' || ROUND(l_elapsed_seconds * 1000, 1) || ' ms)'; APEX_DEBUG.INFO(l_result); RETURN l_result; END;
Intrepret the Results
Find the Summary Report
Using the HTTP(S) Test Script Recorder
Add the following line to
apache-jmeter-x.x.x\bin\jmeter.propertieswhich is required for Oracle APEX Applications.# Remove Accept-Encoding from recorded headers proxy.headers.remove=Accept-Encoding,If-Modified-Since,If-None-Match,HostQuit & Restart JMeter
The first time you run the recorder, JMeter automatically generates a root certificate file named
/bin/ApacheJMeterTemporaryRootCA.crtIn Firefox, go to Settings (or Options) → Privacy & Security → down to the Certificates section.
Click View Certificates, then Import.
Select the JMeter certificate file
/bin/ApacheJMeterTemporaryRootCA.crtApprove any prompts to trust the certificate for website identification.
Still in Firefox, go to Settings → Network Settings (scroll to the bottom).
Click Settings for Network.
Choose Manual proxy configuration.
Set the HTTP proxy to localhost and port 8888
Check “Use this proxy server for all protocols”.
Click OK to apply changes.
Start browsing/recording the target application; JMeter will capture all HTTP/S requests.
Whats the picture? A clump of Wild Chamomile in a field near The Kestral. Visit Yorkshire!












