<?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 Arun Kumar on Medium]]></title>
        <description><![CDATA[Stories by Arun Kumar on Medium]]></description>
        <link>https://medium.com/@a_kk?source=rss-34e70a291986------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Hy6OMMrwMpNCb3BaLLBbmg.png</url>
            <title>Stories by Arun Kumar on Medium</title>
            <link>https://medium.com/@a_kk?source=rss-34e70a291986------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 07:18:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@a_kk/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[Getting the Maximum out of your Integration Tests (AWS)]]></title>
            <link>https://faun.pub/getting-the-maximum-out-of-your-integration-tests-aws-e9e36e755b59?source=rss-34e70a291986------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9e36e755b59</guid>
            <dc:creator><![CDATA[Arun Kumar]]></dc:creator>
            <pubDate>Sun, 13 Mar 2022 02:43:08 GMT</pubDate>
            <atom:updated>2022-03-15T18:47:04.226Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I was working on writing the integration tests for a serverless application deployed on AWS. During the course of doing so I realised that integration test can be so much more than testing your code and its interaction with different services/resources, in this blog I will be proposing a template for writing your integration tests which will make your application more secure, robust and less prone to post deployment errors. Lets get started…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yJrTVKItTFHfKwgr2H6l_w.png" /><figcaption>High Level Architecture Diagram</figcaption></figure><p>The above diagram shows the high level architecture of my AWS application. As you can see there are a lot of services being used here and the general flow is that the end user makes a request to API gateway endpoint which then triggers a lambda function which then interacts with various AWS services like RDS, S3 etc and finally generates a response which is then returned to the end user.</p><p>Since there are a lot of moving parts here, it becomes very important to write good integration tests which covers every aspect of this application to reduce the chances of blowing it up in production. Here is the template that I want to share with you to achieve this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-wHu58O4rpb9Q1uP7hZQHQ.png" /></figure><p>So the first step is to divide your integration test based on the different AWS services that you are using, now one can argue here that if you are testing your api gateway endpoint and getting the correct responses then you are essentially testing the whole system, why bother writing tests for other services, but I strongly believe that for thorough testing you need to test the code in isolation as well as in end-to-end system. This makes your system less prone to errors and also if there are any errors you can pin point the exact location of failure.</p><p>The next step is the most important one, where for every service I am dividing the tests into three categories(you can think of categories as folders):</p><ol><li><strong>Business Logic Tests</strong></li><li><strong>Configuration Tests</strong></li><li><strong>Security Tests</strong></li></ol><p>Lets discuss each of them individually:</p><p><strong>Business Logic Tests: </strong>In this folder you will write and maintain all the test that checks the correctness of your code and verifies the you are seeing the expected behaviour in different scenarios.</p><p>For ex: Let’s say you have a service which takes employee Id as an input and return employee details. So in this case for API gateway and lambda, you might write the following tests:<br>- check that the status code is 200 when passing correct employee id.<br>- check that the status code is 400 when passing invalid employee id.<br>- if case of success response, check that the returned data contains all the necessary attributes.</p><p>Basically these kind of test checks the correctness of your business logic and also its interaction with different services like RDS(database), S3(Storage) etc. And I think most of the developers are already aware of these type of tests and write it very extensively. So let me move to the next categories which are not so conventional..</p><p><strong>Configuration Tests: </strong>This category of tests will check the configuration of the different AWS resources that you are having in your application. Let me give a few examples:</p><ul><li>AWS Lambda<br>Let’s say you have a lambda function which performs a task that generally finishes quickly but in some scenarios may take around 7–8 minutes and requires memory greater than 1 GB. By default lambda provide run time limit of 5 mins and memory of 1GB which is not sufficient for your worst case scenario. So here you can write a configuration test for your lambda function which checks that you have increased the time limit to 10 mins and memory limit to 5gb for the deployed lambda function.</li><li>S3<br>In your project you might have a critical requirement of enabling versioning of the S3 bucket. This should be part of your configuration test for S3 so that after every deployment you are able to check that versioning is enabled on your bucket.</li><li>SNS/SQS<br>You might have a requirement of enabling deduplication based on a certain attribute in your messages which is very critical to your project. This should be part of the configuration tests that you write for SNS/SQS where you can check if deduplication is enabled or not, and if enabled it is using the correct attribute.</li><li>One more very common use case where configuration test can help is to enforce tagging on your application resources. Many times we want to tag all the resource belonging to one application with a unique identifier, so that we can differentiate between resources of different applications in one AWS account, this also comes useful in cost estimation. So in this scenario you can write a configuration test which checks for the required tags on each of your application resources.</li></ul><p>I can add many more examples here but I believe you understand the idea now. Basically configuration tests forces you to think about the critical configurations of your application and keeps those intact over the course of multiple deployments.</p><p><strong>Security Test: </strong>This category of test will check that all your resources have been deployed securely and in general protects your application from data leaks and external attacks. Let see few examples:</p><ul><li>AWS Lambda<br>If you want to hide your lambda from public internet, you can write a security test which check that the lambda is deployed inside a VPC and there are no public Subnets associated with it.</li><li>API Gateway<br>Let’s say you maintain your authorization using Cognito. Then you can write a security test which check that your API gateway is protected by Cognito authoriser and the correct user pool is configured (as you might have multiple user pools in your AWS account and you don’t want to give access to users from a different user pool to this API gateway by mistake).</li><li>SNS/SQS<br>In case of SNS/SQS you should write a security test which checks that encryption is enabled on this resources as you don’t want any potential leak/snooping of your messages.</li><li>S3<br>In most scenarios you want to protect you data from public access. This can be part your security test for S3, you can write tests that checks that there are no ACLs configured on the bucket that provides access to external user groups.</li></ul><p>As you can see in the above examples writing security test really forces you to think about the security aspect of your application which many times we developers tend to ignore, which leads to catastrophic effects. One way to improve your security tests is that AWS provides very good documentation about its services so before using any new AWS service just go through the documentation, identify what are the best security configuration recommended by AWS and add it to your security tests.</p><p>Finally in conclusion I would like to say that having these multiple categories of tests will increase the time that you put into writing tests by a small margin but I believe the rewards are much higher. One more pro tip if you work in an organisation like mine where you get a lot of tickets due to incorrect configuration or security violations, you can keep adding those scenarios in your configuration/security test suite and save yourself from similar tickets in future.</p><p>Please let me know what you think about this approach in comments section and if this can be made a standard for writing integration tests. Also if you would like to know the technical details of how I implemented this, please let me know in the comments and I will write a part 2 for this article. Thank you for taking out the time to read this article. peace ✌️</p><figure><a href="https://faun.to/bP1m5"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BCiLLad3dvZLwBa-B5cAVQ.png" /></a></figure><p>Join FAUN: <a href="https://faun.to/i9Pt9"><strong>Website</strong></a><strong> </strong>💻<strong>|</strong><a href="https://faun.dev/podcast"><strong>Podcast</strong></a><strong> </strong>🎙️<strong>|</strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong>|</strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong>|</strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷|<a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook Group</strong></a><strong> </strong>🗣️<strong>|</strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin Group</strong></a><strong> </strong>💬<strong>|</strong> <a href="https://faun.dev/chat"><strong>Slack</strong></a> 📱<strong>|</strong><a href="https://thechief.io/"><strong>Cloud Native</strong> <strong>News</strong></a><strong> </strong>📰<strong>|</strong><a href="https://linktr.ee/faun.dev/"><strong>More</strong></a><strong>.</strong></p><p><strong>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9e36e755b59" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/getting-the-maximum-out-of-your-integration-tests-aws-e9e36e755b59">Getting the Maximum out of your Integration Tests (AWS)</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>