<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ankit Vijay</title>
    <description>The latest articles on DEV Community by Ankit Vijay (@ankitvijay).</description>
    <link>https://dev.to/ankitvijay</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F58824%2F5298f48f-dfec-40eb-9d39-bdc7601f6dc5.jpg</url>
      <title>DEV Community: Ankit Vijay</title>
      <link>https://dev.to/ankitvijay</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ankitvijay"/>
    <language>en</language>
    <item>
      <title>C# dynamic – A friend you may want to keep a distance</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Sat, 17 Aug 2019 22:00:39 +0000</pubDate>
      <link>https://dev.to/ankitvijay/c-dynamic-a-friend-you-may-want-to-keep-a-distance-28mk</link>
      <guid>https://dev.to/ankitvijay/c-dynamic-a-friend-you-may-want-to-keep-a-distance-28mk</guid>
      <description>&lt;p&gt;Recently, after one of my PRs which was merged to master, my teammates started complaining about a weird scenario. On some occasions, the ASP.NET Core app hosted inside the IIS worker process (w3wp.exe), would simply die without any exception/ warning. There were no clear repro-steps and it was difficult to pinpoint what was causing the issue. It took me some time to figure out the root cause of the issue and it turned out to be quite an interesting issue.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;As part of my PR, I had added a new code to map a &lt;code&gt;Repository&lt;/code&gt; &lt;code&gt;object&lt;/code&gt;/ entity to a &lt;code&gt;Dto&lt;/code&gt;. It was quite complex and a multi-level nested &lt;code&gt;entity&lt;/code&gt;. I did not use the library such as &lt;code&gt;Automapper&lt;/code&gt; to automatically map the entities. Why I chose to do mapping manually could be a discussion for another day. Anyways, the culprit code went something like this.&lt;/p&gt;

&lt;p&gt;We had an &lt;code&gt;abstract&lt;/code&gt; base class, let us call it &lt;code&gt;AbsractBaseRepository&lt;/code&gt; and this class was derived by as many as 18 different child classes. Something similar to below:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The &lt;code&gt;AbsractBaseRepository&lt;/code&gt; was then used by one of the nested child Repository as below:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The &lt;code&gt;Dto&lt;/code&gt; which was mapped from this &lt;code&gt;Repository&lt;/code&gt; had a similar structure.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Why and how we ended up with this structure is again out-of-scope of this post. To map the &lt;code&gt;Dto&lt;/code&gt; from &lt;code&gt;Repository&lt;/code&gt;, I tried to be a little bit smart/ lazy and used C# &lt;code&gt;dynamic&lt;/code&gt; as below:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In the above code, casting the &lt;code&gt;repository&lt;/code&gt; parameter to &lt;code&gt;dynamic&lt;/code&gt; implicitly converted the base &lt;code&gt;repository&lt;/code&gt;object&lt;code&gt;to the derived&lt;/code&gt;repository&lt;code&gt;and call the correct overload of&lt;/code&gt;ToDto` method.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Issue
&lt;/h2&gt;

&lt;p&gt;Unfortunately, I turned to be too smart for my own good. I missed the mappings for one of the derived &lt;code&gt;Repository&lt;/code&gt; class. In a scenario where the missed derived &lt;code&gt;Repository&lt;/code&gt; was present in the &lt;code&gt;entity&lt;/code&gt;, the code execution fall-back to base class overload method, that is, &lt;code&gt;ToDto(SomeAbstractRepository repository)&lt;/code&gt;. This resulted in an infinite loop causing the process to crash during debugging. Since there were as many as 18 derived &lt;code&gt;Repository&lt;/code&gt; classes this was somehow missed in integration and unit tests as well. The easiest way to fix this was to simply add the mapping for the missed &lt;code&gt;Repository&lt;/code&gt; class. However, it presented an additional risk, what if we add another derived Repository and we miss adding the mapping for that Repository? In that scenario, we would land up in a similar situation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix
&lt;/h2&gt;

&lt;p&gt;As a fix for this issue, I decided to go back to basics and use explicit conversion to map the &lt;code&gt;Repository&lt;/code&gt; and &lt;code&gt;Dto&lt;/code&gt;, even if it meant more lines of code. The explicit conversion helped us to identify the issue at the compile-time or in the worst case throw a clear exception at run-time instead of blowing the entire process without any exception at the run-time. The updated code looked something like below:&lt;/p&gt;

&lt;p&gt;{%gist &lt;a href="https://gist.github.com/ankitvijay/faa37402c6b3d5d441259e24ceb34d12"&gt;https://gist.github.com/ankitvijay/faa37402c6b3d5d441259e24ceb34d12&lt;/a&gt; %}&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learnt
&lt;/h2&gt;

&lt;p&gt;An important lesson which I learned while resolving this issue was to be extra cautious while using &lt;code&gt;dynamic&lt;/code&gt;. For all the power &lt;code&gt;dynamic&lt;/code&gt; brings, it comes at a cost. &lt;em&gt;Personally&lt;/em&gt;, I try to avoid &lt;code&gt;dynamic&lt;/code&gt; as much as possible and this issue just gave another reason why I would continue to do so.&lt;/p&gt;

</description>
      <category>net</category>
      <category>csharp</category>
      <category>dynamic</category>
    </item>
    <item>
      <title>SAST Tooling – Part 3: The Winner</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Sat, 29 Jun 2019 21:06:10 +0000</pubDate>
      <link>https://dev.to/ankitvijay/sast-tooling-part-3-the-winner-3e0e</link>
      <guid>https://dev.to/ankitvijay/sast-tooling-part-3-the-winner-3e0e</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Disclaimer&lt;/em&gt;&lt;/strong&gt;: This post is not an endorsement or opposition of any product or tool. Opinions present here is based on our experiences. Please exercise your own independent skill and judgement before you rely on the information in this post.🙂&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is Part-3 and final part of my blog series on Static Analysis Software Testing (SAST) tooling.&lt;/p&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/ankitvijay/sast-tooling-part-2-the-selection-criteria-29kj"&gt;Part-2&lt;/a&gt;, I described our selection criteria to select an alternate to Veracode and how we narrow down our search to just few tools. In this post I will describe how we came about selecting the winner.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Dilemma
&lt;/h4&gt;

&lt;p&gt;Its good to have choices but it also makes it difficult to choose just one. While, our selection criteria was good enough to shortlist 5 SAST tools, we realized that we needed to do a lot more to select the one which would work best for us.&lt;/p&gt;

&lt;p&gt;Documentation and public information did not help us get an answer to all our questions. Hence, we scheduled a demo with each organization to understand more about their product. We prepared a common questionnaire for each vendor. Additionally, we invited folks from different teams such Development, Security, Operations and management so each team had their say. All the demos were organized in a single week so that experience from previous demo was still fresh in our minds.&lt;/p&gt;

&lt;h4&gt;
  
  
  The weighted Matrix
&lt;/h4&gt;

&lt;p&gt;Product demo was a great way for us understand the capability of each tools and further shorten the list. However, we still did not have a clear winner. We needed to be more objective with our approach. That’s when we came up with an idea of weighted matrix. We wrote down our selection criteria in an Excel sheet and gave a weight to each criteria on a scale of 1 to 10, where 10 would mean an absolute must have and 1 would mean that no one would die if the product does not have that capability. For example: Thoroughness of Security Checks was weighted as 10, Product Support was weighted as 8, while ability to check licensing in 3rd party open source dependencies was weighted just 2.&lt;/p&gt;

&lt;p&gt;After that, we rated tools on a scale of 1-5 on each selection criteria and then came with with a weighted score as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Tool Criteria score = Criteria Weighting (1-10) * Tool rating (1-5)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I would not go into the details of total criteria score of each tool as it was our &lt;em&gt;internal research&lt;/em&gt; and &lt;em&gt;specific&lt;/em&gt; to our organization needs.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Winner
&lt;/h4&gt;

&lt;p&gt;The weighted matrix helped us to come get a total score for each tool and the results were a bit surprising. The SAST tool we ended up selecting was less known tool &lt;strong&gt;Kiuwan&lt;/strong&gt;. &lt;strong&gt;Checkmarx&lt;/strong&gt; and &lt;strong&gt;Coverity&lt;/strong&gt; should also get a special mention&lt;/p&gt;

&lt;p&gt;Once, the tool was selected we worked with Kiuwan development team to do a POC with few of our applications.&lt;/p&gt;

&lt;h4&gt;
  
  
  Why Kiuwan
&lt;/h4&gt;

&lt;p&gt;Here are few reasons why we chose to go for Kiuwan.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;While Kiuwan did not have a 24 * 7 support, we found that they were quite prompt in their response. During the POC, one of our developers questioned few of their security findings. Kiuwan development team accepted the one of the findings and agreed to fix it. For the others, they provided an explanation why they think it was valid.&lt;/li&gt;
&lt;li&gt;During the demo we found team from Kiuwan to be quite transparent. They answered our questions with honesty without making tall promises. There were few (cough.. Fortify) who tried to convince us that we were not asking the &lt;em&gt;right&lt;/em&gt; question.&lt;/li&gt;
&lt;li&gt;Kiuwan turned out to be the least expensive among all the products we evaluated.&lt;/li&gt;
&lt;li&gt;Due to the value for money it offered, we were able to a get great bundling deal on Code Security (SAST), Insights, and Code Analysis features from Kiuwan.&lt;/li&gt;
&lt;li&gt;We found its UI modern and intuitive. It came up with some good features such as security rating, estimated number of hours to improve the security rating, action plan, grouping of vulnerabilities etc.&lt;/li&gt;
&lt;li&gt;Kiuwan allowed us to scan the source code locally and upload only the findings along with impacted line instead of uploading the entire source code. This was an important requirement for us, more so because we are using their cloud offering.&lt;/li&gt;
&lt;li&gt;Kiuwan was the most up-to-date when it came to supporting the latest .NET Core frameworks or the modern JavaScript frameworks.&lt;/li&gt;
&lt;li&gt;We found its reporting to be the best among all the products.&lt;/li&gt;
&lt;li&gt;Kiuwan documentation was up-to-date and easy to follow.&lt;/li&gt;
&lt;li&gt;We found Kiuwan updates and its release cycle to be the fastest among all the tools.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whether or not Kiuwan would turned out to be a true to its hype, only time will tell. But as they say, well begun is half done. So we are keeping our fingers crossed. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fee02z822yt0l19fsu8k8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fee02z822yt0l19fsu8k8.png" alt="🙂"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@fznsr_?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Fauzan Saari&lt;/a&gt; on &lt;a href="https://unsplash.com/search/photos/winner?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The post &lt;a href="https://ankitvijay.net/2019/06/30/security-tooling-part-3/" rel="noopener noreferrer"&gt;SAST Tooling – Part 3: The Winner&lt;/a&gt; appeared first on &lt;a href="https://ankitvijay.net" rel="noopener noreferrer"&gt;Hi, I'm Ankit&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codeanalysis</category>
      <category>sast</category>
      <category>security</category>
      <category>net</category>
    </item>
    <item>
      <title>SAST Tooling – Part 2: The selection criteria</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Tue, 25 Jun 2019 21:46:55 +0000</pubDate>
      <link>https://dev.to/ankitvijay/sast-tooling-part-2-the-selection-criteria-29kj</link>
      <guid>https://dev.to/ankitvijay/sast-tooling-part-2-the-selection-criteria-29kj</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Disclaimer&lt;/em&gt;&lt;/strong&gt;: This post is not an endorsement or opposition of any product or tool. Opinions present here is based on our experiences. Please exercise your own independent skill and judgement before you rely on the information in this post.:) &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is Part-2 of my blog series on Static Analysis Software Testing (SAST) tooling.&lt;/p&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/ankitvijay/sast-tooling-part-1-why-we-ditched-veracode-21ba"&gt;Part 1&lt;/a&gt;, I described our pain-points using Veracode and what motivated us to look elsewhere. In this part , I will describe how we went about looking for a tool better suited for our needs.&lt;/p&gt;

&lt;h4&gt;
  
  
  A “ &lt;strong&gt;perfect” SAST tool&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Buying a third-party tool is not only expensive but also a huge investment for an organization. It can take considerable amount on effort to customize the tool according to organization needs and visa-versa. It is equally hard to build a ecosystem around it. Since, we had already burnt our hands with Veracode, it was extremely important that we were second time right with our selection. There was no room for mistake. We were aware that if we do not do a due diligence, then it could be fatal and entire IT would need to carry the burden of our mistake for the years to come.&lt;/p&gt;

&lt;p&gt;With that in mind, my colleague, Chris from SecOps (Security Operations) and I came up with a selection criteria to shortlist the SAST tools. Based on the selection criteria, we did an independent research on various SAST tools available in the market. The selection criteria helped us remove our unconscious bias while trying to short-list the SAST tools.&lt;/p&gt;

&lt;h4&gt;
  
  
  Our selection criteria
&lt;/h4&gt;

&lt;p&gt;We divided our criteria into Must-Have, Good-To-have and Should-have. We also categorized the our requirements based on the stakeholders like Dev, Security, IT management. Below are few points we considered during our selection process at a very high level:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Support for security risk and software error such as SANS 25, CERT, OWASP Top 10&lt;/li&gt;
&lt;li&gt;Provide a detailed, executive report summary customized as per stakeholder such as Dev, Security, IT management.&lt;/li&gt;
&lt;li&gt;More control to user – Allow user to configure scan policy as per project.&lt;/li&gt;
&lt;li&gt;Allow user to export reports outside portal via well-known formats like email, pdf and not just propriety formats.&lt;/li&gt;
&lt;li&gt;High accuracy rate and low false positive rates.&lt;/li&gt;
&lt;li&gt;Good explanation of vulnerabilities within the context of the code. &lt;/li&gt;
&lt;li&gt;Provide sample code and guidelines to fix the issue.&lt;/li&gt;
&lt;li&gt;Good integration with tools such JIRA, Visual Studio, Visual Studio code.&lt;/li&gt;
&lt;li&gt;Integrate well with our build pipeline and CI/CD process.&lt;/li&gt;
&lt;li&gt;Easy to understand, navigate and a modern User Interface&lt;/li&gt;
&lt;li&gt;Scan turnaround time&lt;/li&gt;
&lt;li&gt;Ability to scan on locally&lt;/li&gt;
&lt;li&gt;Support for JavaScript frameworks like Angular, VueJS etc and the latest .Net Core framework.&lt;/li&gt;
&lt;li&gt;Report vulnerabilities for 3rd party dependencies added through NuGet and NPM.&lt;/li&gt;
&lt;li&gt;Provide a rich set of APIs to perform the operations like viewing scan, downloading reports etc
&lt;/li&gt;
&lt;li&gt;Excellent documentation&lt;/li&gt;
&lt;li&gt;Good Support
&lt;/li&gt;
&lt;li&gt;Cost effective&lt;/li&gt;
&lt;li&gt;Capabilities beyond security such as code efficiency, duplicate code, etc&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  What we did not consider
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Reviews from sites such as &lt;a href="https://www.itcentralstation.com/"&gt;ITcentralstation&lt;/a&gt;. We found the reviews about the product could be misleading and they were more focused on IT operations.&lt;/li&gt;
&lt;li&gt;The size of the organization. Our experience from Veracode made us realize that bigger is not always better. Hence, we kept it out of our selection criteria.&lt;/li&gt;
&lt;li&gt;We tried to keep a distance from the product marketing teams as from our experience it does not help much in getting answers to our query.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The above criteria helped us narrow down our search to following products:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checkmarx&lt;/li&gt;
&lt;li&gt;Fortify on Demand&lt;/li&gt;
&lt;li&gt;Kiuwan&lt;/li&gt;
&lt;li&gt;SonarQube&lt;/li&gt;
&lt;li&gt;Coverity + Black Duck&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the next and final post, I will talk about the tool how we further reduce our long list of SAST tools and what we ended up procuring.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@garri?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Vladislav Babienko&lt;/a&gt; on &lt;a href="https://unsplash.com/search/photos/selection-criteria?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The post &lt;a href="https://ankitvijay.net/2019/06/26/security-tooling-part-2/"&gt;SAST Tooling – Part 2: The selection criteria&lt;/a&gt; appeared first on &lt;a href="https://ankitvijay.net"&gt;Hi, I'm Ankit&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>net</category>
      <category>codeanalysis</category>
      <category>sast</category>
      <category>security</category>
    </item>
    <item>
      <title>SAST Tooling – Part 1: Why we ditched Veracode</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Fri, 21 Jun 2019 23:37:32 +0000</pubDate>
      <link>https://dev.to/ankitvijay/sast-tooling-part-1-why-we-ditched-veracode-21ba</link>
      <guid>https://dev.to/ankitvijay/sast-tooling-part-1-why-we-ditched-veracode-21ba</guid>
      <description>&lt;p&gt;This post is Part-1 of multi-part series describing our journey to ditch popular Static Application Security Testing (SAST) tool &lt;a href="https://www.veracode.com/"&gt;Veracode&lt;/a&gt;and our quest for a &lt;em&gt;better&lt;/em&gt; security tool.&lt;/p&gt;

&lt;h3&gt;
  
  
  Background
&lt;/h3&gt;

&lt;p&gt;Until recently, our organization used Veracode for security analysis for few our applications. Veracode came with a lot of reputation. It is considered a &lt;a href="https://info.veracode.com/analyst-report-gartner-mq-appsec-testing-2019.html"&gt;&lt;strong&gt;leader&lt;/strong&gt;&lt;/a&gt; in Application Security by Gartner and is used by hundreds of organizations across the globe. Unfortunately, our experience with Veracode was quite opposite.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt; : This post talks about &lt;em&gt;our&lt;/em&gt; experience with Veracode and other SAST tools based on our needs last year. Things may have changed since then. It should not be seen as endorsement/ recommendation for or against any SAST tools.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Veracode Pain-Points&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Veracode Documentation did not keep up the pace with their updates (which anyway happened once in a blue moon). At few places even we found it misleading. &lt;/li&gt;
&lt;li&gt;We found the Veracode APIs very hard to use and integrate with our build pipeline.&lt;/li&gt;
&lt;li&gt;Veracode UI portal left lot to be desired. Its UI looked dated and far from intuitive. It did not support some basic integrations. For example, reports, scan results etc. could not be emailed.&lt;/li&gt;
&lt;li&gt;Veracode Support took weeks to respond and when they did respond, the responses were short with no help.

&lt;ul&gt;
&lt;li&gt;Support from tickets raised almost always included nothing more than a link to outdated documentation. This was even the case when the ticket raised was in regards to the same outdated documentation.🙂&lt;/li&gt;
&lt;li&gt;Often it took follow up emails to even get a response from them.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Integration with JIRA was not usable and did not solve our purpose. We eventually fall-back to creating tickets manually in JIRA due to following reasons:

&lt;ul&gt;
&lt;li&gt;Veracode would raise dozens or even hundreds of tickets for the same finding if it was found in more than area such as a text box. For example, a client side validation issue that could be addressed by a single change to the validation library in place was flagged as a new ticket for every text box was created. This resulted in hundreds of new tickets being raised in JIRA creating a clutter.&lt;/li&gt;
&lt;li&gt;Its JIRA plugin itself was not regularly updated. And one of our JIRA updates broke the Plug-in.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;The scans incorrectly identified the 3rd party library as our internal organization code. As a result, scans showed the incorrect results. This resulted in our code failing the scan. Developers cannot rewrite the code for 3rd party developers. It took months for Veracode to confirm that it was a bug and then another few to fix it.&lt;/li&gt;
&lt;li&gt;A number of dependencies our applications like Castle Windsor and Autofaq were not supported. Veracode mentioned they no plans to support it.&lt;/li&gt;
&lt;li&gt;Veracode API Keys had a finite period of validity. We found that Veracode appears to only send 1 notification regarding the pending expiration, just 1 day prior to the API key expiring. There were no additional follow up emails or notifications in the portal etc, that warn of the expired API key. As a result, our Veracode scans had been failing as a result of the expired API keys. Overlooking a single email resulted in all associated scans from being unable to complete. &lt;/li&gt;
&lt;li&gt;If there was any issue while uploading the DLLs (eg. due to API key expiration), then the error we get on the portal are very cryptic and it was difficult to understand the root cause and possible solution. &lt;/li&gt;
&lt;li&gt;Veracode neither integrated with our source control nor offered local analysis. The only way to scan the code was to upload the DLLs to the VeraCode portal.&lt;/li&gt;
&lt;li&gt;Scan Times were quite lengthy. Approximately 30 mins for a small size application. If a minor change is made to code and then all the DLLs were required to be uploaded and the full scan needed to run once more. We could not find a way to integrate it fully with our build pipeline.&lt;/li&gt;
&lt;li&gt;The features added to Veracode appear to be focused on creating new income streams via new paid products without addressing any of the known issues with the platform. &lt;/li&gt;
&lt;li&gt;VeraCode came up with two Visual Studio plugins: Veracode and Veracode Greenlight. Veracode Greenlight was licensed separately. But more importantly, both these plugins were equally useless.

&lt;ul&gt;
&lt;li&gt;Veracode Plugin: Did not provide static scan with-in the editor. We still had to upload the DLLs and then download the report. While the developer uploaded files from their IDE, the machine was unusable and unresponsive. As each file was uploaded, focus returned to the upload window making performing any additional task at the same time impossible. Again, the upload could take a several minutes to complete.&lt;/li&gt;
&lt;li&gt;Veracode Greenlight: While this plugin _supposedly _scanned the source code inline. It could only do it at the file level and not the DLLs. From our experience it could not even identify the vulnerabilities with in the file. &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These pain-points were felt by us every day and forced us to look for an alternate. In the next post, I will talk about our approach to evaluate different SAST tools out there in the market.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://ankitvijay.net/2019/06/22/security-tooling-part-1/"&gt;SAST Tooling – Part 1: Why we ditched Veracode&lt;/a&gt; appeared first on &lt;a href="https://ankitvijay.net"&gt;Hi, I'm Ankit&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>net</category>
      <category>codeanalysis</category>
      <category>sast</category>
    </item>
    <item>
      <title>My first major Open Source contribution</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Fri, 26 Apr 2019 10:44:44 +0000</pubDate>
      <link>https://dev.to/ankitvijay/my-first-major-open-source-contribution-4eil</link>
      <guid>https://dev.to/ankitvijay/my-first-major-open-source-contribution-4eil</guid>
      <description>&lt;p&gt;Without a doubt Open Source is great. It has touched the lives of millions of developers and through them almost everyone living on this planet someway or the other.&lt;/p&gt;

&lt;h3&gt;
  
  
  The magic of Open Source
&lt;/h3&gt;

&lt;p&gt;For all the power Open Source has given to developers, the sad reality is that only very few people are actually the contributors. Most of the devs just consume what a very few build, mostly in their own free time. I hate to admit, I’m also among those who enjoy using Open Source software, applications, packages but very rarely contribute. Until recently, my major contribution to GitHub was restricted to a few documentation updates, typos, minor code changes or raising issues on the repository. While it is not an excuse, one of the reasons, I have not been able to contribute to the Open Source as much as I would like is because I have mostly worked with enterprise customers in a closed environment which provides a very little opportunity to work beyond the usual tasks. This, however, changed a few days back.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem
&lt;/h3&gt;

&lt;p&gt;Recently, we upgraded our work-in-progress application to ASP.NET Core 2.2. As part of the upgrade, I migrated our HealthChecks to the new out-of-the-box health check feature of ASP.NET Core 2.2. To read more about this feature, refer to this &lt;a href="https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks?view=aspnetcore-2.2"&gt;link&lt;/a&gt;. The &lt;a href="https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks"&gt;BeatPulse project&lt;/a&gt; on GitHub provides HealthCheck NuGet packages for many service providers such as SQL Server, Redis, Raven DB etc. which makes the integration nice and easy. For our application, I needed to integrate with RavenDB. However, the NuGet package had the following limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It did not allow a user to pass an array of connection strings/ URLs which is a must-have for configuring failover.&lt;/li&gt;
&lt;li&gt;Additionally, the implementation did not support Certificate Authentication, again a must-have of the production scenario. I went through the implementation and realized it is quite a simple fix. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  My Options
&lt;/h3&gt;

&lt;p&gt;I had two options to go about this.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Option 1:&lt;/strong&gt; Raise an issue with the contributors and wait for this to be fixed someday. In the meantime, have my own implementation for our application. However, that would have meant an additional avoidable code in our repository which would need to be maintained. Also, if someone else from my organization needed that implementation, they would either copy from my code or create our own internal NuGet package. Again, waste of time and effort.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Option 2:&lt;/strong&gt; Submit a PR with the changes and wait for it to get merged in the mainline before leveraging it in my application. I was initially a bit sceptical about this. I was not sure how much time it would take to get my changes approved. So many times, this apprehension has made me and I’m sure many others like me take a shortcut (read “Lazy”) approach that is the Option 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;This time I decided to do what is right. I forked the repository, made the relevant changes and raised &lt;a href="https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/pull/139"&gt;this Pull Request&lt;/a&gt;to fix the issue. To my surprise, I found the process very easy and straightforward. The repository owner &lt;a href="https://github.com/unaizorrilla"&gt;@unaizorrilla&lt;/a&gt; was very prompt in his response. The entire process took less than a week and I was able to use the updated NuGet package in no time once the changes were merged. This experience was very extremely motivating. Most importantly, it gave me an inner satisfaction that my code now will be used by hundreds of other developers and not just within my organization. If you have not yet contributed to Open Source, I encourage you all to look for the opportunities where you can contribute. Trust me, you will find plenty. :)&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://ankitvijay.net/2019/04/26/my-first-major-open-source-contribution/"&gt;My first major Open Source contribution&lt;/a&gt; appeared first on &lt;a href="https://ankitvijay.net"&gt;Hi, I'm Ankit&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>net</category>
      <category>netcore</category>
      <category>aspnetcore</category>
    </item>
    <item>
      <title>Team City – Curious case of failed tests but passed build</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Sun, 24 Mar 2019 22:07:00 +0000</pubDate>
      <link>https://dev.to/ankitvijay/team-city--curious-case-of-failed-tests-but-passed-build-4gbf</link>
      <guid>https://dev.to/ankitvijay/team-city--curious-case-of-failed-tests-but-passed-build-4gbf</guid>
      <description>&lt;p&gt;Recently, I had written a post on how I managed bring down &lt;a href="https://dev.to/ankitvijay/when-i-brought-down-build-pipeline-for-entire-organization-57kh"&gt;build pipeline for entire organization.&lt;/a&gt; While I was at fault during that time, Team City should take the blame for this one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Background
&lt;/h3&gt;

&lt;p&gt;I had recently created a CI/CD pipeline for our new .NET Core project. As part of the build pipeline, I had usual build steps to Build the solution, Run Unit Tests, Run Integration Tests, and then Deploy to Octopus.&lt;/p&gt;

&lt;h3&gt;
  
  
  Team City dotnet CLI Plugin
&lt;/h3&gt;

&lt;p&gt;As mentioned in my previous post on Team City, I have been try to avoid Team City plugins as much as possible and use scripts or command line instead. To run the Tests for my new project my first preference was to leverage “dotnet” command out of the box instead of using Team City dotnet plugin. However, &lt;strong&gt;&lt;a href="https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test?tabs=netcore21" rel="noopener noreferrer"&gt;dotnet test&lt;/a&gt;&lt;/strong&gt; command does not take list of multiple projects &lt;em&gt;by default.&lt;/em&gt; There are obviously way around this but I chose to go for Team City plug-in instead due to simplicity and ease of use. The configuration was simple and straightforward and I was up and running in minutes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi0.wp.com%2Fankitvijay.net%2Fwp-content%2Fuploads%2F2019%2F03%2Fimage.png%3Ffit%3D810%252C261%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi0.wp.com%2Fankitvijay.net%2Fwp-content%2Fuploads%2F2019%2F03%2Fimage.png%3Ffit%3D810%252C261%26ssl%3D1"&gt;&lt;/a&gt;Team City dotnet CLI plugin&lt;/p&gt;

&lt;h3&gt;
  
  
  Issue
&lt;/h3&gt;

&lt;p&gt;Our CI/CD pipeline seem to be working as expected with no dramas. Once, the PR branch was approved, master branch build was trigger and on successful build, the solution would deploy to Octopus. On one fine day our QA reported a bug which should have ideally been caught by our integration tests. When I looked Team City build, I noticed that build was successful even when integration tests failed. That was weird in many ways and I double-checked the build configuration and verified that they were all set correctly. The “Execution step” for all the build steps was set to “If all previous steps finished successfully”. But still the build steps after the &lt;em&gt;failed&lt;/em&gt; build step appear to be getting executed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Root Cause
&lt;/h3&gt;

&lt;p&gt;One further digging, I found the root cause of the issue to be &lt;a href="https://github.com/JetBrains/teamcity-dotnet-plugin/issues/129" rel="noopener noreferrer"&gt;this issue&lt;/a&gt; on Team City dotnet plugin. There were other devs who were also caught off-guard like me. As per one of the plugin contributors:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is original behavior. For most of runners a process returns non zero exit code which means that a running was not successful. For runners like NUnit, VSTest, dotnet test, msbuild /t:VSTest, dotnet vstest positive exit code just an amount of failed tests. See this &lt;a href="https://youtrack.jetbrains.com/issue/TW-49018" rel="noopener noreferrer"&gt;thread&lt;/a&gt; for details&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;However, this explanation for me is not enough to NOT fix a wrong behavior/ bug in the plugin. The behavior is not intuitive and can lead to issues like mine and other developers.&lt;/p&gt;

&lt;p&gt;If you want JetBrains to prioritize this issue you can vote &lt;a href="https://youtrack.jetbrains.com/issue/TW-55626" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Workaround
&lt;/h3&gt;

&lt;p&gt;One of the suggested workaround mentioned for this issue was to set “Execution Step” for the each build step as “Only if build status is successful”. But I did not like this solution as it means we are going away from &lt;em&gt;default&lt;/em&gt; for no reason and we would need remember &lt;em&gt;yet another thing to change&lt;/em&gt; from default every time we add a new build step.&lt;/p&gt;

&lt;p&gt;I managed to solve to this issue with the slightly cleaner work-around by adding following “Failure Condition” to my Team City build configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi1.wp.com%2Fuser-images.githubusercontent.com%2F5988564%2F53308876-44dab080-38f0-11e9-9575-1657d0d60757.png%3Fw%3D810%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi1.wp.com%2Fuser-images.githubusercontent.com%2F5988564%2F53308876-44dab080-38f0-11e9-9575-1657d0d60757.png%3Fw%3D810%26ssl%3D1" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This failure condition worked as build log messages contain text “Tests Failed” each time test build step failed.&lt;/p&gt;

&lt;p&gt;Hope this tip helps you avoid making the same mistake and save few hours. 🙂&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://ankitvijay.net/2019/03/25/team-city-failed-tests-but-build-pass/" rel="noopener noreferrer"&gt;Team City – Failed Tests but Build Pass&lt;/a&gt; appeared first on &lt;a href="https://ankitvijay.net" rel="noopener noreferrer"&gt;Hi, I'm Ankit&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>net</category>
      <category>netcore</category>
      <category>continuousintegrati</category>
      <category>devops</category>
    </item>
    <item>
      <title>.NET Core – Running Background Worker on IIS</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Mon, 18 Mar 2019 22:09:15 +0000</pubDate>
      <link>https://dev.to/ankitvijay/net-core--running-background-worker-on-iis-54ho</link>
      <guid>https://dev.to/ankitvijay/net-core--running-background-worker-on-iis-54ho</guid>
      <description>&lt;p&gt;One of the crucial pieces of the new solution that I’m working on is &lt;a href="https://www.rabbitmq.com/" rel="noopener noreferrer"&gt;RabbitMQ&lt;/a&gt;. For those who have never heard of RabbitMQ, it is one of the most widely used open source message broker. Since our solution is hosted on-premise, RabbitMQ was one of the most natural fit for us. Our entire solution architecture is built on .NET Core 2.1 and recently migrated to .NET Core 2.2. To run the RabbitMQ we had 3 options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run RabbitMQ as a traditional .NET Framework “Windows Service”
&lt;/li&gt;
&lt;li&gt;Run RabbitMQ as a .NET Core “Windows Service”&lt;/li&gt;
&lt;li&gt;Host RabbitMQ on IIS as a .NET Core application&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Creating a .NET Framework based Windows Service was a known beast, as we have done it hundred times. However, since our entire solution was based on .NET Core, it was a step backward. As a result, we started exploring option 2, that is hosting a .NET Core based Windows Service. Our solution was largely inspired (read “Copied”) from Steve Gordan’s post on “&lt;a href="https://www.stevejgordon.co.uk/running-net-core-generic-host-applications-as-a-windows-service" rel="noopener noreferrer"&gt;Running a .NET Core Generic Host App as a Windows Service&lt;/a&gt;“&lt;/p&gt;

&lt;p&gt;Based on his post, we configured the solution to run as console application during development, and then as windows service at the time of deployment. However, we did not find deploying the windows service on .NET Core as simple as we initially thought. We had to modify project file to add &lt;code&gt;RunTimeIdentifier&lt;/code&gt; or &lt;a href="https://docs.microsoft.com/en-us/dotnet/core/rid-catalog" rel="noopener noreferrer"&gt;RID&lt;/a&gt;. RID is OS and architecture specific.  It is a different string based on OS, Version, Architecture. We did not want OS specific dependencies in our solution. We did not OS specific dependencies in our solution. In addition to this, a Windows-service also come up with its own set of complexities. It is difficult to debug and monitor as compared to a hosted-service.&lt;/p&gt;

&lt;p&gt;This is where, we looked into the third option: Host our Background Worker on IIS. Hosting the Background Worker on IIS meant that we were able to deploy our Background Worker same as we would deploy a web app. Instead of using a “Generic Host” we were able to use default “Web Host”. There was less custom code. It was easier to debug and monitor. In addition to this, we were also able to leverage &lt;a href="https://al-hardy.blog/2017/04/17/asp-net-core-health-checking/" rel="noopener noreferrer"&gt;.NET Core Health Checks&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To run the background worker on the IIS, we had to tweak IIS settings to keep it always up and running. Here is the PowerShell script which we run on Octopus to update the IIS settings.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Hope you find this useful. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3weqd4n5mfl7oao2qrw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3weqd4n5mfl7oao2qrw.png" alt="🙂"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://ankitvijay.net/2019/03/19/net-core-running-background-worker-on-iis/" rel="noopener noreferrer"&gt;.NET Core – Running Background Worker on IIS&lt;/a&gt; appeared first on &lt;a href="https://ankitvijay.net" rel="noopener noreferrer"&gt;Hi, I'm Ankit&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>net</category>
      <category>netcore</category>
      <category>aspnetcore</category>
      <category>devops</category>
    </item>
    <item>
      <title>When I brought down build-pipeline for entire organization</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Thu, 14 Feb 2019 21:42:14 +0000</pubDate>
      <link>https://dev.to/ankitvijay/when-i-brought-down-build-pipeline-for-entire-organization-57kh</link>
      <guid>https://dev.to/ankitvijay/when-i-brought-down-build-pipeline-for-entire-organization-57kh</guid>
      <description>

&lt;p&gt;December last year, last week before most of IT staff go on well-deserved vacation, when every team was trying to do one last deployment before code freeze, I brought down build-pipeline for almost every project in the company. Sounds scary? Here’s what happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it all started
&lt;/h2&gt;

&lt;p&gt;We are mostly a .NET shop and use Team City for our builds. We have a number of Build Agents for running builds for our projects in Team City. A couple of days back before the incident we changed the repository name of our project. Subsequently, we updated the repo path in Team City for our project. After that, we did a dry run of the build and confirmed that it was all green.&lt;/p&gt;

&lt;h2&gt;
  
  
  What caused the issue
&lt;/h2&gt;

&lt;p&gt;However, once those changes were made, I noticed that few of our feature-branch builds, only on certain Build Agents started to fail with a weird error &lt;em&gt;Cannot find master branch.. something something&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I did a little bit of reading about the issue and it appeared to be a caching issue where Team City for some reason was not able to pick up the updated repository path name. It looked quite reasonable to clear relevant Team City cache variables. So, I went ahead and cleared some of the cache variables. After that, I ran my builds on all the Agents and everything was green again.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Chaos
&lt;/h2&gt;

&lt;p&gt;Next day, when I reached the office, there was a choas. People were complaining about failing builds on Team City. Since I was the one who last touched the Team City configuration it was highly likely to be caused my changes.&lt;/p&gt;

&lt;p&gt;We started digging deeper into the issue. We found out that the Team City “Nuget Plugin” was not working correctly and threw some weird errors for almost all the builds. So, the first thing we did is what every IT specialist does, try &lt;strong&gt;restarting the Build Server and Build Agents&lt;/strong&gt; :). Unfortunately, this time it did not help. There was absolutely no help on the internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix
&lt;/h2&gt;

&lt;p&gt;After several trials and errors, we finally managed to fix the major issue with NuGet Plugin.&lt;/p&gt;

&lt;p&gt;Clearing the cache had somehow uninstalled NuGet plugin for all the NuGet Versions and Build Agents. To fix this, we had to manually stop Build Agent, reinstall the NuGet Version and start the Build Agent again. Then, repeat the process for all the required NuGet Versions (each project was using different version – may be the lastest one at the creation of build). To add to our pain, Team City Nuget plugin turned out to be case sensitive and for some mysterious reason, the case of one of the NuGet Version file was different from what Team City would have liked. Fortunately, we were able to resolve all the issues related to Nuget plugin.&lt;/p&gt;

&lt;p&gt;Fixing the NuGet plugin issue fixed the build pipeline for most of our projects. But, few others were still failing because they had taken the dependency on NuGet packages cached on the Build Server. To fix we had to add the relevant NuGet source feed in the build steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  It was not over yet….
&lt;/h2&gt;

&lt;p&gt;Just when I thought that all the issues were resolved and I could go home peacefully, life came full circle and we started getting the original error on my build.  At this point in time, there was no way I could take the same risk to clear the Team City cache.&lt;/p&gt;

&lt;p&gt;So, I did some further digging and found out &lt;a href="https://github.com/GitTools/GitVersion/issues/912"&gt;this issue&lt;/a&gt;. Here is the summary of the issue:&lt;/p&gt;

&lt;p&gt;We were using &lt;a href="https://gitversion.readthedocs.io/en/latest/"&gt;GitVersion&lt;/a&gt;for &lt;a href="https://semver.org/"&gt;semantic&lt;/a&gt;versioning for our builds. &lt;strong&gt;GitVersion&lt;/strong&gt; needs access to master/develop branch to calculate the version number but Team City by default does not &lt;strong&gt;fetch&lt;/strong&gt; the master branch (unless already fetched). To resolve this issue, all I had to do is to add a configuration parameter &lt;strong&gt;numbers.git.fetchAllHeads=true.&lt;/strong&gt; Adding this parameter fixed the issue.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learnt
&lt;/h2&gt;

&lt;p&gt;We had many lessons learnt from this incident. First and foremost, was to be careful when dealing with Team City cache. However, one thing key thing here was that all the builds which did not have a dependency on Team City plugins (like mine) did not have any issue. As an organization, we are moving more towards &lt;em&gt;scripting&lt;/em&gt; the build steps as opposed to using plugins. This incident just validated our decision. For all the goodies Team City provide, I feel it still has a long way to go. While the other build management tools support YAML, configuring the builds through UI is still the preferred way for Team City. You cannot version control your build definition. Maybe as an organization, we need to start evaluating other options out there in the market.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This incident made me realize how awesome our IT team is. There was no finger-pointing and everyone was rather focused on fixing the issue. I’m lucky to be working here. And we are expanding, so if you are interested in joining our team, please email me at &lt;a href="mailto:vijayankit@outlook.com"&gt;vijayankit@outlook.com&lt;/a&gt; :)(&lt;a href="https://s.w.org/images/core/emoji/11/72x72/1f642.png"&gt;https://s.w.org/images/core/emoji/11/72x72/1f642.png&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://ankitvijay.net/2019/02/15/when-i-brought-down-build-pipeline-for-entire-organization/"&gt;When I brought down build-pipeline for entire organization&lt;/a&gt; appeared first on &lt;a href="https://ankitvijay.net"&gt;Hi, I'm Ankit&lt;/a&gt;.&lt;/p&gt;


</description>
      <category>net</category>
      <category>continuousdelivery</category>
      <category>continuousintegrati</category>
      <category>devops</category>
    </item>
    <item>
      <title>My Stack Overflow journey</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Wed, 09 Jan 2019 22:17:22 +0000</pubDate>
      <link>https://dev.to/ankitvijay/my-stack-overflow-journey-4o9e</link>
      <guid>https://dev.to/ankitvijay/my-stack-overflow-journey-4o9e</guid>
      <description>

&lt;p&gt;&lt;a href="https://stackoverflow.com/"&gt;Stack Overflow&lt;/a&gt; does not need an introduction. It is one platform that has helped millions of developers across the world to be a better programmer. It is &lt;strong&gt;Google&lt;/strong&gt; of software development. Maybe even more, because, Google still has competitors, Stack Overflow has none.&lt;/p&gt;


&lt;p&gt;Recently, I managed to cross &lt;a href="https://stackoverflow.com/users/921127/ankit-vijay"&gt;1000 reputation points&lt;/a&gt; on Stack Overflow. You may be thinking, what’s the big deal? Who writes a blog post for that? There are hundreds of people out there with over 100K reputations and many who may be adding 1000 reputation in a day. You are right, it is not a big deal to reach have 1000 reputations after 10 years of being a programmer. But still, it is somewhat special for me.&lt;/p&gt;

&lt;h3&gt;
  
  
  My first question
&lt;/h3&gt;

&lt;p&gt;I have been using Stack Overflow since forever but I have never been very active on the platform I asked my &lt;a href="https://stackoverflow.com/questions/7253930/integrate-facebook-fan-page-with-phone-application"&gt;first question&lt;/a&gt; way back in 2011 when &lt;strong&gt;Windows Phone&lt;/strong&gt; was still a rage.&lt;/p&gt;

&lt;h3&gt;
  
  
  What motivated me
&lt;/h3&gt;

&lt;p&gt;What really changed my outlook towards the platform was &lt;a href="https://stackoverflow.com/questions/29113123/process-waitforexit-not-waiting-for-multiple-chrome-instances"&gt;this question&lt;/a&gt;. I was at a customer location, highly stressful environment desperately looking for a solution to a not-so-easy problem. However, probably within 15 mins, my question was downvoted with a comment that I need to provide more information. I edited my question, provided more information but all I got was two not very helpful answers. This made me feel, maybe Stack Overflow is not so helpful platform after all, especially, if you were a new user. I found Stack Overflow to be hostile where you had to be lucky, very descriptive (difficult for a new user) or have a good reputation to get an answer to your question. The barrier of entry was just too high.&lt;/p&gt;

&lt;p&gt;What I wanted to change with my small contribution to the otherwise great community, was to help the folks who felt the same way as me. I never had time, energy or motivation to spend hours on Stack Overflow. But, spend a few minutes here and there in a week.&lt;/p&gt;

&lt;p&gt;Other such example was &lt;a href="https://stackoverflow.com/questions/47935231/ways-to-secure-an-anonymous-web-api-request"&gt;this question.&lt;/a&gt; I spent 20 mins framing the question, trying to explain my problem in-depth. But, it was downvoted within a minute without any explanation. Luckily, by that time I had gained enough reputation to put a &lt;a href="https://stackoverflow.com/help/bounty"&gt;bounty&lt;/a&gt;and get a good answer from the community.&lt;/p&gt;

&lt;h3&gt;
  
  
  My contribution in numbers
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Asked 15 questions on the platform, with 26 replies and 5 marked as answers.&lt;/li&gt;
&lt;li&gt;Answered 96 questions, of which 35 answers were upvoted at least once, 22 were marked as answer and 3 were downvoted.&lt;/li&gt;
&lt;li&gt;My most &lt;a href="https://softwareengineering.stackexchange.com/questions/330364/should-we-create-a-new-single-instance-of-httpclient-for-all-requests"&gt;popular question&lt;/a&gt; till date is not from Stack Overflow but Stack Engineering. It has received 51K views and 36 upvotes.&lt;/li&gt;
&lt;li&gt;Edited 41 posts, raised 27 flags and cast 114 votes, mostly upvotes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How Stack Overflow has helped me
&lt;/h3&gt;

&lt;p&gt;Contributing to Stack Overflow has helped me in many ways. It has helped me to better frame my problem statement. I feel I’m able to explain my problem to others much better than before. When I answer others question, I need to do a little bit of research myself, helping me to learn and grow. It gives immense satisfaction and joy to know that I could help a fellow developer somewhere in the world with his/ her problem. When I find questions for which I have no idea, it makes me realize where I stand. It keeps me grounded. Few of my questions/ answers have turned into a blog post and visa-versa. But, most importantly, Stack Overflow has helped me become a better programmer.&lt;/p&gt;

&lt;p&gt;If you are a programmer to then I encourage you to contribute to Stack Overflow or similar platform. I’m sure you will enjoy the experience and learning which comes along with it.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://ankitvijay.net/2019/01/10/stackoverflow/"&gt;My Stack Overflow journey&lt;/a&gt; appeared first on &lt;a href="https://ankitvijay.net"&gt;Hi, I'm Ankit&lt;/a&gt;.&lt;/p&gt;


</description>
      <category>community</category>
      <category>stackoverflow</category>
    </item>
    <item>
      <title>Override appSettings during development – .NET Core</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Thu, 27 Dec 2018 22:13:31 +0000</pubDate>
      <link>https://dev.to/ankitvijay/override-appsettings-during-development--net-core-foa</link>
      <guid>https://dev.to/ankitvijay/override-appsettings-during-development--net-core-foa</guid>
      <description>

&lt;p&gt;Sometime back, I had written about &lt;a href="https://dev.to/vijayankit/override-appsettings-during-development-2baj-temp-slug-7335002"&gt;how to override appSettings&lt;/a&gt; during development in traditional ASP.NET application.&lt;/p&gt;

&lt;p&gt;Recently, we started development of a ASP.NET Core application and had a similar challenge. Our developers work on different operating systems (Windows and Mac). They have different local connection strings and application settings. We had a same problem as earlier: How do we ensure that we do not store developer specific app settings/ connection string in source control.&lt;/p&gt;

&lt;p&gt;Configuration in ASP.NET Core is quite &lt;a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-2.2"&gt;advance and extensible&lt;/a&gt; as compared to traditional ASP.NET Framework. We have multiple ways to solve this problem. From the documentation:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;App configuration in ASP.NET Core is based on key-value pairs established by &lt;em&gt;configuration providers&lt;/em&gt;. Configuration providers read configuration data into key-value pairs from a variety of configuration sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Azure Key Vault&lt;/li&gt;
&lt;li&gt;Command-line arguments&lt;/li&gt;
&lt;li&gt;Custom providers (installed or created)&lt;/li&gt;
&lt;li&gt;Directory files&lt;/li&gt;
&lt;li&gt;Environment variables&lt;/li&gt;
&lt;li&gt;In-memory .NET objects&lt;/li&gt;
&lt;li&gt;Settings files&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Also, ASP.NET Core offers following &lt;a href="https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-2.2&amp;amp;tabs=windows"&gt;two recommended&lt;/a&gt; ways to store app secrets during development:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Environment variables&lt;/li&gt;
&lt;li&gt;Secret Manager&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the issue, with the above two approaches is that the settings are stored outside the IDE. Also, since these settings override the &lt;code&gt;appSettings.json file&lt;/code&gt; it can cause confusion while debugging as the developer may not realize that settings are being overridden.&lt;/p&gt;

&lt;h2&gt;
  
  
  Our Approach
&lt;/h2&gt;

&lt;p&gt;For our project we were looking for the simplest possible solution without any additional overhead. The easiest possible solution us for was to use &lt;code&gt;appSettings.Developement.json&lt;/code&gt; file to store local settings and exclude it from source control by adding to &lt;code&gt;.gitignore&lt;/code&gt; (we use Git).&lt;/p&gt;

&lt;p&gt;However, we already have a separate “&lt;code&gt;Dev&lt;/code&gt;” environment where we first deploy our application before pushing to &lt;code&gt;Test&lt;/code&gt; and &lt;code&gt;Live&lt;/code&gt; environments. Using the default &lt;code&gt;Developement&lt;/code&gt; environment for the purpose of storing the local settings could have confused the developers.&lt;/p&gt;

&lt;p&gt;As a result, we ended up adding a new &lt;strong&gt;&lt;code&gt;appSettings.Local.json&lt;/code&gt;&lt;/strong&gt; file to the project. This setting file was then added to &lt;code&gt;.gitignore&lt;/code&gt; to exclude this file from source control.&lt;/p&gt;

&lt;p&gt;Here is a sample &lt;code&gt;appSettings.Local.json&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We then, changed our &lt;code&gt;launchsettings.json&lt;/code&gt; and updated &lt;code&gt;ASPNETCORE_ENVIRONMENT&lt;/code&gt; to point to &lt;code&gt;Local&lt;/code&gt; instead of &lt;code&gt;Development&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Last but not the least, we updated &lt;code&gt;Startup.json&lt;/code&gt; to use developer exception page while doing development.&lt;/p&gt;


&lt;p&gt;That’s it! This approach helped us to keep all our settings in one place (within our IDE) and it turned out to be a pretty neat solution to our problem.&lt;/p&gt;

&lt;p&gt;Hope you find this tip useful. Please share your thoughts in comments section below.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://ankitvijay.net/2018/12/28/override-appsettings-during-development-net-core/"&gt;Override appSettings during development – .NET Core&lt;/a&gt; appeared first on &lt;a href="https://ankitvijay.net"&gt;Hi, I'm Ankit&lt;/a&gt;.&lt;/p&gt;


</description>
      <category>net</category>
      <category>netcore</category>
      <category>aspnetcore</category>
      <category>visualstudio</category>
    </item>
    <item>
      <title>DDD Brisbane – A weekend well spent</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Sun, 02 Dec 2018 00:03:16 +0000</pubDate>
      <link>https://dev.to/ankitvijay/ddd-brisbane--a-weekend-well-spent-2p8o</link>
      <guid>https://dev.to/ankitvijay/ddd-brisbane--a-weekend-well-spent-2p8o</guid>
      <description>

&lt;p&gt;This weekend (that is December 1st, 2018, Saturday), I along with a few of my colleagues from the office got an opportunity to attend &lt;a href="https://www.dddbrisbane.com/"&gt;DDD Brisbane&lt;/a&gt; conference. All thanks to my Employer, Youi, which was also the gold sponsor of the event. (We are &lt;a href="https://www.seek.com.au/Youi-jobs/full-time?classification=1209%2C6281%2C1220"&gt;hiring&lt;/a&gt;). If you do not know what is DDD conference is – It is short for Developer, Developer, Developer. It is a conference for, from, by, to, with, along, only, whatever…. Developers.&lt;/p&gt;

&lt;p&gt;Attending a conference on a weekend can be a challenging discussion with the spouse. It is not easy to justify why I would wake up 5 o’ clock on a Saturday morning to go to Brisbane and return late at night. Really grateful to my wife for her understanding and support. I have promised that I will make it up to her &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DvXCaIjD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/11/72x72/1f642.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DvXCaIjD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/11/72x72/1f642.png" alt="🙂"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This was my first time at a DDD conference, but certainly not the last. I thoroughly enjoyed the experience, listening to excellent speakers, food, free coffee, and goodies.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ONAaay4n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/ankitvijay.net/wp-content/uploads/2018/12/IMG_20181202_055650.jpg%3Fresize%3D255%252C340%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ONAaay4n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/ankitvijay.net/wp-content/uploads/2018/12/IMG_20181202_055650.jpg%3Fresize%3D255%252C340%26ssl%3D1" alt=""&gt;&lt;/a&gt;My DDD attendee card&lt;/p&gt;

&lt;p&gt;Here are my few key takeaways from the conference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The conference was very well organized. At the registration process was smooth, the organizers were friendly and helpful.&lt;/li&gt;
&lt;li&gt;Excellent food, free coffee, a lot of goodies and so many prizes to be won (unfortunately, I did not win any).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x41yN-EQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/ankitvijay.net/wp-content/uploads/2018/12/IMG_20181202_055451-1.jpg%3Fresize%3D225%252C300%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x41yN-EQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/ankitvijay.net/wp-content/uploads/2018/12/IMG_20181202_055451-1.jpg%3Fresize%3D225%252C300%26ssl%3D1" alt=""&gt;&lt;/a&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--utVN23nI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/ankitvijay.net/wp-content/uploads/2018/12/IMG_20181202_062934.jpg%3Ffit%3D768%252C1024%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--utVN23nI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/ankitvijay.net/wp-content/uploads/2018/12/IMG_20181202_062934.jpg%3Ffit%3D768%252C1024%26ssl%3D1" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It was a “green” conference in the true sense. The attendees were encouraged to bring their own coffee mugs. The coffee mugs, including the lid, were recyclable. The food plates, cutlery was made of bamboo, hence compostable. The reusable bags (or as they called it “swag bags”) were made of waste cloth by the local community.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7AN7WCkm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/ankitvijay.net/wp-content/uploads/2018/12/IMG_20181202_062901-1-3707210842-1543705421553.jpg%3Fssl%3D1%26w%3D956" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7AN7WCkm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/ankitvijay.net/wp-content/uploads/2018/12/IMG_20181202_062901-1-3707210842-1543705421553.jpg%3Fssl%3D1%26w%3D956" alt="IMG_20181202_062901-1.jpg"&gt;&lt;/a&gt;My Swag Bag&lt;/p&gt;



&lt;ul&gt;
&lt;li&gt;It was refreshing to see so many women attendees and speakers. DDD had by far the highest ratio of women attendees and speakers of any of the conferences I had previously attended.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://twitter.com/DDDBrisbane?ref_src=twsrc%5Etfw"&gt;@DDDBrisbane&lt;/a&gt; quick spot of feedback. I had to WAIT in line for a ladies bathroom to be free. I have NEVER had to do that while attending a software conference before.&lt;/p&gt;

&lt;p&gt;So I guess what I’m trying to say is nice work, keep it up &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_U26pzhQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/11/72x72/1f44f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_U26pzhQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/11/72x72/1f44f.png" alt="👏"&gt;&lt;/a&gt; &lt;a href="https://twitter.com/hashtag/DDDBne?src=hash&amp;amp;ref_src=twsrc%5Etfw"&gt;#DDDBne&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;— Emily Taylor (@_emilol) &lt;a href="https://twitter.com/_emilol/status/1068732634564505600?ref_src=twsrc%5Etfw"&gt;December 1, 2018&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;DDD offered Free Child Care facility. Again, this was the first time I saw any conference which offerred such facility.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Thanks to our Silver sponsor &lt;a href="https://twitter.com/thoughtworks?ref_src=twsrc%5Etfw"&gt;@thoughtworks&lt;/a&gt; for sponsoring this year! We've said it before and we'll say it again – we can't thank them enough for funding and organising child care for us. &lt;a href="https://twitter.com/hashtag/dddbne?src=hash&amp;amp;ref_src=twsrc%5Etfw"&gt;#dddbne&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;— DDD Brisbane (@DDDBrisbane) &lt;a href="https://twitter.com/DDDBrisbane/status/1068701218111799296?ref_src=twsrc%5Etfw"&gt;December 1, 2018&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;The speaker line up was a mix of first-timers and experienced speakers. I enjoyed all the sessions which I attended.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aSKCGHxG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/ankitvijay.net/wp-content/uploads/2018/12/Speakers.jpg%3Fw%3D810%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aSKCGHxG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/ankitvijay.net/wp-content/uploads/2018/12/Speakers.jpg%3Fw%3D810%26ssl%3D1" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enough gap between the two sessions – there was no information overload.&lt;/li&gt;
&lt;li&gt;There was something to learn in every session. None of them were a waste of time.&lt;/li&gt;
&lt;li&gt;Few sessions also validated that we follow the industry-wide and recommended development practices at work. In fact, we are probably ahead of rest of industry in some area :). In particular, code snippets from clean architecture with .NET Core 2.2 session looked to be straight out of our private repo.&lt;/li&gt;
&lt;li&gt;It was great opportunity to interact with fellow developers&lt;/li&gt;
&lt;li&gt;Special mention to keynote speaker Jessica Kerr. But the highlight of the day for me was locknote from Neal Ford on “Support Constant Change”. There was just so much to learn in his 45 mins talk.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rjIsA2dU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/ankitvijay.net/wp-content/uploads/2018/12/IMG_20181201_171313.jpg%3Fresize%3D300%252C225%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rjIsA2dU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/ankitvijay.net/wp-content/uploads/2018/12/IMG_20181201_171313.jpg%3Fresize%3D300%252C225%26ssl%3D1" alt=""&gt;&lt;/a&gt;Hit the nail..&lt;/p&gt;

&lt;p&gt;All-in-all it was a great weekend spent learning new things.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://ankitvijay.net/2018/12/02/ddd-brisbane-a-weekend-well-spent/"&gt;DDD Brisbane – A weekend well spent&lt;/a&gt; appeared first on &lt;a href="https://ankitvijay.net"&gt;Hi, I'm Ankit&lt;/a&gt;.&lt;/p&gt;


</description>
      <category>net</category>
      <category>conference</category>
      <category>ddd</category>
    </item>
    <item>
      <title>Journey towards UI tests greatness – Lessons Learnt</title>
      <dc:creator>Ankit Vijay</dc:creator>
      <pubDate>Tue, 30 Oct 2018 22:08:48 +0000</pubDate>
      <link>https://dev.to/ankitvijay/journey-towards-ui-tests-greatness--lessons-learnt-1amd</link>
      <guid>https://dev.to/ankitvijay/journey-towards-ui-tests-greatness--lessons-learnt-1amd</guid>
      <description>

&lt;h2&gt;
  
  
  &lt;strong&gt;A bit of a background&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;I work on a long-running running project in our organization. We have a CI/CD pipeline for our project following the GitHub flow and backed by thousands of unit tests, hundreds of integration tests. However, until recently we were missing a key piece to the puzzle. UI Tests!&lt;/p&gt;

&lt;p&gt;It’s not that we did not have UI tests, we had plenty (rather just too many) but we were not able to run them on our build server with &lt;strong&gt;confidence&lt;/strong&gt; for the reasons I will go into later. And since UI tests were not running on every build, we still needed to verify each build for regression. In short, we were not really doing a &lt;strong&gt;Continuous Delivery&lt;/strong&gt;. Our QA as smart he is, then built his own set of UI test suite which he would run on every build to validate the quality of the build.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why we were not able to run UI tests with Confidence
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Our UI tests were &lt;strong&gt;flaky&lt;/strong&gt;. The tests would fail often to due _ &lt;strong&gt;external factors&lt;/strong&gt; _ especially on the build server_ &lt;strong&gt;.&lt;/strong&gt; _ On top of it, the very nature of UI tests is that they are very slow as compared to unit tests or integration tests. To run the entire test suite every time a test failed due to some &lt;em&gt;external factors&lt;/em&gt; wasted a lot of time.&lt;/li&gt;
&lt;li&gt;Our UI tests were &lt;strong&gt;brittle.&lt;/strong&gt; They were trying to do more than a UI test. They were heavily reliant on the HTML page structure. As a result, they would fail even with minimal changes.&lt;/li&gt;
&lt;li&gt;The flaky and brittle nature of UI tests meant that the developers lost trust in the UI test framework. As a result, they were &lt;strong&gt;not well maintained&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The UI tests were flooded with a lot of a &lt;strong&gt;Thread.Sleep&lt;/strong&gt;. And Thread.Sleep led to two bigger issues:

&lt;ul&gt;
&lt;li&gt;There was no way we could know what was the right delay. Each second delay added had a ripple effect on the already slow tests&lt;/li&gt;
&lt;li&gt;In spite of adding the delays, there was no guarantee that the tests would pass.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;The UI tests did &lt;strong&gt;not&lt;/strong&gt; really represent the &lt;strong&gt;business scenarios&lt;/strong&gt;. They were written more with an idea of testing the UI elements. Hence, at times we end up testing not the actual business use case.&lt;/li&gt;
&lt;li&gt;The tests &lt;strong&gt;did not&lt;/strong&gt; follow &lt;strong&gt;SOLID&lt;/strong&gt; and &lt;strong&gt;DRY&lt;/strong&gt; principles. They never got the same love and treatment as application code. This made them difficult and harder to maintain.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Fixing the broken tests&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We are a very small team of dev and single QA. However, we deliver the new business features and bug-fixes at a very high velocity. As the complexity of the solution started growing it became more evident and obvious to that we cannot deliver the solution with a high confidence without the UI tests. Our QA was forced to focus more on mundane testing rather than planning ahead for the next User Stories.&lt;/p&gt;

&lt;p&gt;That’s when we took a step back and decided to do something about it. We listed down our pain-points with existing UI framework and worked upon each point to develop &lt;strong&gt;UI framework 2.0&lt;/strong&gt;. The ultimate aim of this exercise was to resolve the above issues and start running the tests as part of our CI/CD pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Put business first&lt;/strong&gt; – To ensure that we do not repeat our mistakes we started our UI tests with the question how would our consumers use our application. We worked with our QA to get the list of important business scenarios. We planned our test cases BDD style and chose &lt;a href="https://wordpress.com/post/ankitvijay.net/3763"&gt;SpecFlow&lt;/a&gt; to write our tests. SpecFlow allowed us to write tests in such that both our BA and QA could easily understand the test cases and even contribute to the tests. While planning for the test cases we kept reminding ourselves of &lt;a href="https://martinfowler.com/bliki/TestPyramid.html"&gt;Test Pyramid&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Follow good development practices –&lt;/strong&gt; The UI test framework was no longer a rejected child. We developed the framework same way as we would write an application code. The tests followed SOLID and DRY principles. All the components such as SpecFlow, Business Logic, Selenium were loosely coupled. The framework allowed Dev to not worry about the low-level UI elements but only what steps needed to be executed in a scenario.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Thread.Sleep –&lt;/strong&gt; Thread.Sleep in UI tests is evil. At the start, it looks to be the solution to every problem. But soon it starts creating problems. The framework 2.0 did not use Thread.Sleep anywhere (or may just one place :)). The &lt;strong&gt;Thread.Sleep&lt;/strong&gt; was replaced by Selenium &lt;a href="https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp"&gt;implicit and explicit&lt;/a&gt;waits. This helped us keep the tests fast and reliable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compatible with Feature Flags –&lt;/strong&gt; I mentioned in one of my &lt;a href="https://ankitvijay.net/2017/10/08/launch-darkly/"&gt;older posts&lt;/a&gt; that we use Launch Darkly for feature flag management. The new UI framework allowed us to test scenarios with different feature flag variations (example: feature turned OFF/ ON). Feature flags were an essential part of our tests as they could vary depending on the environment, flow etc. Hence, it was important for us to be able to test all the variations easily.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retry Policy&lt;/strong&gt; – In spite of all the goodness mentioned in the above points, the UI test suite could still fail due to factors beyond our control. That’s where we decided to add retry policy. The retry policy was defined at two levels:

&lt;ul&gt;
&lt;li&gt;Retry the _ &lt;strong&gt;action,&lt;/strong&gt; _ if the action failed in the first attempt.&lt;/li&gt;
&lt;li&gt;Retry the _ &lt;strong&gt;test case&lt;/strong&gt; _, if the test failed in the first attempt.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Developing UI framework 2.0 was a journey and it took quite some time and effort for us to reach to the point where we could start running our UI tests as part of our CI/CD pipeline again. As we worked on the framework to get the constant feedback, we ran the UI tests on the build server separate to our CI/CD pipeline. Running the UI tests in a separate build allowed us to make improvements to the framework without impacting the business-as-usual. And once we had enough confidence in our UI tests we got rid of the separate build and made the UI tests part of the mainline build.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What’s Next&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There is no such thing as a perfect solution or framework. We intend to improve the framework further. Few things which we are looking to improve in future are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run tests in parallel to reduce the build time on the server&lt;/li&gt;
&lt;li&gt;Add more complex business scenarios to bring the test effort to minimal&lt;/li&gt;
&lt;li&gt;Integrate tests with &lt;a href="https://www.browserstack.com/"&gt;BrowserStack&lt;/a&gt; to across the platform and devices. Check out my &lt;a href="https://dev.to/vijayankit/test-your-app-across-the-browsers-through-browserstack-19f7-temp-slug-1704615"&gt;post&lt;/a&gt; to know more about BrowserStack.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The post &lt;a href="https://ankitvijay.net/2018/10/31/journey-towards-ui-test-cases-greatness-lessons-learnt/"&gt;Journey towards UI tests greatness – Lessons Learnt&lt;/a&gt; appeared first on &lt;a href="https://ankitvijay.net"&gt;Hi, I'm Ankit&lt;/a&gt;.&lt;/p&gt;


</description>
      <category>net</category>
      <category>automationtesting</category>
      <category>continuousdelivery</category>
      <category>continuousintegrati</category>
    </item>
  </channel>
</rss>
