<?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 Kyle Sherwood on Medium]]></title>
        <description><![CDATA[Stories by Kyle Sherwood on Medium]]></description>
        <link>https://medium.com/@kylesherwood?source=rss-7ce5cca92cd0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8xj_NEfcMKp0ZF1P.</url>
            <title>Stories by Kyle Sherwood on Medium</title>
            <link>https://medium.com/@kylesherwood?source=rss-7ce5cca92cd0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 20:26:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kylesherwood/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[Writing Effective Continuous Integration Tests for an Application that Uses Child Processes]]></title>
            <link>https://medium.com/@kylesherwood/how-to-write-effective-continuous-integration-tests-for-an-application-that-uses-child-processes-5c1cf12257b5?source=rss-7ce5cca92cd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c1cf12257b5</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[test-driven-development]]></category>
            <dc:creator><![CDATA[Kyle Sherwood]]></dc:creator>
            <pubDate>Fri, 18 Aug 2017 03:22:27 GMT</pubDate>
            <atom:updated>2019-05-22T21:13:55.739Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gR-9Z1pCPj07e_O3kgR8Qg.png" /></figure><p>Too often, when we engineers break ground on a project, we become cookie monsters. We dig right into our MVP, crumbs flying left and right, with reckless abandon until we’ve hacked together a basically functioning product — why? Because it works! …and we can always refactor later.</p><p>In these moments, testing, a cornerstone of any good development process, gets left at the wayside — leaving us, and our teammates, with inevitable duress down the line. The idea of merging code becomes a nightmare and the blame game begins when the bugs begin to manifest themselves between the lines.</p><p>Sure, the exact variation of testing that’s most effective for a given project may vary case by case, but in general, a <strong>Test Driven Development (TDD) </strong>cycle is most effective in terms of progress made as the project evolves and technologies change.</p><p>We, the <a href="https://github.com/NebulisAnalytics">Nebulis Analytics</a> team, would like to display the incredible gains we saw when we committed to beginning our latest project with a test driven mindset. Hopefully, our wins here will translate into big wins for you and your team moving forward!</p><p><strong><em>What is Integration Testing?</em></strong></p><p>Integration testing is the act of testing how individual modules interact with one another in an application. Groups of modules are tested in different ways depending on how a user would interact with your applications. Some common methodologies include <strong>Big bang</strong>, <strong>Top-down</strong>, and <strong>Bottom-up</strong>.</p><p>Big bang, as it sounds, is the method where all basic modules of your application are built separately, integrated all at once, and then are fully tested. Usually, Big bang is best used when time is a pressing factor or the application is relatively small and would not want to be scaled. The problem with this approach is that when a bug appears, it is harder to find what caused it. There is also the possibility of missing testing some interfaces of your application that may be critical. Although functionality is tested, it is best to leave Big Bang testing for smaller, time sensitive projects.</p><p>Top-down testing is a true TDD form of testing that begins before any coding. Tests are written for the top level conceptual modules of your application and follow each branch of modules that you incrementally test along with your previously tested modules. With Top-down testing, we are assuring that the most critical parts of our application are tested first by creating “stubs” of information required to ensure that the business logic of our application is correct. Some disadvantages that may crop up from testing Top-down is that your lower level modules may not be properly tested as they will be integrated and tested on what you previously had for your higher level modules. Top-down testing is very useful for getting a relatively fast prototype of your application and handling your design patterns early on.</p><p>The Bottom-up approach, as the name suggests, begins with writing tests for the lowest level modules of your application which are tested against higher level modules once all of the innermost modules have been integrated. Testing the innermost modules of your application take in “drivers” that manipulate the function of your module. Bottom-up testing allows us to find major faults in the lowest levels of the applications, at the cost of finding major design flaws till the very end. Bottom up testing’s greatest advantage is when all or most of the lower level modules are completed and are ready for integration.</p><p>Let’s lay out a scenario of a software product. Say we have an application which has a backend API and database which communicates with a large collection of endpoints. The endpoints connect up to the server and store the statistical data they gather. You can imagine with some many moving parts, there are plenty of areas for error. How do we make sure that this product works correctly — especially as we scale?</p><p>Without a comprehensive testing solution, the engineer will typically be repeating a series of different tasks each time he wants to test a specific feature of the application. He may for example, manually clear his database each time, restart the server, and restart the endpoint. This process may be repeated hundreds of times throughout the development process and is effectively time wasted as this process could be automated. Depending on the complexity of the application, automation here could save many hours of development time.</p><p>Enter integration tests. A testing script could be employed that performs all of the tasks that the engineer was performing manually, but all at once. As an added benefit, the testing script is a permanent feature of the application meaning the test can be recycled by any member of the development team, without requiring any knowledge of the intricacies of the relationship between the two integrated software packages.</p><p>If a second developer were to drop in and make some changes to the code or add a new feature, he would know instantly whether the changes he made were going to negatively impact the code as it was given to him from the previous engineer. As you can imagine, this is invaluable information to have.</p><p>This is the test driven development methodology to software development. It has several advantages over jumping straight into coding, some of which are intentional and others which are less intentional but beautiful byproducts of good practice.</p><p>First, as we saw in our example, additions can be made to the code much more easily and give errors <em>context</em>. In this way, tests can serve almost as a communication between engineers. A well written test can tell a story of how the application works and why it is breaking with additional changes.</p><p>Additionally, a test can serve as a roadmap or checklist for the development of an app. As tasks are completed items are checked off of the list automatically. This can provide a tremendous amount of clarity to an engineer. Why would you want the hassle of trying to figure out what code to write next? Having good tests allow developers to focus on the coding without having to worry about changing perspective and viewing the application from a higher level. This removes a tremendous amount of stress when under the pressure of delivering a product.</p><p>Using testing in a team format can require a realigning of the anticipation of the stakeholders — but this is a great thing. Performance must be gauged not on the swiftness of code delivery, but on the quality. Adhering to a variation of Agile development methodology can help with this process. A product manager must understand the advantage which is being gained by using this approach. There is a concept called <em>Technical Debt</em> which highlights the severe disadvantage to not using the TDD approach. The graph below displays how TDD will inevitably save a tremendous amount of time and thus money in the long run. As the project’s complexity increases, the cost of change increases at a parabolic rate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/0*EUYH0yIyr4OHjt1c." /></figure><p>As changes are added the project becomes less and less manageable and more complicated for other engineers to work with. As changes are added, features are inevitably broken as there is no real system in place to detect these breakings. This is a primitive way of developing and should be avoided at all costs.</p><p><strong>How to test separate apps against each other effectively</strong></p><p>The issue with such a broad type of integration testing is since the apps are separate, extracting meaningful test information can be very challenging. A decision must be made about which end to test from. In our latest project we centralized the tests around the server. The basic premise was that the majority of tests were being performed by the server already, so logically, it made sense the that server should be performing the test against its endpoint client, instead of the other way around.</p><p>Since the apps are separate child processes are typically employed which launch the companion client and then extract steps out of it based on the data it outputs as well as data which is inserted into it.</p><p>Making an assertion against a child process is tricky, because the operation coming from the process is a sort of stream of data which must be collected and asserted against in a highly sequenced manner. If an operation isn’t carefully sequenced, you will get a timeout and the test will fail. An assertion with a popular Javascript testing library such as Mocha and Chai, is an event which happens synchronously as soon as the assertion is called. Whereas a child process is a very asynchronous type of operation which could have a variable amount of time required to complete it’s task depending on what environment it is run in. You may run it on your computer and have no problems, but as soon as you deliver it to your Continuous Integration server you find that it is suddenly failing.</p><p>One way that the issue can be overcome is of course using timeouts. This solution feels hacky. The application should wait for events, not periods of time. We have typically overcome this issue by having layers of cascading triggers which collect responses from the child process then make assertions after subsequent events occur.</p><p>The Nebulis Analtyics Team: <a href="http://www.chrisdobler.com/">Chris Dobler</a>, <a href="https://github.com/onupete">Peter Reyes</a>, and <a href="https://github.com/Ksher">Kyle Sherwood</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c1cf12257b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>