Automate API Testing with IrisApiTester: A Developer's Guide
Tags: api, tutorial, testing, programming
Published: 2023-12-09 15:13:59



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ieekvjuxr2r7aqhecvyy.jpeg)
<span>&nbsp;</span>&nbsp;<span>&nbsp;</span></p>
<p style="line-height: 1.38; text-align: center;">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Hello, community!</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">After creating the app </span></span></span></span></span></span><a href="https://openexchange.intersystems.com/package/irisapitester-5?tab=details" style="text-decoration:none"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#1155cc"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:underline"><span style="text-decoration-skip-ink:none">IrisApiTester</span></span></span></span></span></span></span></a><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">, I saw that it could have more potential, and with some adjustments, it could become a powerful collaborative tool.</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">I asked myself a few questions::</span></span></span></span></span></span></p>

<ul>
<li aria-level="1" style="list-style-type:disc"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Could the API collections be shared with the entire team?</span></span></span></span></span></span></li>
<li aria-level="1" style="list-style-type:disc"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Could I use it to perform unit tests?</span></span></span></span></span></span></li>
<li aria-level="1" style="list-style-type:disc"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Is it beneficial for integration tests??</span></span></span></span></span></span></li>
<li aria-level="1" style="list-style-type:disc"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">What will happen if I add a CI/CD continuous integration layer??</span></span></span></span></span></span></li>
</ul>
<p style="list-style-type:disc">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">After considering possible answers, I decided to give it a try. When I finished my work, I discovered that all the responses were affirmative (with some nuances xD). Ultimately, I have decided to write this article and share my experience with you. I hope it can help us exchange our knowledge and potentially improve the application together..</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">The article should come in handy for you, I think. It might make you consider some new applications, or you may realize that it is beneficial for that test you didn’t know how to perform in an Agile way, but you will finally be able to execute now with my tips.</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">To keep the article short and sweet, I will divide it into several sections. In this way, you will have the option of going directly to the part you need or just reading everything in full.</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">If you want to carry out the tests step by step, I assume you already have an instance of the IrisApiTester docker image downloaded and running. However, if this is not the case, you can find the data you need in the article I wrote earlier:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><a href="https://community.intersystems.com/post/iris-api-tester" style="text-decoration:none"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#1155cc"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:underline"><span style="text-decoration-skip-ink:none">https://community.intersystems.com/post/iris-api-tester</span></span></span></span></span></span></span></a></p>

<h1 style="line-height:1.38; margin-top:27px; margin-bottom:8px">&nbsp;</h1>
<h1 style="line-height:1.38; margin-top:27px; margin-bottom:8px"><span style="font-size:20pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Point 1 - Sharing Postman collections between the team:</span></span></span></span></span></span></h1>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">The first thing I asked myself was whether I could share my Postman collection with the tests with all my colleagues, and the solution turned out to be much simpler than I expected.</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">I discovered that we could connect Postman to a repository that contained one or several collections of APIs. At the same time, Postman even included a Git client to update the collections, make commits, and perform other operations from Postman itself without having to switch to the terminal or anything. It might be something that everyone knew, but I had never noticed xD.</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Buckle up! Now, I will explain how to connect Postman to a repository with an API collection..</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">For the example, I have created a repository on GitHub. I have also tried to make one on Bitbucket. It is possible too in case you prefer to work with that service. So, here is the link to my repo::</span></span></span></span></span></span></p>
<p style="line-height:1.38"><a href="https://github.com/daniel-aguilar-garcia/postman-collection-test" style="text-decoration:none"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#1155cc"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:underline"><span style="text-decoration-skip-ink:none">https://github.com/daniel-aguilar-garcia/postman-collection-test</span></span></span></span></span></span></span></a></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">You can fork it if you wish. The collection contains some simple tests that point to a Docker container in a local instance (localhost) of IrisApiTester.</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">First of all, connect Postman to your repository.</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Open Postman, click Apis, and create API:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:425px"><span style="height:421px"><img height="421" src="https://lh7-us.googleusercontent.com/mKtdiVyaa33LUBIoFMypVfODqRuvsZWXr8TdeQ53QaVotfXrTvogAWFWv-toqMIQT-wsaSeRP-NB9nuLZkGmUmrJjPRBnkTsrzG9RyIt-p05f30YM56rh0aol3uCOBxHy3ukd9gcuiYgHkMZQBTvwnk" style="float: right;" width="425"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Then choose a name for the collection and click the GitHub icon (Or Bitbucket...)</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:602px"><span style="height:288px"><img height="288" src="https://lh7-us.googleusercontent.com/qTONNSGpQsiDL3NagCPU0skWNTgQqc-eeOlG_Msr4k0eqqsowbfPk-vicCB62b8xJMfke8ihY4FFC-bgcqx2gagPiXi8GBcsf7enw21TytmdRoBJpHj0SQv1gGIKlNLcvIR5L8ouym71HKCAHdWPkPQ" width="602"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">It may ask you for authorization. If it does, give it permission to connect to your GitHub user:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:602px"><span style="height:256px"><img height="256" src="https://lh7-us.googleusercontent.com/rbILU1HI_xPVqBYdppXzwRJq0foasRqmC5-hMquf3eDkQFC8mwLAyQZlLLrBHdd84653vUTJscyQze0W0jibBK4lcsGtqAWpe6L_9RlUp-8K7uG8P54E57IKo10vlxE0Zd-AFB769PCENtE__JGKD88" width="602"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:505px"><span style="height:401px"><img height="401" src="https://lh7-us.googleusercontent.com/IbWTBNcOvcZmhZsIw-ntvZSLoaddBFAu9V13d-6yprhBJW_bJPpuk5tZLvEeY5sv9tifOECZmIPPRQo4xdFnF4cPGABPlYP1IsYrhc2S4Mc2q0spOrkYu0wFnW4eqGk3udeBuWrMtQ0IADDCQE3ZGVE" width="505"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Once the request is accepted, select your GitHub user, the repository where you are going to store the APIs, and the repository branch:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:602px"><span style="height:456px"><img height="456" src="https://lh7-us.googleusercontent.com/e7AM_9yLxqgYy4WazmbJHg-8fZJcfENUL16sgJ0kSRWG1ycJBryEE9BPofj5rOtwYK_1LImVko0Yr8h37zruffxVX6lG55wDzKy4SAQd2a3UPrnqAu_MdVGpKbZQDE-BEDTSI-Xsxw0-UXrHtRGkz8Q" width="602"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Once connected (unless it is a new repository), the API collections that you have in the repository will show up:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:602px"><span style="height:356px"><img height="356" src="https://lh7-us.googleusercontent.com/8s47mKXv9Sbm0H9KQVMCZdUX0tz0EyjAyPp8AwYmFPxb-qvrEwjRJS16eGQcqY2Aoy0Fy7ZjOnqqnT7btwH-rpsczcSgCWElubYb5nF2-EJfMuERr1qun0zCGViswV0-pNi2qrYL_jDcSvt4h-3S_UE" width="602"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">All the collections within the API will also appear in the menu:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:408px"><span style="height:417px"><img height="417" src="https://lh7-us.googleusercontent.com/QOWjHzD7C9yQQ3lVOvUs84BF9jv8Zz_21NBYz47anS42BM_VTbDxEcaOkYPcfY9Y8mjF-ct5IpM00aG0A7UCMLAPGcizneqPdH5tbHFa9_fI2o2-n3gyYU_-EWc1V7oKqwxp9yh2RJ8Q3tUPkSne8Fs" width="408"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">If we make any changes to the collection, they will be reflected in the Git section immediately. It will allow us to perform such operations as commit, pull, push, etc.</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:404px"><span style="height:417px"><img height="417" src="https://lh7-us.googleusercontent.com/1HnzzDm1KkV8-KJmY51w2WTPLgPJS02whY82NAaR4dAt0aY_ANpr80_vNJLf3PZW-6ylRmpVfXIWUawPmy4yshmOOIfYHaYdsaJJYniO9ETZgiH6Db9xzYzB3d3lHjygoEFPAJg7y3lF7MEpH8XOOwk" width="404"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:433px"><span style="height:462px"><img height="462" src="https://lh7-us.googleusercontent.com/Hbl8Sp72_9G3Gx0NTagiurPxBANPIa8VsLdl0z70aLXK-YicHE-mUgUxSAce93OKEhW7FznAKA7wATx_y4qN8vvPVuP1l0409t7Oy1X4peg1IKQfVW1xdLYsdiJQWZTeBEb0SFfE6FHTt8wn_w2KDTk" width="433"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">If you have a Postman’s paid license, the only thing you should do to connect with the rest of the development team is to create a common Workspace, and that would be it. However, if you use a free account, you must repeat all the steps mentioned above on every development team's computer..</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">With the abovementioned steps, we have just completed the first point, sharing our collection with our team members and keeping it updated. The only drawback here would be if you use a free account, you can only generate 3 APIs. So, if this is the case, just put all the collections in the same repository to avoid problems.</span></span></span></span></span></span></p>

<h1 style="line-height:1.38; margin-top:27px; margin-bottom:8px">&nbsp;</h1>
<h1 style="line-height:1.38; margin-top:27px; margin-bottom:8px"><span style="font-size:20pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Point 2 - Unit tests:</span></span></span></span></span></span></h1>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">The next issue to solve was related to how to use the tool not only for API tests but also to execute unit tests. At that point, I asked myself: "What would be the fastest way to generate tests without creating new endpoints for each one of them?" So, this is what I came up with:</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">I created a webApp on the /run path:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:489px"><span style="height:212px"><img height="212" src="https://lh7-us.googleusercontent.com/uq9QRBiba-7d7quDPcsZ6qCr5B6O2y53stHnjp2_BQ6FAuKw3Vwszb2xl9sPJptdyiuhGNcVvUYhbFg5CSuYnP-nVqfbj35ZA6TOMUbTsIta1mqlZrtVZij8KLivrT4yQeI-QsY6xFsTvHFlQ5EEZQQ" width="489"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">I also made a class for the API. I built the following route (in the repository, it is the TestRoutes.cls class from the Example package):</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:602px"><span style="height:111px"><img height="111" src="https://lh7-us.googleusercontent.com/De4Zik78kHkkBj75FRz62rU5obQTfSxLAQ17J6UTO3tkVvKmUMePiHejVk3XcxW1h36_nAgLv0vrFGEc-KFp7U4_MLYqCiiWu1WLN_fubXJMGVH4XoSw1aSiNxqK3z9yc_KXF0pbIOPYUj7hhq4EKyY" width="602"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">With this WebApp and the route, we can establish a so-called “auto-publish” method for any class. We only need to pass the class and the method names to the API to achieve that. Check out the example below:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">localhost:52773/run/IrisNewman.Example.TestMethods/TestOK</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In this case, we have indicated the following:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">/run</span></span></span></span></span></span><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> -&gt; WebApp path</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">/IrisNewman.Example.TestMethods </span></span></span></span></span></span><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">-&gt; a class where the method that should be executed is located</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">/TestOK</span></span></span></span></span></span><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> -&gt; the method to execute</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In the TestOK method, I performed a simple check operation for the unit test:</span></span></span></span></span></span></p>

<pre class="codeblock-container" idlang="0" lang="ObjectScript" tabsize="4"><code class="language-cls hljs cos"><span class="hljs-keyword">ClassMethod</span> TestOK() <span class="hljs-keyword">As</span> <span class="hljs-built_in">%Status</span>
{
    <span class="hljs-keyword">Set</span> testNumber = <span class="hljs-number">1</span>
    <span class="hljs-keyword">Set</span> a = <span class="hljs-number">1</span>
    <span class="hljs-keyword">Set</span> b = <span class="hljs-number">2</span>
    <span class="hljs-keyword">Set</span> res = <span class="hljs-built_in">..SumNumbers</span>(a,b)

    <span class="hljs-keyword">Do</span> <span class="hljs-built_in">..assert</span>(res,<span class="hljs-number">3</span>,<span class="hljs-built_in">$G</span>(<span class="hljs-built_in">%methodname</span>),testNumber)

    <span class="hljs-keyword">Quit</span> <span class="hljs-built_in">$$$OK</span>
}</code></pre>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">A peculiarity on this class it’s that I defined my own assert method. My method assures that the values passed in parameters 1 and 2 are equal. Parameter 3 is the actual name of the method, and 4 is the number of assertions within the method. These last 2 parameters are only used to return a more detailed message in case an error in the assertion occurs. If the values don’t match when compared, it will throw an exception with a General Throw, sending the response code 500 to the request’s header. Then the test will be marked as an error in Newman's report.</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">With this approach, the only things left would be the following:</span></span></span></span></span></span></p>

<ul>
<li style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Include a call to our method to the Postman collection.</span></span></span></span></span></span></li>
<li style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Commit the changes.&nbsp;</span></span></span></span></span></span></li>
</ul>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In this way, everyone will have the collection updated in the repository.</span></span></span></span></span></span></p>

<h1 style="line-height:1.38; margin-top:27px; margin-bottom:8px">&nbsp;</h1>
<h1 style="line-height:1.38; margin-top:27px; margin-bottom:8px"><span style="font-size:20pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Point 3 - Integration Test:</span></span></span></span></span></span></h1>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In the same way, as in the previous step, we can reuse the WebApp utilized (or not) for the integration test. An example of the test could be adding a person to our database:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">localhost:52773/run/IrisNewman.Example.TestMethods/InsertPerson</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In this case, we have indicated the following:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">/run</span></span></span></span></span></span><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> -&gt; WebApp path</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">/IrisNewman.Example.TestMethods</span></span></span></span></span></span><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> -&gt; a class where the method to be executed is located</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">/InsertPerson</span></span></span></span></span></span><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> -&gt; a method to execute</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In the InsertPerson method, I performed all the operations within a transaction and checked with an assertion that the desired values had been stored. Finally, I completed a rollback to undo the changes:</span></span></span></span></span></span></p>

<pre class="codeblock-container" idlang="0" lang="ObjectScript" tabsize="4"><code class="language-cls hljs cos"><span class="hljs-keyword">ClassMethod</span> InsertPerson()
{

    <span class="hljs-keyword">Set</span> testNumber = <span class="hljs-number">1</span>
    <span class="hljs-keyword">Set</span> method=<span class="hljs-built_in">$G</span>(<span class="hljs-built_in">%methodname</span>)

    <span class="hljs-keyword">TSTART</span>
    <span class="hljs-keyword">Set</span> person=<span class="hljs-keyword">##class</span>(IrisNewman.Example.Entity.Person).<span class="hljs-built_in">%New</span>()
    <span class="hljs-keyword">Set</span> person.IDCard=<span class="hljs-string">"11111111H"</span>
    <span class="hljs-keyword">Set</span> person.Name=<span class="hljs-string">"Incognito Guy"</span>
    <span class="hljs-keyword">Set</span> person.Address=<span class="hljs-string">"False Street, 123"</span>
    <span class="hljs-keyword">Set</span> person.City=<span class="hljs-string">"Springfield"</span>
    <span class="hljs-keyword">Set</span> res = person.<span class="hljs-built_in">%Save</span>()

    <span class="hljs-keyword">Do</span> <span class="hljs-built_in">..assert</span>(res,<span class="hljs-number">1</span>)

    <span class="hljs-keyword">Set</span> personReaded = <span class="hljs-keyword">##class</span>(IrisNewman.Example.Entity.Person).<span class="hljs-built_in">%OpenId</span>(person.IDCard)

    <span class="hljs-keyword">Do</span> <span class="hljs-built_in">..assert</span>(personReaded.Name,<span class="hljs-string">"Incognito Guy"</span>,method,testNumber)

    <span class="hljs-keyword">TROLLBACK</span>
    <span class="hljs-keyword">Quit</span> <span class="hljs-built_in">$$$OK</span>
}</code></pre>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In the same way, we could test the Update, Delete, or any other operation, and as a result, we could execute any integration test we need.</span></span></span></span></span></span></p>

<h1 style="line-height:1.38; margin-top:27px; margin-bottom:8px">&nbsp;</h1>
<h1 style="line-height:1.38; margin-top:27px; margin-bottom:8px"><span style="font-size:20pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Point 4 - Adding CI/CD:</span></span></span></span></span></span></h1>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">You might be considering the following question: "Ok, this is good, but I want something more automated. How can I launch the tests of my collections automatically?"</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">So, for this case, I created a new endpoint in the App (It must be launched in a browser, not in Postman):</span></span></span></span></span></span></p>
<p style="line-height:1.38"><a href="http://localhost:52773/pull_and_run_tests" style="text-decoration:none"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#1155cc"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:underline"><span style="text-decoration-skip-ink:none">http://localhost:52773/pull_and_run_tests</span></span></span></span></span></span></span></a></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">This endpoint downloads the latest version of the collection from our Git or Bitbucket repository. It also runs the tests on it and shows the report (from Newman) with the results of those tests on screen:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:373px"><span style="height:69px"><img height="69" src="https://lh7-us.googleusercontent.com/3Ky8o0L3JSZI_9F950tiuVDqaHN22s9YUZjTSdPD_6Dj9nSqQ717ce7Tt0E0FgER_au7Lz6K5X6Xf49jAt-6cuYNPPi8grzXa2yxQTj74xONCZMC44lvx3c8kP38cI3A9havFD6Lni7uHX_a5TwWNGw" width="373"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:602px"><span style="height:432px"><img height="432" src="https://lh7-us.googleusercontent.com/ougspLI1ihgTBBR6YxMwMYQEOosWerTkq03lmBTMQz0lSyXkkXdjh_QomTaUlpWKptjFL8Ka2VggayMJEFqGhouQ7dvAYN7CyAQHhV-zKpZlq35jr26cfJK0EhWZsMDtxS6bXIh4pGolkkFZgEhU4Zg" width="602"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">To run the pull_and_run_test endpoint, we must configure the access data to the repository where we store our collection of tests in the file </span></span></span></span></span></span><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">repository.cfg:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:602px"><span style="height:352px"><img height="352" src="https://lh7-us.googleusercontent.com/_W-Q5QLwnfDNPd59rJPoD5WjISUei1IaSPO3rbSUvGym70LCGiCyrnUEqxxS_kp0ES92hTgpN38fa9V70D_LBjqYaDGWWh7jRpLeuYp7aWb3MeEhLplot0CEGvmDQtme7FTusinMaje7qUSm0673tHU" width="602"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">At this point, I had an idea dwelling in my mind that It would be nice to add a Workflow to the repository which would run all the tests automatically every time I make a commit</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">It came to my mind to create a new endpoint for this:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">http://localhost:52773/pull_run_and_send_google</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">It does the following: downloads the ApiTesting docker image, then downloads the collection from the repository, later executes the tests, and sends a message with the URL of the resulting HTML file to Google Chat.</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">For this to work, in the file </span></span></span></span></span></span><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">repository.cfg</span></span></span></span></span></span><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> we must configure the URL of the webhook of our Google Chat channel where we want to receive the message:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:602px"><span style="height:299px"><img height="299" src="https://lh7-us.googleusercontent.com/iibmUTkGwt6R24IaKjYzIPiNbmgzeegMxXJmUTr9jkkCzDbBCCivjEzR810vhPWUr6C0hdg-RdJNrCbJYUsNsmFQ41FAYtCjgttqEXreKeCFr9M0m9F-dqwDGBaJGjUV7CsUbkOaRijiRuWDn6TKpYg" width="602"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In the following picture, you can see an example of the workflow execution after every commit in the repository:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:602px"><span style="height:455px"><img height="455" src="https://lh7-us.googleusercontent.com/9zY2CHuKfgGXgraxlBTaKHwhqfEy0BEWYTmX_uWPzNutRof4Q3ts2Igy8Nyyrz0zC4qo9eFj2HLaraj8nr2KgkwcSJ-MzL3222TRvgfqzcSN3SF6ASBLK9-spkHklVOaENX6ucRCoJLvUO7hoc0RHXc" width="602"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Below there is the code from the GitHub Workflow that I used as an example:</span></span></span></span></span></span></p>

<pre class="codeblock-container" idlang="4" lang="YAML" tabsize="4"><code class="language-yaml hljs"><span class="hljs-attr">name:</span> <span class="hljs-string">Launch</span> <span class="hljs-string">Tests</span>
<span class="hljs-attr">on:</span>
&nbsp;&nbsp;<span class="hljs-attr">push:</span>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr">branches:</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-bullet">-</span> <span class="hljs-string">main</span>
<span class="hljs-attr">jobs:</span>
&nbsp;&nbsp;<span class="hljs-attr">build:</span>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr">runs-on:</span> <span class="hljs-string">ubuntu-latest</span>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr">steps:</span>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Checkout</span> <span class="hljs-string">source</span> <span class="hljs-string">code</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr">uses:</span> <span class="hljs-string">actions/checkout@v2</span>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Clone</span> <span class="hljs-string">the</span> <span class="hljs-string">irisapitester</span> <span class="hljs-string">repository</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr">run:</span> <span class="hljs-string">git</span> <span class="hljs-string">clone</span> <span class="hljs-attr">https://github.com/daniel-aguilar-garcia/irisapitester.git</span>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Raise</span> <span class="hljs-string">Docker</span> <span class="hljs-string">Compose</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr">run:</span> <span class="hljs-string">docker-compose</span> <span class="hljs-string">up</span> <span class="hljs-bullet">-d</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr">working-directory:</span> <span class="hljs-string">./irisapitester</span>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Wait</span> <span class="hljs-string">for</span> <span class="hljs-string">Docker</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr">run:</span> <span class="hljs-string">sleep</span> <span class="hljs-number">30</span>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Send</span> <span class="hljs-string">report</span> <span class="hljs-string">to</span> <span class="hljs-string">Google</span> <span class="hljs-string">Chat</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr">id:</span> <span class="hljs-string">send_report_google</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr">run:</span> <span class="hljs-string">|

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(curl -s http://localhost:52773/pull_run_and_send_google)</span></code></pre>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Now, take a look at the example of the message received:</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:602px"><span style="height:396px"><img height="396" src="https://lh7-us.googleusercontent.com/Pp-Nh6ydpH4AbsSk8XEBA6KzD_9BycUPWF2_dy1vPxhpKQZVxhn7LchnFU52WF5Wq9tDQDj6Vt5-vhDJBCMNpr234qDu2WstV7PU9930MdpodcTwCQux8WAsU48l_8k5iN7BkOep6Ctc9tjpIZPAmcM" width="602"></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">(In my example, I simply send the URL. However, we could program it to be sent only when it fails or make it arrive with an executed Ok / KO + the URL to the report).</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Note: If you plan to use the function of sending messages, you should map some network storage to save the HTML of the test results. Since the Docker instance is generated and destroyed during the Workflow, if we store it there, it will disappear. To solve this issue, add a network volume with the path to the Docker file and modify the test storage path in the executionsTestPath parameter of the IrisNewman/Api.cls class.</span></span></span></span></span></span></p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:medium"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:602px"><span style="height:45px"><img height="45" src="https://lh7-us.googleusercontent.com/YxmdW_YUGR2NRgXVsjF7-d8lDNQbWP_yXwTQ_fpeKlYsFoV1kB8lYFrJ7NTMyeZPx-rU6AU0UYB0jBbd52jU3mmSUqJWv5t8iCzNit0SNXsQ-5GAdwAKiCnOdnCxBvmiKGPEEjiOtmDhZPHMsDqPZj0" width="602"></span></span></span></span></span></span></span></span></span></span></span><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">&nbsp;</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">With all the abovementioned, we have already covered a large part of all the tests we wish to automate. Since I used the Workflow as an example of instruction, I have added it to my test repository. However, you can also store it in the repository of your software. Another option would be to place the source code of your software and the collection to be executed directly in the same repository. In this case, with each commit, the tests of the Postman collection that we have updated would be executed, and we would be notified (in this case by Google Chat) of the result of the operation automatically.</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">I hope you found my article interesting and will use this application/way of working in your daily life, or, at least, it has given you some ideas of a similar thing that can come in handy for you.</span></span></span></span></span></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-variant-ligatures: normal; font-variant-alternates: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal;"><font color="#000000" face="Arial, sans-serif"><span style="font-size: 11pt; white-space-collapse: preserve;">I encourage you to drop your </span><span style="font-size: 14.666667px;">questions and any uncertainties in the comments section. Your questions are highly appreciated.</span></font></span></p>
<p style="line-height:1.38">&nbsp;</p>
<p style="line-height:1.38"><span style="font-size:11pt; font-variant-ligatures:normal; font-variant-alternates:normal; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-position:normal; white-space:pre-wrap"><span style="font-family:Arial, sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Thanks for reading!!</span></span></span></span></span></span></p>

<p><br style="font-style:normal; font-weight:400; text-align:start; white-space:normal; text-decoration:none; color:#000000">&nbsp;</p>