Tuesday 23 May 2023

Converting Fiddler Session To load runner script | Fiddler to generate load runner vugen script

To convert Fiddler traffic to a LoadRunner script, you can follow these general steps:


1. Capture Traffic in Fiddler: Launch Fiddler and start capturing the desired traffic by clicking the "Start Capture" button. Perform the actions you want to record, such as navigating through web pages or interacting with a web application.

2. Export Traffic Sessions: Once you have captured the necessary traffic, go to Fiddler's "File" menu and choose "Export Sessions > All Sessions" to save the captured traffic sessions to a file on your computer.

3. Convert Sessions to LoadRunner Script: Now, you need to convert the exported sessions into a LoadRunner script format. This process involves parsing the captured traffic and generating the corresponding script code. LoadRunner does not have a direct built-in feature for importing Fiddler sessions, so you'll need to use a third-party tool or script to perform the conversion.

One popular approach is to use a tool called "Fiddler2LR" developed by the LoadRunner community. It is an open-source tool that converts Fiddler sessions to LoadRunner scripts. You can find the tool and instructions on how to use it on GitHub or other community websites. Alternatively, you can write a custom script or use a programming language of your choice to parse the exported sessions and generate the LoadRunner script code manually. This approach requires more technical expertise and knowledge of LoadRunner's scripting language.

4. Adjust Script Logic: After the conversion, review the generated LoadRunner script code and make any necessary adjustments or enhancements. LoadRunner scripts often require modifications to handle dynamic values, correlations, think times, and other performance testing-related considerations.

5. Import and Enhance the Script in LoadRunner: Finally, import the generated LoadRunner script into the LoadRunner IDE or controller, where you can further enhance it by adding performance test scenarios, configuring load profiles, adjusting user profiles, and specifying other test parameters as needed.

Remember that the process of converting Fiddler traffic to a LoadRunner script may vary depending on the complexity of your application and the specific requirements of your performance test. It's crucial to have a good understanding of LoadRunner scripting and performance testing concepts to ensure an accurate and effective conversion.

Monday 22 May 2023

Call one sampler (HTTP) from another sampler (JSR223) in JMeter | Jmeter Sampler Integration

 Yes, it is possible to call one sampler (HTTP) from another sampler (JSR223) in JMeter. JMeter provides flexibility to customize and control the flow of your test plan using various components, including JSR223 samplers.

To call an HTTP sampler from a JSR223 sampler, you can use the JMeter API within the JSR223 sampler code. Here's an example of how you can achieve this:

1. Add a JSR223 Sampler to your test plan.
2. Choose the appropriate language (e.g., Groovy) for the JSR223 sampler.
3. Write your custom code in the script area of the JSR223 sampler to call the HTTP sampler using the Jmeter API.



Groovy Code:

import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy;

// Get the HTTP sampler by its name
def httpSampler = ctx.getCurrentSampler().getThreadContext().getVariables().getObject("HTTPSamplerProxy")

// Make sure the HTTP sampler is not null
if (httpSampler != null) {
    // Execute the HTTP sampler
    def httpResult = httpSampler.sample()
    
    // You can access the response code, response message, and other details from the HTTP result
    int responseCode = httpResult.getResponseCode()
    String responseMessage = httpResult.getResponseMessage()
    
    // Process the HTTP result as needed
    // ...
}

In the above example, we obtain the HTTP sampler using the `getObject()` method from the JMeter `ThreadContext` and then execute the HTTP sampler using the `sample()` method. You can access and process the response details according to your requirements.

Please make sure you have properly configured and added the HTTP sampler to your test plan before using it within the JSR223 sampler. Remember to replace the language-specific code (`groovy` in this example) if you choose a different language for your JSR223 sampler.

Thursday 18 May 2023

IP Spoofing in Jmeter | How to do ip spoof in jmeter?

What is IP spoofing?

IP spoofing is the creation of Internet Protocol (IP) packets which have a modified source address in order to either hide the identity of the sender, to impersonate another computer system, or both. It is a technique often used by bad actors to invoke DDoS attacks against a target device or the surrounding infrastructure.



In JMeter, you can simulate IP addresses by using the "HTTP Request Defaults" configuration element along with the "HTTP Header Manager" and "User Defined Variables" components. 

Steps to do IP Spoofing in Jmeter:

1. Open your JMeter test plan.
2. Add a "HTTP Request Defaults" configuration element by right-clicking on your Test Plan and selecting "Add > Config Element > HTTP Request Defaults."
3. In the "HTTP Request Defaults" panel, enter the target server's IP address or hostname in the "Server Name or IP" field.
4. Add a "User Defined Variables" component by right-clicking on your Thread Group and selecting "Add > Config Element > User Defined Variables."
5. In the "User Defined Variables" panel, define a variable for the IP address you want to spoof. For example, you can set a variable name like `ip_address` and assign a value like `192.168.1.100`.
6. Add a "HTTP Header Manager" component by right-clicking on your Thread Group and selecting "Add > Config Element > HTTP Header Manager."
7. In the "HTTP Header Manager" panel, click on the "Add" button and set the following fields:
- Name: `X-Forwarded-For`
- Value: `${ip_address}` (referring to the variable defined in step 5)

Now, when you send requests using JMeter, it will include the `X-Forwarded-For` header with the spoofed IP address.

Thursday 4 May 2023

Whats the use of web_set_rts_key function in load runner | Overwrite HTTP erros in load runner

web_set_rts_key("key=HttpErrorsAsWarnings","Value=1",LAST);
web_set_rts_key("key=HttpErrorsAsWarnings","Value=0",LAST);

The `web_set_rts_key` function in LoadRunner is used to set custom key-value pairs in the Run-Time Settings (RTS). The RTS contains various settings that control how a script behaves during replay, including settings related to logging, timeouts, and error handling.

The `web_set_rts_key` function allows you to customize the RTS by setting custom key-value pairs. One common use of this function is to set the `HttpErrorsAsWarnings` key to a value of `1`. This tells LoadRunner to treat HTTP errors (such as 404 Not Found errors) as warnings rather than errors. When a HTTP error is treated as a warning, LoadRunner continues replaying the script instead of stopping the replay. The `web_set_rts_key("key=HttpErrorsAsWarnings","Value=1",LAST)` function is used to set a custom key-value pair in the RTS that tells LoadRunner to treat HTTP errors as warnings during replay. This can be useful in certain situations where you want the script to continue running even if it encounters HTTP errors.

If you use web_set_rts_key("key=HttpErrorsAsWarnings","Value=0",LAST); the `HttpErrorsAsWarnings` key is set to a value of 0. This key controls whether HTTP errors are treated as warnings or errors. When `HttpErrorsAsWarnings` is set to 1, HTTP errors are treated as warnings, and the Vuser continues executing the script. When it is set to 0, HTTP errors are treated as errors, and the Vuser stops executing the script and fails the transaction.

 `web_set_rts_key("key=HttpErrorsAsWarnings","Value=0",LAST)` is used to set the `HttpErrorsAsWarnings` key to 0, which makes HTTP errors treated as actual errors in the LoadRunner/VuGen performance testing script.

Tuesday 2 May 2023

Recording Excel with Macro Enabled in LoadRunner | Record excel with load runner


To record an Excel sheet with macro enabled in LoadRunner, you will need to use a combination of the Windows Sockets protocol and the Microsoft Excel Add-In protocol. Here are the steps you can follow:

1. Open LoadRunner and create a new script.
2. In the Vuser Protocols dialog box, select "Windows Sockets" and click "OK".
3. In the Recording Options dialog box, select "Launch the following application" and enter the path to the Excel application with the macro enabled.
4. Click "Advanced" and select "Microsoft Excel Add-In" from the list of protocols.
5. Click "OK" to close the Advanced dialog box and "OK" again to close the Recording Options dialog box.
6. Start the recording process and perform the desired actions in Excel, including running the macro.
7. Stop the recording process and save the script.Once you have recorded the script, you can modify it to add the necessary parameters and data for your performance test, including any additional steps required to run the macro as part of the test.

Performance Testing automation in Azure Boards using JMeter

To perform performance testing in Azure Boards using JMeter tool, you can follow these steps:

1. Create a new repository in Azure DevOps that will hold the JMeter test plan file and any supporting files that are needed.

2. In the repository, create a new folder for the JMeter test plan and any supporting files. 

3. Add the JMeter test plan file and any supporting files to the folder.

4. Create a new build pipeline in Azure DevOps that will run the JMeter test.

5. Add the JMeter extension to the build pipeline.

6. Configure the JMeter extension to use the JMeter test plan file and any supporting files in the repository.

7. Set the build pipeline to run on a schedule or to trigger when a new build is created.

8. Run the build pipeline and view the JMeter test results in the build summary.

9. Analyze the test results and identify any performance issues that need to be addressed.

10. Use the insights gained from the test results to make improvements to the application or system under test.