Saturday, December 8, 2018

Performance Testing Techniques for Oracle ADF Applications


1.0 Introduction:

This document gives an insight on the process of creating the performance test scripts for Oracle ADF/Fusion application using HP Loadrunner tool
2.0 Preserving View State, Controller State, and Other ADF Query Parameters:
ADF Faces is stateful and maintains state in two places:
• View state is preserved in a hidden form field on each page. This hidden form field can either contain an ID that is used to locate its view state on the server (server state saving), or it will contain a hexadecimal encoding of the view state (client state saving)
• Controller state and other session info is preserved as query parameters on the URL (e.g.,_adf.ctrl-state, _afrLoop, _afrWindowMode, _afrWindowId, _afPfm, _rtrnI3.0 Important settings in Recording options: 

3.0 Important settings in Recording options: 
Code Generation
HTTP Properties -> Advanced
HTTP Properties -> Advanced -> Header
Add the following headers in the recording header list.
Ø Adf-rich-messag
Ø Adf-ads-page-id
Ø Soapaction
Ø User-agent
Ø Authenticate
ØUA-CPU
Correlations -> Rules
Import the following correlation rules (Everest and SFDC)
Correlations -> Configuration
4.0 Errors and Resolution:
In Oracle ADF application, verification is done based on the snapshot. Comparing the recorded snapshot and replaying snapshot. It should be same except the view state values.

Snapshot is different. Recorded snapshot is XML and replay snapshot is Web Page (Like below)
Resolution:
 Add the following function above the request
Web_add_header(“Adf-Rich-Message”,”true”);
In some test cases, you have to do print which will open a new browser and it gets recorded in the script as well. While replaying that request, Snapshot is different looks like below. 
Resolution:
 Add the following function above the request. Here “_rtrnId_1” is the correlated value and it captured before this request.
web_add_header("adf-dialog-return-id",lr_eval_string("{_rtrnId_1}"));
JSESSION id is created in controller.jsp request under action. While replaying the script for multiple iterations, the script will fail after 1st iteration at controller.jsp request saying that “No match found for JSESSION”
Resolution:
Place the JSESSION correlation in “IF” loop like below.
if(strcmp("{JSESSION}",lr_eval_string("{JSESSION}")) == 0 )
{
    web_reg_save_param_ex(
        "ParamName=JSESSION",
        "LB/IC=\";jsessionid=",
        "RB/IC=\";",
        SEARCH_FILTERS,
        "Scope=Body",
        "IgnoreRedirections=Yes",
        "RequestUrl=*/controller.jsp*",
        LAST);
}
In some requests like copy quote and save quote has unique value captured while recording which is nothing but epoch time in milliseconds. We need to replace that value based on the replay time.
Resolution:
Add the following function above the request. web_save_timestamp_param(“EpochTimeStampNow”,LAST);
EpochTimeStampNow is a LR variable to save the epoch time in milliseconds and it does not need to declare in script. 
There are correlation values like viewstate, viewstatemac, viewstatecsrf, captured as part of script enhancement. These values are passing either web_submit_data or web_custom_request. If the values are passing in web_custom_request, then it needs to be converted to URL format.
Resolution:
Add the following function above the request.
web_reg_save_param_ex(
        "ParamName=viewStateCsrf__1",
        "LB/IC=ViewStateCSRF\" value=\"",
        "RB/IC=\" />",
        SEARCH_FILTERS,
        "Scope=Body",
        "RequestUrl=*/OPTY_AccountPartnerSelection_New_VP*",
        LAST);

Add the following function below the request. web_convert_param("viewStateCsrf__1_URL2",
        "SourceString={viewStateCsrf__1}",
        "SourceEncoding=HTML",
        "TargetEncoding=URL",
        LAST);

Hope this post will help you to understand some basics when you start to work in Oracle ADF application performance testing.
Happy reading 😃

Stack Vs Heap memory in JVM



Basics of Java Memory

Let’s say you have a program running in the server/computer. Then your program need to access your server/computer’s memory.
Why do we need access to the memory?
You program may have variables to assign the data or creating few objects which needs to be stored.
In Java, the memory has been divided into two different categories.
1.       Stack
2.       Heap
JVM Memory Representation

Please note few important information.
·       In JVM, heap memory holds more memory than stack memory in size.
·       In JVM, there are many stacks and only one heap and all threads share the same heap. 
·       In multithread environment, every single thread has its own stack memory. Hence, data in the stack can be used by a thread that owns the stack. You can refer the below diagram.

let us talk about Stack.
What is stack memory?
1.       Stack is nothing, but a data structure managed by JVM. It means that java knows how to allocate the data in stack and when to deallocate them from the stack.
2.       Local variables such as integer, double will be stored in stack memory as their life will be short.
3.       Whenever function is called, the local variable of that function will be pushed on the stack.
4.       When you reach the end of program or end of code block, all local variables of the program/code will be destroyed from the stack and stack will be empty.
5.       Stack memory has been allocated by following first in last out algorithm (FILO). You will understand after seeing the below allocation/deallocation representation.
Allocating data in stack memory


Step # 1: First data (Satheesh) is allocated in to stack memory.
Step # 2: After the first data is allocated the stack memory will be like this.


Step # 3: Second data (Pandian) is allocated in to stack now.
Step # 4: Now the stack will be like below after adding the second data.
Each time when the new data added into the stack, the data which was added first will be pushed down to the bottom of the stack.
Deallocating data in stack memory
When the data scope is completed, it will be deallocated from stack memory. So, the last added data will be removed from the stack first and earlier data will be removed when it comes to the top of the stack.
Hope you understood what is stack and how the memory has been allocated to data in stack memory.
Now let us see what is heap memory.
·       Heap memory allows to store the data which has longer life than function/code block. For example, when you create an object and access through multiple function, the life time of object is long.
·       Objects are created and stored in heap memory and the newly created objected was referenced by a variable. But this variable will be stored in stack memory. 
For example, you are creating some variables in your program like below and let us see how the memory will be allocated in JVM for those variables.
int iLoop = 8;
Customer Satheesh = new Customer();
Customer object can be reference from other function/method as well.
That's all for now. Hope this article gives you some insight about JVM memory allocation.
Happy reading 😃









Linux Series - SED Utility/Package - 4. Deleting Lines

Let’s explore sed’s explicit delete command, which you specify by using the option 'd'. Again, we are using the sample file named &#...