Wednesday, December 18, 2019

Copying a file from one machine to another machine using JMeter



You want to copy a file which is available in your machine to another machine (even shared drive). You can follow the below steps.

Step 1: Add JSR223 sampler in your thread group.
Step 2: Select Language as “groovy (Groovy 2.4.16 / Groovy Scripting Engine 2.0)”. Under Script, please paste this code.
def sourceFile = new File('<Source file full path including filename and extension>')
def destinationFile = new File(‘<Destination file full path including filename and extension>')
destinationFile << sourceFile.text

Before running the script, the destination folder looks like below.
Execute the script in Jmeter
After running the script, the destination folder looks like below.

Simple 😃. Isn't??

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 😃









Wednesday, September 3, 2014

Loadrunner - Errors and Solutions


Problem 1:
When you are downloading the raw data from the graphs in Analysis, sometime you may get the below error.
"The raw data you are trying to retrieve contains too many rows(100001). You can retrieve a maximum of 100000 rows. Would you like to retrieve the first 100000 rows?"





Reason:
By default, Analysis handles not more than 100000 of records in raw data to prevent of the data is loading into memory which could be risk. If the result is more that that value, then raw data is not loaded. 

Solution:

To avoid this error, you can follow the steps.

1. Close all Loadrunner related files. Go to the Loadrunner installation path



2. Open "GeneralSetting.txt" document in notepad.
3. Go to the section [General] and add the below text under [General] section.
                RawDataLimit=100000000

Where, 100000000 is the maximum raw data value which you mentioned. You can mention any value as per your requirement. 


Now Open Analysis and download the raw data without any issues. Simple, isn't it?

Problem 2:
When you are executing the test in Performance center/Controller, sometime you may get the below error.
"Error: The user files were not transferred to the local load generator"


Reason:
The parameter file in the script got corrupted while uploading the script in performance center/controller. 


Solution:

To avoid this error, you can follow the steps.

1. Go to the script folder and open the <script name>.prm file in any text editor.
2. Search 'Table=' and check the parameter file name against Table=*.dat. It needs to be same. Or else, please update the name in <script name>.prm with case sensitive. Refer the snapshot below.

Now upload the script in zip format in performance center/controller and execute the test. Simple, isn't it?

After made the above changes, still you are facing an issue. No worries. Follow the below steps.
1. Delete the script from performance center/controller.
2. Change the script name in your local copy. (Make sure script name is small)
3. Then upload the script again to performance center and execute it.


Problem 3:
When you are replaying the script in VuGen, sometime you may get the below error.
"Error -27780: [GENERAL_MSG_CAT_SSL_ERROR]connect to host "<Application URL>" failed: [10054] Connection reset by peer"


Reason:
Application is using SSL version TLSv1, however while running the script from Loadrunner, by default it is sending SSL version SSL2/3. This is the root cause of the problem

Solution:

To avoid this error, you can follow either one of the steps mentioned below.

a) Include the below statement at the first line of Vuser_init section.


                web_set_sockets_option("SSL_VERSION","TLS"); 

b) In the recording options, Go to Port Mapping -> Options -> Click on "Enable auto SSL detection" and select SSL version as "TLS 1.x". Then Click on Update and save the changes.

Then regenerate the script with the updated settings. 

Now Open the script in VuGen and replay it without connection reset error. Simple, isn't it?

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