I have to performance test an e-commerce web-application using Jmeter.
One flow is like Search > select any product > Add to Cart.
Here I have to select any random product from the search results and proceed.
Can you please guide me on how to select any random product and proceed?
I am using Jmeter 2.11.
You can follow below sequence,
(If you know how many products are there then)
1. add random variable with values 1-no. of products. this will generate random values for each user/iteration
2. use values from random variable (var1) in regular expression extractor for random occurance (var1 occurance which is random every time)
(If you dont know how many products are present and if your response contains no. of products count then)
1. In first regular expression extract count of products in a variable
2. add random variable with values 1-value for first regex. this will generate random values for each user/iteration
3. use values from random variable (var1) in regular expression extractor for random occurance
I have used similar technique in my assgn. attaching snapshots for reference.
Random selector
first regex for count
random variable
2nd regex for random oocurance
you can modify regex as per your requirement.
Related
I have 2 columns - Matches(Integer), Accounts_type(String). And i want to create a third column where i want to get proportions of matches played by different account types. I am new to Talend & am facing issue with this for past 2 days & did a lot of research but to no avail. Please help..
You can do it like this:
You need to read your source data twice (I used tFixedFlowInput_1 and tFixedFlowInput_2 with the same data). The idea is to calculate the total of your matches in tAggregateRow_1, it simply does a sum of all Matches without a group by column, then use that as a lookup.
The tMap then joins your source data with the calculated total. Since the total will always be one record, you don't need any join column. You then simply divide Matches by Total as required.
This is supposing you have unique values in Account_type; if you don't, you need to add another tAggregateRow between your source and tMap_1, in order to get sum of Matches for each Account_type (group by Account_type).
Like there are lots of values in array
{"profile":"qa","job":"active","status":"green"}
{"profile":"dba","job":"non-active","status":"yellow"}
So there are multiple rows like this, I want to fetch profile and job of all the arrays randomly and it should be like that, if profile is selected as qa randomly say by regular expression post processor, then job value should also be "active" i.e
Same for dba profile, that if dba is fetched , then job value should be non active
Can this be achieved using regular expression for random fetch??i. giving match no as 0
As you are dealing with JSON responses, hence would recommend you to use JSON extractor post processor as $..['job','profile'] and set Match number to 0. This way you can extract values from array in one go.
You can use this variable name highlighted in subsequent requests like - ${entryJson}
For Regular expression you can use profile": "(.?)" and job": "(.?)"
in two of the expressions but using zero will return different values for each run.
I have a column called "Masterlist" which contains values from Lists 1, 2 and 3. It also contains values which are present only in Masterlist.
How can I filter them, like shown at the attached image in Google Sheets?
EDIT: The lists will have more than one entries.
Solution 1
In E2, type in
=filter(A2:A,arrayformula(iserror(match(A2:A,B2:D2,0))))
Check the documentation of filter or match for how to use them. With match, be sure to include the third argument. That is an easy one to forget. arrayformula iterates a formula over a range. The output can be a range, in which case it will print over any un-written cells. When arrayformula interacts with match, it only iterates over the first argument, which is why this solution works.
EDIT: If you have a two-dimensional range to match to, you need to collapse them into a one-dimensional range using the concatenation operators such as
=filter(A2:A,arrayformula(iserror(match(A2:A,{B2:B4;C2:C4;D2:C4},0))))
You can experiment with endings without row indices and let Google Sheets select an ending index for you.
Solution 2
Use the native Filter View feature. Good for the scenarios where you don't need to separately print a list of the unique values in "masterlist".
Go to Data -> Create Filter View
Use the relevant help pages to navigate yourself. I can see a few ways to implement what you desire, including
filter by value on the same column (selecting the actual values manually);
filter by value on a "helper column" where you include a formula in the cells to check whether the content in "masterlist" belongs to the list you want to check against. You can use the match and iserror combo here;
custom formula using a similar formula as above.
If your column A, ie. the "masterlist", is something a user would add to, then Data Validation can be used to good effect in conjunction with Filter View.
I'm creating a dashboard in Excel 2010 that uses the VLOOKUP function to call another sheet's values.
The equation I'm using is this:
=VLOOKUP(L$1,Sheet_B!$A:$H,7,2)
L$1 asks for a unique identifier on Sheet_A, and then finds that ID on Sheet_B and then finds the corresponding data and pulls it.
The problem is this:
If I do nothing to Sheet_B, I'll get a value - let's say 5. This value is incorrect.
If I sort Sheet_B from A-Z alphabetically (which doesn't change the data) I'll get a totally different value - let's say 12 - which is the correct value.
The problem is that the data that the VLOOKUP function examines hasn't changed, only how it was sorted in Sheet_B.
Is there any reason why this might happen? And more importantly, how can I fix it so I don't have to keep sorting Sheet_B every time I pull this dashboard?
If your 4th parameter equals True (2 in your case), VLOOKUP tries to find an approximate match, so you need the values in the first column of table_array to be placed in ascending order.
If you change it to 0 (equivalent to False), VLOOKUP will try to find an exact match, and so will not need to be sorted.
Therefore, you should change your VLOOKUP to:
=VLOOKUP(L$1,Sheet_B!$A:$H,7,0)
You can read more in this Microsoft Office Support article..
I need to select a random number of product details from XML and have multiple conditions.
The below selects 8 products, but they are not random - how to make this random?
$randomProducts = $prod_xml->xpath("/products/product[position()<
9]");
The below makes a selection on multiple conditions.
$featuredProducts = $prod_xml->xpath('/products/product[featured =1
and hidden !=1]');
How do I combine the two to get random featured products that are not set to hidden?
Depending on whether you want first to get all non-hidden and featured products an then select 8 of them, or get 8 products and then select all of them that are featured and non-hidden, you will have two different XPath expressions:
/products/product[featured =1 and hidden !=1][position() < 9]
and correspondingly:
/products/product[position() < 9][featured =1 and hidden !=1]
Now, the "random" part ...
Neither XPath 1.0 nor XPath 2.0 (or even the W3C working drafts for XPath 3.0 and its standard functions) have a function that returns a pseudo-random sequence of integers (or of anything).
Therefore, you have to form this sequence of eight pseudorandoms and generate an XPath expression as this:
/products/product[featured =1 and hidden !=1]
[contains('|3|5|12|19|4|23|11|7|', concat('|',position(),'|)) ]