Back to Top

How to use JMeter RE in WooCommerce

Updated 31 May 2023

JMeter RE(Regular Expression) in WooCommerce is used to search and manipulate text, based on patterns. JMeter interprets forms of regular expressions or patterns being used throughout a JMeter test plan, by including the pattern-matching software.

For more details regarding Apache JMeter Regular Expression Extractor: Click Here

Steps to use the Regular Expression Extractor in Jmeter

1) Add a Regular Expression Extractor to a Sampler in your Test Plan.

right click on Sampler >> Add >> Post Processors >> Regular Expression Extractor

add_regular_expression

2) Set the name of the variable you want to store the extracted value in the “Name of created variable” field.

Searching for an experienced
WordPress Company ?
Find out More
JMeter_Regular_Expression_Extractor_variable-1

3) In Regular Expression, we can put the literals as per our need so that JMeter fetches the things. Literals must be in () brackets. The regular expression is used to capture dynamic values using (.+?).

For example, “We will add a product to the cart using SKU code” For that we will extract the product SKU, using the (.+?) regular expression.

Here,

dot(.) = Any character except line break

plus(+) = one or more times

question mark(?) = stop when first match succeeds

For more details regarding Regular Expressions: Check Blog

JMeter_Regular_Expression-1

4) Now, we will add Group Number(Template), which are references or pointers to the groups.

It allows us to specify which group value to extract by specifying the group number as,  ‘$1$’ will extract group 1, ‘$2$’ will extract group 2, and so on. $0$ will extract the entire expression.

Jmeter_regular_expression_Template

5) Now, we will add Match No. we can define a number of strings from the complete body.

Let’s suppose in our body one string is present many times then tell JMeter to which string value is fetch by using Match Number. If we give 0 then it will automatically fetch any content.

Jmeter_regular_expression_extractor_in_WooCommerce-1

6) Now we will add Default Value which is used in case the Regular expression does not match. This is an optional field. You may leave it blank.

Jmeter_regular_expression_extractor_in_WooCommerce

7) Add View Results Tree listener for output.

right click on Thread Group >> Add >> Listener >> View result Tree.

Listner_Jmeter_regular_expression

Output

As a result, the product was successfully added to the cart.

product_in-_cart

For more details regarding JMeter Performance Testing, you can check the blog.

That’s all about JMeter RE in WooCommerce.

You can also check our complete WooCommerce plugin list.

For any further queries or suggestions add a ticket to our HelpDesk System.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home