<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Endercan Yılmaz on Medium]]></title>
        <description><![CDATA[Stories by Endercan Yılmaz on Medium]]></description>
        <link>https://medium.com/@ylmzendercan?source=rss-36adc6eb32ba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Endercan Yılmaz on Medium</title>
            <link>https://medium.com/@ylmzendercan?source=rss-36adc6eb32ba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 07:44:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ylmzendercan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[HOW TO USE “-1”/ALL ON JMETER SELECTOR]]></title>
            <link>https://medium.com/@ylmzendercan/how-to-use-1-all-on-jmeter-selector-cb85e0c6070e?source=rss-36adc6eb32ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb85e0c6070e</guid>
            <category><![CDATA[stress-testing]]></category>
            <category><![CDATA[load-testing]]></category>
            <category><![CDATA[jmeter]]></category>
            <category><![CDATA[testing-tools]]></category>
            <category><![CDATA[selectors]]></category>
            <dc:creator><![CDATA[Endercan Yılmaz]]></dc:creator>
            <pubDate>Tue, 21 Dec 2021 11:03:20 GMT</pubDate>
            <atom:updated>2021-12-21T11:03:20.173Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G3ilNZc5yo-2QvHai7nVrA.png" /></figure><p>While scripting E-Commerce sites, situations, where cart service is not called after cart delete service, can be faced. It forces us to make only one request to cart and delete every item on cart one by one, without calling the cart request again.</p><p>Since the cart request is called only once, we have to get IDs of every item in the cart in only one selector. <br>In this blog, you will see step by step how to overcome such situations.</p><p>You can also apply this solution to JSON and REGEX Extractors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A2GoZIX8KT10D4mnxmYAPw.png" /></figure><p>First, we login and add a random number of products to our cart. When we test our CSS Selector in response data of cart request, we can see we have 12 products in cart.</p><p>Here is our CSS Selector Extractor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yP6zR7dSxkc6jv_vhmqzsQ.png" /></figure><p>Let ‘s use a Debug Sampler and see what using –1 on Match Number brings us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HRFUhhjI-xFS_no8jBjnEw.png" /></figure><p>As we can see, when we select all with –1 on CSS Selector Extractor, it numbers our variables as “variable_1–12” and shows us number of results found as “variable_matchNr”.</p><p>To be able to use all these variables and make them dynamic, we are going to put all of them in an array. We will be using JSR223 PostProcessor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XF2-MeYdmYHqyox_R4TW0A.png" /></figure><p>I created a ”productIds ArrayList” and added each ID to this array. I reached these variables using “vars.entrySet()”. Finally, I used “vars.putObject()” because I want my array to be reachable by the following requests as well.</p><p>Now we have to get our service for deleting product in my cart into a Loop Controller. Since I want to call it for every product, I set my Loop Count as “${productsInCart_matchNr}” which was created automatically depending on product number in cart as we saw in previous steps. It is 12 in our scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i8dOkFj1en_iHbYbwAMYpA.png" /></figure><p>In our delete service, we set our product ID as “${productToRemove}” so that we can change it dynamically in every iteration of our loop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HYJDGyEtZlL-lT2Qea7tKw.png" /></figure><p>Now I am adding a JSR223 PreProcessor to my deleting service, just to manipulate my “${productToRemove}” variable on each iteration before calling the service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wVxAlbqcUtBxQAhLQcgWhg.png" /></figure><p>This part is a little tricky. Now I am reaching “productInCartArray” with “vars.getObject()” and setting it to a new array which I defined as “getArray”. After that, I am setting my “${productToRemove}” variable which I mentioned in previous step to first index of my “getArray”. Now we are able to delete our first product.</p><p>But don’t forget, this PreProcessor will be called on each iteration, so if I don’t remove the element I have already used from the array, my “${productToRemove}” will never change again. So, I am removing the index I already used with “getArray.remove(0)” and putting my new array without the already used ID to “productsInCartArray”. So, on 12 loop iterations, I will be getting a different index every time my PreProcessor runs.</p><p>I am getting my array, getting the first index of array and setting it to a variable. I am removing the first index and replacing it with my base array.</p><p>At the end of all iterations, I will end up with no IDs in my array and an empty cart. <br>Let’s run the script and see the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BprPajQtLPe_8xUhoNPe4Q.png" /></figure><p>The number of products in my cart was 12. As you can see, my delete service was called 12 times with 12 different IDs, and I ended up with an empty “productsInCartArray”.</p><p>Let’s double check it on response data of cart service as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0r1UraBClgp4e1wVeO7h1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZAnZ75ZO0j-8-dWe116zDA.png" /></figure><p>There is no product left in my cart. :)</p><p>Thank you for your time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb85e0c6070e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>