<?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 Beyza Barut on Medium]]></title>
        <description><![CDATA[Stories by Beyza Barut on Medium]]></description>
        <link>https://medium.com/@beyzabarut?source=rss-5d5ec6840acc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*x-amurX4xb2Y8UsHlZl3Mw.jpeg</url>
            <title>Stories by Beyza Barut on Medium</title>
            <link>https://medium.com/@beyzabarut?source=rss-5d5ec6840acc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 20:38:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@beyzabarut/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[Creating a Runner in Postman]]></title>
            <link>https://medium.com/@beyzabarut/create-a-runner-with-postman-a92e1f78fc0a?source=rss-5d5ec6840acc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a92e1f78fc0a</guid>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[swagger]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[postman]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Beyza Barut]]></dc:creator>
            <pubDate>Sat, 23 Mar 2024 20:44:38 GMT</pubDate>
            <atom:updated>2024-04-01T18:25:17.730Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will create a runner in Postman. Runner in Postman helps us run many tests with one button. You can run your test cases easily and quickly, step by step, by clicking a button.</p><p>Let’s take a look at what we will do. We’ll use <a href="https://petstore.swagger.io/">https://petstore.swagger.io/</a> for CRUD functions and the following cases will be involved in the runner:</p><ul><li>Create user</li><li>Update user</li><li>Get a user</li><li>Delete user</li></ul><p>Firstly we’ll import the endpoints to Postman. Click the Import button and paste this URL <a href="https://petstore.swagger.io/v2/swagger.json">https://petstore.swagger.io/v2/swagger.json</a> to here ⬇️</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a9vzVLK-IF-xaKJYxzbkNw.png" /><figcaption>Import a collection</figcaption></figure><p>then click the Import button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X6ylPNtTuUi1rRhWycj-_A.png" /><figcaption>Import a collection</figcaption></figure><p>We’ve imported all the endpoints, but I’ll separate the endpoints we’ll be using by creating a new collection. It should be like this ⬇️</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*DJipaQIxPGqd0QhDNMhaVA.png" /><figcaption>Collection</figcaption></figure><p>We’re ready to start 💃 We’ll check the required fields in the endpoint and ensure we include them all in the body.</p><p>We can start with the create user endpoint. There are no specific required fields in the create user endpoint, we can send the body with any field.</p><p>How can we understand if the fields are required from the Swagger endpoint?</p><p>As you can see there is info for the body like <strong>* required</strong>, which means the body is required. If you see this sign <strong>*</strong> for any field in the model it also means that field is required. For example, if you see this -&gt; <strong>id*</strong>, it means the id is required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wXqVC1rPfDfzp-j6jekS3g.png" /><figcaption>Create user endpoint</figcaption></figure><p>So we’ll send the request as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQymibZUB9CYL3H0zxCWCQ.png" /><figcaption>The request</figcaption></figure><p>We’ll use ID and username from the collection variables that’s why their values are like this 👇</p><p>{{id}} -&gt; it’s an integer</p><p>“{{username}}” -&gt; it’s a string value</p><ul><li>The collection variables are useful for the runner. If you use the collection variables for the variables, you don’t have to change their values manually. The values change automatically with the tests you write.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-aBsxt6DV5MrnVWLn4hy8A.png" /><figcaption>Collection Variables</figcaption></figure><p>The swagger we will use is used by many people and the IDs used may be the same.</p><p>I’ll use this <strong><em>{{$randomInt}}</em></strong> to generate a random value for ID to solve this problem. It creates a 3-digit number. It is not a suitable value for ID but it is useful to use it this way for the accuracy of our test.</p><ul><li>There is a script to generate a random ID and it is much better to generate a random ID like this. If you use it, it should be in pre-request script.</li></ul><pre>pm.collectionVariables.set(&#39;id&#39;, Math.floor(Math.random() * 1000))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lm9f-t3wcY1OyHRdQMlmXQ.png" /><figcaption>Pre-request script</figcaption></figure><ul><li>We can start our tests. So we’ll write some tests to check if the response status is successful and the values in the response are correct.</li></ul><p>There are snippets on the right, you can use them also.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8MYmEsTYxsUqk17mZcy6gg.png" /><figcaption>Tests</figcaption></figure><pre>pm.test(&quot;Status code is 200&quot;, function () {<br>    pm.response.to.have.status(200);    // We&#39;re checking if the status code is 200.<br>});<br><br>let response = pm.response.json();<br>pm.collectionVariables.set(&quot;id&quot;, response.message); // We&#39;re setting the ID value from the response to the collection variables.<br><br>let id = pm.collectionVariables.get(&quot;id&quot;); // We&#39;re setting the ID value from the collection variables.<br><br>pm.test(&quot;ID is &quot; + id, function () {<br>    var jsonData = pm.response.json();<br>    pm.expect(response.message).to.eql(id);  // We&#39;re checking the ID if it&#39;s the same as the ID in the response.<br>});</pre><p>The request and tests are ready to send so we’ll send the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TToTVo4KHRb-GWA8uje1CQ.png" /><figcaption>The request</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYVpoCcYtd-HzyBcy36fNw.png" /><figcaption>The response</figcaption></figure><p>Test results are the pass so the create endpoint test is successful, and we can continue with the Get endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zMkunQKWTid0rUSxz4821A.png" /><figcaption>Test Results</figcaption></figure><p>We use the get endpoint to get fields and their values about the record. We need a username to use this endpoint. We’ll get the username from the collection variables. We should set the value as <strong><em>{{username}}</em></strong> to use from the collection variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fDCJXgFgPVz44DmLfRR40Q.png" /><figcaption>Path variables</figcaption></figure><p>We’ll write some tests for this endpoint.</p><pre>pm.test(&quot;Status code is 200&quot;, function () {<br>    pm.response.to.have.status(200);<br>});<br> <br>let response = pm.response.json();<br>let id = pm.collectionVariables.get(&quot;id&quot;);<br><br>let username = pm.collectionVariables.get(&quot;username&quot;); // We&#39;re setting the username value from the response to the collection variables.<br>let firstName = pm.collectionVariables.set(&quot;firstName&quot;, response.firstName); // We&#39;re setting the firstname value from the response to the collection variables.<br>let lastName = pm.collectionVariables.set(&quot;lastName&quot;, response.lastName) // We&#39;re setting the lastname value from the response to the collection variables.<br><br>pm.test(&quot;ID is &quot; + id, function () {<br>    var jsonData = pm.response.json();<br>    pm.expect(response.id).to.eql(parseInt(id));<br>});</pre><p>Finally, we’ll send the request. The response and test results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*0CkFGFGqpOppiosWyV6j9g.png" /><figcaption>The response</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*AorPWOoJjGzw20lwNthKpA.png" /><figcaption>Test Results</figcaption></figure><p>Okay, the get endpoint’s test is done so we’ll update the values with the put endpoint. We need a username and ID. We’ll get them from the collection variables like the previous ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U_nB1emA0zkZ94smITpf0Q.png" /><figcaption>The request</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*borSWTFPl68WPr72Bb77cQ.png" /><figcaption>Path variables</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r4v_b-BFqKbcxTQbOqtH8A.png" /><figcaption>Tests</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*ZtZksG4_QnreTRbzVcB41w.png" /><figcaption>The response</figcaption></figure><p>So after this change, we need to update our values in the collection variables. How can we do this? Of course, using the get endpoint 🪄</p><p>We’ll duplicate the get endpoint to send the same request and update the values in the collection variables. After duplicating the request you can change the endpoint name to understand why we do this again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*JBt2pGRAzrGi4A6yB0gCzA.png" /><figcaption>Duplicate the request</figcaption></figure><p>After this, we’ll continue the delete endpoint and complete our tests.</p><p>For this test, we need only a username. We can get it from the collection variables. We’ll write some tests for it and that’s it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mnk_NHu8OCKed9JCeet4EQ.png" /><figcaption>Path variables</figcaption></figure><pre>pm.test(&#39;Status code is 200&#39;, function () {<br>    pm.response.to.have.status(200);<br>})<br><br>let response = pm.response.json();<br>let username = pm.collectionVariables.get(&#39;username&#39;);<br><br>pm.test(&#39;Username is &#39; + username, function () {<br>    var jsonData = pm.response.json();<br>    pm.expect(response.message).to.eql(username);<br>})</pre><p>We’ll send the request and check the response if everything’s okay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BkkXBNyK-vttr93sQWuc4A.png" /><figcaption>The response</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*AUtl2f82qFgSmhi9T-VYog.png" /><figcaption>Test Results</figcaption></figure><p>So everything works fine until the last step. We’ll create a runner with this endpoint.</p><p>You can create a runner by clicking the three dots icon on the left of the collection and clicking the Run collection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*Z5ncjtbimtqy_sbpLB66Aw.png" /><figcaption>Create a runner</figcaption></figure><p>You’ll see a runner after clicking the run collection. You can run your tests manually or with the scheduled runs.</p><p>The run order will be different when you click the run collection. You should change the run order like this 👇</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GXXIfMIllI6CKz0zzin-fg.png" /><figcaption>Runner</figcaption></figure><p>We’ll run the collection once so the iteration is 1 and there’ll be no delay between the endpoints.</p><p>After running the collection there will be results for this. As you can see there’s no error 🥳</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DCHjtAcq0kzVZMT4e59R4A.png" /><figcaption>Run results</figcaption></figure><p>With this article, we’ve learned how to use collection values, how to check the results, and how to automate the tests using runners in Postman.</p><p>I hope that this article meets your expectations 👩🏻‍💻</p><p><strong>Sources</strong></p><ul><li><a href="https://petstore.swagger.io/">https://petstore.swagger.io/</a></li><li><a href="https://learning.postman.com/docs/writing-scripts/script-references/variables-list/">https://learning.postman.com/docs/writing-scripts/script-references/variables-list/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a92e1f78fc0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>