Get Knowledge from Video instead of Content:

Monday 24 October 2016

JMeter - Methods to find out Dynamic Value



The content has been moved to PerfMatrix site.



JMeter Issue - Unsupported major.minor version

The content has been moved to PerfMatrix Site.

Link: https://www.perfmatrix.com/unsupported-major-minor-version/


JMeter Issue - Connection refused to host

The content has been moved to PerfMatrix Site.

Link: https://www.perfmatrix.com/connection-refused-to-host/


JMeter Issue - Server failed to start: java.rmi.server.ExportException

PerfMatrix Site Link: https://www.perfmatrix.com/server-failed-to-start-java-rmi-server-exportexception/

Problem: Server (Host) error while running the JMeter test in distributed (remote) mode

Description: To run the test in distributed mode, it is mandatory to start 'jmeter-server' service on all the slaves. While starting this service below exception is thrown:

Server failed to start: java.rmi.server.ExportException: Listen failed on port: 0; nested exception is:
        java.io.FileNotFoundException: rmi_keystore.jks (No such file or directory)
An error occurred: Listen failed on port: 0; nested exception is:
        java.io.FileNotFoundException: rmi_keystore.jks (No such file or directory)

Error Screenshot:
Solution: Follow the below steps to resolve this issue:
1. Open <JMETER_HOME>/bin/jmeter.properties
2. Search for the keyword 'server.rmi.ssl.disable'
3. Uncomment the statement and update its value to 'true'.


JMeter - Random Dynamic Value (via RegEx)

The content has been moved to PerfMatrix Site.

Link: https://www.perfmatrix.com/random-dynamic-value-using-regular-expression-extractor/

Extract multiple values using same Regular Expression


How to extract more than one value using the same regular expression?

Many of us face this situation when we need to extract more than 1 dynamic values from the response which need to be passed in the successive requests. The simplest example "If a performance tester wants to fetch three values which are Customer Name, Customer ID, and LicenseId, then either he needs to write two regular expressions or he needs to write such an expression which can extract all the values at a time". Let's understand this situation more practically. Consider that the response of a page is:
{"domain": "", "localization": "de-DE", "gateWay": "http://public-gateway-cloud-perfmatrix.com", "identityProvider": "http://public-gateway-cloud-perfmatrix.com/api/v1/identity-provider", "customerDNS": "General", "customerName": "PerfMatrix","staticCacheService": "static-cache-service-cloud-perfmatrix.com", id":"20476939-8465-42f4-adcd-61455d9d830e","parentId":null,"customerId":"1234567","orderId":"7bc1779f-735f-410a-ad6f-4f7455d41312","licenseId":"73fb4c45-771d-4cd1-a6d6-c54406407c78","name":"HP LoadRunner License","status":"Active","childrenCount":0,"licensed":true,"purchaseDate":1511266812000,"expirationDate":1542802812000}
A post-processor regular expression extractor is added under the sampler whose response (above) having all these 3 values.

The Pattern and Regular Expression to extract required 3 values will be:

Pattern: 
LB1(Token1)RB1.*LB2(Token2)RB2.*LB3(Token3)RB3
Note: '.*' is used to ignore the text between two tokens.

Regular Expression:
"customerName":"(.*?)",.*"customerId":"(.*?)",.*"licenseId":"(.*?)",
where:
LB1 ="customerName":"
(Token1) = (.*?)
RB1 = ",
LB2 ="customerId":"
(Token2) = (.*?)
RB2 = ",
LB3 ="licenseId":"
(Token3) = (.*?)
RB3 = ",
Template:
It helps to form groups from the response. The sysntex is $1$, $2$ and so on. The count depends on the number of dynamic values you are extracting from the response. In our example we need to extract 3 values, hence we used $1$$2$$3$ which will create 3 groups or variables and store the extracted values, so :
$1$ refers to value of "customerName":"(.*?)"
$2$ refers to value of "customerId":"(.*?)"
$3$ refers to value of "licenseId":"(.*?)",

Output:
multiValueRegEx_g1 = PerfMatrix
multiValueRegEx_g2 = 1234567
multiValueRegEx_g3 = 73fb4c45-771d-4cd1-a6d6-c54406407c78
  
How to use reg-ex variable having multiple extracted values in the script?
You can use these variables with the help of groups which is formed by the template (explained above). Hence when you want to pass customer name, you can use ${multiValueRegEx_g1 }, for customer ID you can use ${multiValueRegEx_g2} and for license ID you can use ${multiValueRegEx_g3} as a variable i.e just append _g<groupNumber> to regular expression variable. 

To get more understanding of Regular Expression and correlation, refer below links:

How does JMeter simulate web-browser?





The content has been moved to PerfMatrix Site.



Saturday 1 October 2016

JMeter - How to simulate network speed?


The content has been moved to PerfMatrix Site.

Link: https://www.perfmatrix.com/how-to-simulate-network-speed-in-jmeter/


JMeter - Regular Expression Extractor vs Boundary Extractor



The content has been moved to PerfMatrix Site. 

Link: https://www.perfmatrix.com/regular-expression-extractor-vs-boundary-extractor/



JMeter - Nested Variable Handling



The content has been moved to PerfMatrix Site.

Link: https://www.perfmatrix.com/how-to-pass-one-variable-into-another-in-jmeter/

Update Parameter Value at Each Occurrence



The content has been moved to PerfMatrix Site.

Link: https://www.perfmatrix.com/update-parameter-value-at-each-occurrence-in-jmeter/

Exclude Response Time of a Sampler in JMeter


The content has been moved to PerfMatrix Site.

Link: https://www.perfmatrix.com/exclude-response-time-of-sampler-in-jmeter/

JMeter - How to get current date and time in seconds?

The content has been moved to PerfMatrix Site. 

Link: https://www.perfmatrix.com/how-to-get-current-date-and-time-in-seconds-in-jmeter/


RegEx in JMeter

How to use Reg-Ex in JMeter?
You can add Reg-Ex component under those request samplers whose response contain a dynamic value.

1. Right Click on request
2. Add->Post-Processors->Regular Expression Extractor
Apache JMeter Regular Expression


3. Provide Reference Name, Regular Expression Statement (along with unique left and right boundaries), template, Match No. and Default Value.
Apache JMeter Regular Expression

4. Choose where this Reg-Ex is applicable. 
  • Main sample only: Search in the main sample only
  • Sub-samples only: Search in the sub-samples only
  • Main sample and sub-samples: Search in both sample and sub-samples
  • JMeter Variable: Assertion is to be applied to the contents of the named variable

5. You need to specify "Field to check" where dynamic value can be found.
  • Body: In the body of the response
  • Body (unescaped): In the body of the response, with all HTML escape codes replaced. Note that this option highly impacts performances, so use it only when absolutely necessary and be aware of its impacts
  • Body as a Document - the extracted text from various type of documents via Apache Tika. Note that this option highly impacts performances, so use it only when absolutely necessary and be aware of its impacts
  • Request Headers: In request header
  • Response Headers: In response header
  • URL: In request URL
  • Response Code: HTTP status code
  • Response Message: In response body as a message
          6. Match No.: Reg-Ex matching is applied to all qualifying samples. For example, if there are the main sample and 2 sub-samples, each of which contains a single match for the regex, (i.e. 3 matches in total). For match number = 2, Sub-samples only, the extractor will match the 2nd sub-sample. For match number = 2, Main sample and sub-samples, the extractor will match the 2nd sub-sample (1st match is the main sample). For match number = 0 or negative, all qualifying samples will be processed. For match number > 0, matching will stop as soon as enough matches have been found.

          7. Default Value: If the regular expression does not match, then the default value will be set to a reference variable.

          Tip: You can use debug sampler to check captured reg-ex value.

          Related Topic:


          How to execute JMeter test in Non-GUI mode?


          The content has been moved to PerfMatrix Site. 

          Link: https://www.perfmatrix.com/jmeter-non-gui-mode/


          JMeter - HTML Report is empty


          The content has been moved to PerfMatrix Site. 

          Link: https://www.perfmatrix.com/blank-jmeter-html-report/


          JMeter - How to capture last value using regular expression?


          The content has been moved to PerfMatrix Site. 

          Link: https://www.perfmatrix.com/capture-last-dynamic-value-in-jmeter/

          Understand more practically - The sharing mode of "CSV Data Set Config"


          The content has been moved to PerfMatrix Site 


          How to render dynamic links in Apache JMeter?


          The content has been moved to PerfMatrix Site. 



          JMeter - Exclude Timer from Response Time

          PerfMatrix Site Link: https://www.perfmatrix.com/exclude-think-time-in-jmeter

          Problem: How to exclude timers time (think time or wait time or pause time) from the transaction response time in JMeter?

          Solution: In the transaction controller, there is one option "Include duration of timer and pre-post processors in generated sample". Uncheck this option, so that JMeter does not include wait time (or timer) in the sampler response time. By default, this option is unchecked.



          JMeter - Exclude Pre-Processor and Post-Processor Execution Time

          The content has been moved to PerfMatrix Site.

          Link: https://www.perfmatrix.com/exclude-processor-execution-time-in-jmeter