<?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: Brett Cassette</title>
    <description>The latest articles on DEV Community by Brett Cassette (@brettshollenberger).</description>
    <link>https://dev.to/brettshollenberger</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%2F138686%2F17a80282-caff-4317-bb42-eb81bfb75296.jpeg</url>
      <title>DEV Community: Brett Cassette</title>
      <link>https://dev.to/brettshollenberger</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/brettshollenberger"/>
    <language>en</language>
    <item>
      <title>Let's Build a Web Scraper with Cypress!</title>
      <dc:creator>Brett Cassette</dc:creator>
      <pubDate>Fri, 12 Apr 2019 17:06:07 +0000</pubDate>
      <link>https://dev.to/brettshollenberger/let-s-build-a-web-scraper-with-cypress-1g5l</link>
      <guid>https://dev.to/brettshollenberger/let-s-build-a-web-scraper-with-cypress-1g5l</guid>
      <description>&lt;p&gt;&lt;a href="https://egghead.io/lessons/cypress-create-a-web-scraper-with-cypress" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fyk7ev8mmeuc62bzo6bek.png" alt="Check out the Free Lesson on Egghead.io"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What would you build if you had a web scraper?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maybe your fitness tracker has no public API?&lt;/li&gt;
&lt;li&gt;Or you want to always outprice your competitors?&lt;/li&gt;
&lt;li&gt;Maybe you want to correlate and visualize data from multiple, disconnected platforms?&lt;/li&gt;
&lt;li&gt;Want to automate common tasks on an external site?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Or maybe you're like me, and the website that lists all your open mic comedy events doesn't have any ability to search, filter, or show event locations on a map.&lt;/p&gt;

&lt;p&gt;So how do we ingest this data for fun and profit?&lt;/p&gt;

&lt;h2&gt;
  
  
  Cypress to the Rescue
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.cypress.io/" rel="noopener noreferrer"&gt;Cypress&lt;/a&gt; is a blazing-fast end-to-end testing framework. Since it can interact with any webpage, we can also use it to automate interactions with external sites!&lt;/p&gt;

&lt;p&gt;Build it along with me in this free lesson on Egghead.io!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://egghead.io/lessons/cypress-create-a-web-scraper-with-cypress" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fyk7ev8mmeuc62bzo6bek.png" alt="Check out the Free Lesson on Egghead.io"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>webscraper</category>
    </item>
    <item>
      <title>High Stakes Poker</title>
      <dc:creator>Brett Cassette</dc:creator>
      <pubDate>Thu, 21 Feb 2019 15:11:36 +0000</pubDate>
      <link>https://dev.to/brettshollenberger/high-stakes-poker-79l</link>
      <guid>https://dev.to/brettshollenberger/high-stakes-poker-79l</guid>
      <description>

&lt;p&gt;&lt;em&gt;This article is part of my &lt;a href="brettcassette.com"&gt;Testing from First Principles series&lt;/a&gt;. If you enjoyed this series, stay tuned for practical testing advice on my Cypress End-To-End Testing course on &lt;a href="https://egghead.io"&gt;egghead.io&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you're always playing poker for very high stakes, sometimes you're gonna get burned for very high stakes.&lt;/p&gt;

&lt;p&gt;Especially when you're trying something new (like launching new code), doesn't it make sense to play for lower stakes?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t4owoh0p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://brettcassette.com/static/18ed1ad1e2a54298a3c05504c86aa86f/27660/worst_case-01.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t4owoh0p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://brettcassette.com/static/18ed1ad1e2a54298a3c05504c86aa86f/27660/worst_case-01.webp" alt="Worst Case Scenario"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the worst case scenario for your code is: "no customers can checkout all day," then we can use modern tools like &lt;a href="https://github.com/Alephbet/alephbet"&gt;A/B test groups&lt;/a&gt; to make sure your code was only released to 1% of customers, drastically reducing our risk. Now your worst case scenario is reduced to "1% of users couldn't check out all day."&lt;/p&gt;

&lt;p&gt;But how can we get alerted earlier, so our outage isn't all day long? With dashboard tools like AppOptics or Amplitude, and automated alerts from the likes of PagerDuty or Pingdom, we can detect anomalous behavior sooner, as long as we define in advance what our metrics are.&lt;/p&gt;

&lt;p&gt;When an anomaly is detected, we can rely on our &lt;a href="https://featureflags.io/javascript-feature-flags/"&gt;feature flipper library of choice&lt;/a&gt; to turn off the code path for everyone. Maybe we've reduced our outage from "No one could check out all day" to "1% of users couldn't check out for 1 minute."&lt;/p&gt;

&lt;p&gt;A much better scenario.&lt;/p&gt;

&lt;p&gt;Testing is just one of the ways we can feel confident about our code. The more we can decrease our maximum risk, the less we stand to lose. Think of it like portfolio diversification.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I think it's important that we start out by giving ourselves the lowest possible stakes&lt;/strong&gt;--the least worst case scenario to start from before we even begin evaluating the value of testing. Why would you want every deploy to potentially risk losing the company a bunch of money?&lt;/p&gt;

&lt;p&gt;Before you even begin testing, remember to weigh what's at stake, and consider what alternative approaches you can use to mitigate your risk. When testing is essential for code confidence, &lt;a href="http://www.brettcassette.com/false-sense-of-security"&gt;make sure your tests aren't providing a false sense of security&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article is part of my &lt;a href="brettcassette.com"&gt;Testing from First Principles series&lt;/a&gt;. If you enjoyed this series, stay tuned for practical testing advice on my Cypress End-To-End Testing course on &lt;a href="https://egghead.io"&gt;egghead.io&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;


</description>
      <category>testing</category>
      <category>javascript</category>
      <category>codeconfidence</category>
    </item>
    <item>
      <title>Are Your Tests Providing A False Sense of Security?</title>
      <dc:creator>Brett Cassette</dc:creator>
      <pubDate>Wed, 20 Feb 2019 21:17:06 +0000</pubDate>
      <link>https://dev.to/brettshollenberger/are-your-tests-providing-a-false-sense-of-security-117h</link>
      <guid>https://dev.to/brettshollenberger/are-your-tests-providing-a-false-sense-of-security-117h</guid>
      <description>&lt;p&gt;&lt;em&gt;This article is part of my &lt;a href="http://www.brettcassette.com"&gt;Testing from First Principles series&lt;/a&gt;. If you enjoyed this series, stay tuned for practical testing advice on my Cypress End-To-End Testing course on &lt;a href="https://egghead.io"&gt;egghead.io&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tests as Checklists
&lt;/h2&gt;

&lt;p&gt;I think of tests much in the way that Atul Gawande describes surgeons' checklists in &lt;a href="https://www.amazon.com/Checklist-Manifesto-How-Things-Right/dp/0312430000"&gt;The Checklist Manifesto&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Our jobs are complex, and we can miss incredibly basic things unless we have a checklist.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;But a checklist is executed by a human&lt;/strong&gt;. It forces us to consider the various complexities and edge cases one by one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automated tests are executed by a computer&lt;/strong&gt;, without manual intervention, and without us being forced to review them.&lt;/p&gt;

&lt;p&gt;Which leads to some questions to consider...&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When's the last time you looked at your tests?&lt;/li&gt;
&lt;li&gt;Do they test only the happy path? Or all edge cases?&lt;/li&gt;
&lt;li&gt;Did you mock out some objects to improve test speed? Or is everything tested end-to-end? Do you remember?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why are you confident these tests will keep your application safe?
&lt;/h2&gt;

&lt;p&gt;When we're confident the "checklist" is correct and complete, we can miss things that would have been blindingly obvious if we thought about the problem ourselves.&lt;/p&gt;

&lt;p&gt;If your boss asks, "Is this code safe to ship?" and you reply, "The tests are passing," then you haven't answered the question. You haven't engaged with the process of doing so because it's much easier and requires less accountability to trust in the tests.&lt;/p&gt;

&lt;p&gt;Tests can provide security when done right. But when we fail to consistently engage with our tests, that sense of security is undeserved. &lt;strong&gt;We have to know what the tests exercise, why, and what's missing.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is this test case an accurate representation of how users really interact with our website?&lt;/li&gt;
&lt;li&gt;Are we truly testing features end-to-end?&lt;/li&gt;
&lt;li&gt;Are we using real user data, or imaginary scenarios?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your tests might be really killer. Or they might be a security blanket when what you need is a shield.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Advice
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Testing is great, but if it's the only tooling giving you code confidence, you're playing &lt;a href="http://www.brettcassette.com/high-stakes-poker"&gt;High Stakes Poker&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;End-to-end testing used to be slow and flaky with Selenium, but with &lt;a href="//cypress.io"&gt;Cypress&lt;/a&gt;, you can get the security of e2e that's worth the investment.&lt;/li&gt;
&lt;li&gt;Cypress enables testing against all levels of the stack (databases, XHR requests and responses, frontend stores, and UI), and doing so will communicate to your teammates what the entire lifecycle should look like. This is particularly helpful for more junior team members, or team members unfamiliar with your product's technology.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;This article is part of my &lt;a href="http://www.brettcassette.com"&gt;Testing from First Principles series&lt;/a&gt;. If you enjoyed this series, stay tuned for practical testing advice on my Cypress End-To-End Testing course on &lt;a href="https://egghead.io"&gt;egghead.io&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>testing</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
