<?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: Valentina (Cupać) Jemuović </title>
    <description>The latest articles on DEV Community by Valentina (Cupać) Jemuović  (@valentinajemuovic).</description>
    <link>https://dev.to/valentinajemuovic</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%2F1412118%2F41fc7ce1-26f4-45a3-a7d2-4bb329a82e43.jpeg</url>
      <title>DEV Community: Valentina (Cupać) Jemuović </title>
      <link>https://dev.to/valentinajemuovic</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/valentinajemuovic"/>
    <language>en</language>
    <item>
      <title>Modern Test Pyramid</title>
      <dc:creator>Valentina (Cupać) Jemuović </dc:creator>
      <pubDate>Fri, 27 Dec 2024 10:11:30 +0000</pubDate>
      <link>https://dev.to/optivem/modern-test-pyramid-4dfc</link>
      <guid>https://dev.to/optivem/modern-test-pyramid-4dfc</guid>
      <description>&lt;p&gt;The Old Test Pyramid (Unit, Integration &amp;amp; E2E tests) - is dead. It's got fundamental problems. That's why we're introducing the Modern Test Pyramid, so you can practice effective Automated Testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Old Test Pyramid is dead
&lt;/h2&gt;

&lt;p&gt;Most developers see the Test Pyramid in the following way:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fls8p4ju42akraczxlxrl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fls8p4ju42akraczxlxrl.png" alt="The Old Test Pyramid" width="620" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We previously outlined the problems with the Old Test Pyramid:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Overuse of E2E tests, often reaching the Inverted Test Pyramid&lt;/li&gt;
&lt;li&gt;No consensus on the definition of Integration Tests, and over-reliance on large scoped integration tests makes it hard to maintain&lt;/li&gt;
&lt;li&gt;No consensus on the definition of Unit Tests, and writing unit tests that are structurally coupled to code with over-mocking, thus fragile when refactoring&lt;/li&gt;
&lt;li&gt;The Test Pyramid does not include Acceptance Tests needed for testing Acceptance Criteria, but instead it relies on fragile E2E Tests for that&lt;/li&gt;
&lt;li&gt;The Test Pyramid doesn't provide us guidance for testing microservices, specifically it doesn't even mention Component Tests &amp;amp; Contract Tests which are crucial for microservice testing&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Modern Test Pyramid
&lt;/h2&gt;

&lt;p&gt;Now let's look at the Modern Test Pyramid:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fyuhmqme066ei0ss7kxs2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fyuhmqme066ei0ss7kxs2.png" alt="Modern Test Pyramid" width="800" height="638"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also view it as a Test Spectrum where we illustrate the test spans:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ff56ryyw6grzaqlwft8a1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ff56ryyw6grzaqlwft8a1.png" alt="Test Spectrum" width="800" height="953"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's see the test types - why they are used, what they target and span:&lt;/p&gt;

&lt;h3&gt;
  
  
  Smoke Tests
&lt;/h3&gt;

&lt;p&gt;We use Smoke Tests to verify that the System is up-and-running.&lt;br&gt;
Smoke Tests target the System - they span the System and External System Stubs or External System Test Instances.&lt;/p&gt;

&lt;h3&gt;
  
  
  E2E Tests
&lt;/h3&gt;

&lt;p&gt;We use E2E Tests to verify System behavior, however the scenarios are limited.&lt;/p&gt;

&lt;p&gt;E2E Tests target the System - they span the System and External System Test Instances. They are executed on the E2E Environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Acceptance Tests
&lt;/h3&gt;

&lt;p&gt;We use Acceptance Tests to verify behavior of the System. We have the possibility to execute any scenario.&lt;/p&gt;

&lt;p&gt;Acceptance Tests target the System, and they span the System and External System Stubs.&lt;/p&gt;

&lt;h3&gt;
  
  
  External System Contract Tests
&lt;/h3&gt;

&lt;p&gt;External System Contract Tests are used to verify that we can communicate with External System Test Instances and that their contract matches our expectations.&lt;/p&gt;

&lt;p&gt;External System Contract Tests target (and span) the External System Test Instances.&lt;/p&gt;

&lt;h3&gt;
  
  
  Component Tests
&lt;/h3&gt;

&lt;p&gt;We use Component Tests to verify the behavior of Components (e.g. verifying behavior of Frontend, Microservice #1, Microservice #2, Microservice #3)&lt;/p&gt;

&lt;p&gt;Component Tests target the Components, and span Component Dependency Stubs (e.g. targeting Microservice #1 and Microservice #2 Stub and External System A Stub)&lt;/p&gt;

&lt;h3&gt;
  
  
  Contract Tests
&lt;/h3&gt;

&lt;p&gt;We use Contract Tests to verify communication between a Component and its Dependencies.&lt;/p&gt;

&lt;p&gt;Common example is Consumer Driven Contract Testing&lt;/p&gt;

&lt;h3&gt;
  
  
  Unit Tests
&lt;/h3&gt;

&lt;p&gt;We use Unit Tests to verify application-side business behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  Narrow Integration Tests
&lt;/h3&gt;

&lt;p&gt;We use Narrow Integration Tests to verify presentation behavior and infrastructure behavior within the Component.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Modern Test Pyramid solves problems
&lt;/h2&gt;

&lt;p&gt;The Modern Test Pyramid SOLVES the problems of the Old Test Pyramid in the following ways:&lt;/p&gt;

&lt;h3&gt;
  
  
  Problematic E2E tests
&lt;/h3&gt;

&lt;p&gt;In the Old Test Pyramid, E2E Tests are problematic because they are limited regarding scenarios when testing System Behavior. The tests are often fragile and non-deterministic.&lt;/p&gt;

&lt;p&gt;In the Modern Test Pyramid, we solve that problem through Acceptance Tests (together with External System Contract Tests) which enables us to fully test System Behavior in a deterministic, reliable way.&lt;br&gt;
Problematic Integration tests&lt;/p&gt;

&lt;p&gt;In the Old Test Pyramid, Integration Tests are problematic because developers generally interpreted them as Broad Integration Tests. They had similar characteristics as E2E Tests - limited scenarios and fragility, with the additional problem that it was hard to isolate where the fault is occurring.&lt;/p&gt;

&lt;p&gt;That's why in the Modern Test Pyramid, we introduce Component Tests &amp;amp; Contract Tests to replace Broad Integration Tests. We can fully test each Component and its interactions with other Components in a reliable way.&lt;/p&gt;

&lt;h3&gt;
  
  
  No clue how to handle Microservice Architecture
&lt;/h3&gt;

&lt;p&gt;In the Old Test Pyramid, there was no guidance how to handle Microservice Architecture. Often teams would use Broad Integration Testing for microservices, then waste time debugging which microservice was at fault, and cause a lot of dependencies between microservice teams.&lt;/p&gt;

&lt;p&gt;The Modern Test Pyramid contains Component Tests, which are very effective for separately testing Frontend and each Microservice. It also contains Contract Tests, which are effective for testing communication with another microservice without having both of them running.&lt;/p&gt;

&lt;h3&gt;
  
  
  No clue how to test Presentation &amp;amp; Infrastructure Logic
&lt;/h3&gt;

&lt;p&gt;In the Old Test Pyramid, there's no guidance on testing Presentation Logic and Infrastructure Logic, but only Business Logic. Sure, we'd use Unit Tests for Business Logic, but what kind of tests do we need for Presentation Logic &amp;amp; Infrastructure Logic? The Old Test Pyramid doesn't provide an answer.&lt;/p&gt;

&lt;p&gt;In the Modern Test Pyramid, we solve that problem with Narrow Integration Tests.&lt;/p&gt;

&lt;p&gt;Let's dive deeper - you can read the full article: &lt;a href="https://journal.optivem.com/p/new-test-pyramid" rel="noopener noreferrer"&gt;Modern Test Pyramid (Optivem Journal)&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>tdd</category>
      <category>softwaredevelopment</category>
      <category>automatedtesting</category>
    </item>
    <item>
      <title>The Old Test Pyramid is Dead</title>
      <dc:creator>Valentina (Cupać) Jemuović </dc:creator>
      <pubDate>Thu, 26 Dec 2024 10:02:03 +0000</pubDate>
      <link>https://dev.to/optivem/the-old-test-pyramid-is-dead-425k</link>
      <guid>https://dev.to/optivem/the-old-test-pyramid-is-dead-425k</guid>
      <description>&lt;p&gt;You’ve all heard of the Test Pyramid — E2E Tests, Integration Tests, and Unit Tests. It’s popular. But it has BIG problems — misinterpretations of test types and missing test types. It’s dangerous.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Original Test Pyramid
&lt;/h2&gt;

&lt;p&gt;The Test Pyramid was introduced by Mike Cohn in 2009 in his book Succeeding with Agile: Software Development Using Scrum. He has the following levels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;UI Tests&lt;/li&gt;
&lt;li&gt;Service Tests&lt;/li&gt;
&lt;li&gt;Unit Tests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fs54xcunflf7mpzjugy7m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fs54xcunflf7mpzjugy7m.png" alt="Original Test Pyramid" width="620" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  UI Tests
&lt;/h2&gt;

&lt;p&gt;Mike Cohn indicates that the minority of the tests should be UI tests. He notes their disadvantages — that they are: “Brittle”, “Expensive to write” and “Time consuming”.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Automated user interface testing is placed at the top of the test automation pyramid because we want to do as little of it as possible.” — Mike Cohn, Succeeding with Agile&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Service Tests
&lt;/h2&gt;

&lt;p&gt;He places Service Tests in the middle, to avoid the situation that we have too many UI tests, instead we want to test at the layer below the UI.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Service-level testing is about testing the services of an application separately from its user interface. So instead of running a dozen or so multiplication test cases through the calculator’s user interface, we instead perform those tests at the service level.” — Mike Cohn, Succeeding with Agile&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;However, it should also be noted that he isn’t too precise regarding the definition of service tests, that it doesn’t just mean SOA but can refer to anything that’s transforming inputs into outputs:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Although I refer to the middle layer of the test automation pyramid as the service layer, I am not restricting us to using only a service-oriented architecture. All applications are made up of various services. In the way I’m using it, a service is something the application does in response to some input or set of inputs.” — Mike Cohn, Succeeding with Agile&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Service Tests are often forgotten, so he wrote a blog post about the forgotten service level testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unit Tests
&lt;/h2&gt;

&lt;p&gt;Mike Cohn indicates that the majority of our tests should be unit tests. Unit tests are useful due to the fast feedback they provide, that we can easily localize regression bugs within code:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“At the base of the test automation pyramid is unit testing. Unit testing should be the foundation of a solid test automation strategy and as such represents the largest part of the pyramid. Automated unit tests are wonderful because they give specific data to a programmer — there is a bug and it’s on line 47.” — Mike Cohn, Succeeding with Agile&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Popularized Test Pyramid
&lt;/h2&gt;

&lt;p&gt;If you do a Google search for Test Pyramid images, most likely you’ll end up with an image that looks like this, with these layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;E2E Tests&lt;/li&gt;
&lt;li&gt;Integration Tests&lt;/li&gt;
&lt;li&gt;Unit Tests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fcbu2rzpiiw6oec1tvuei.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fcbu2rzpiiw6oec1tvuei.png" alt="Popular Test Pyramid" width="620" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s THE way to do automated testing, right?&lt;/p&gt;

&lt;p&gt;Wrong.&lt;/p&gt;

&lt;p&gt;Using the “Popular” version of the Test Pyramid has led to the following problems:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Overuse of E2E tests, often reaching the Inverted Test Pyramid&lt;/li&gt;
&lt;li&gt;No consensus on the definition of Integration Tests, and over-reliance on large scoped integration tests makes it hard to maintain&lt;/li&gt;
&lt;li&gt;No consensus on the definition of Unit Tests, and writing unit tests that are structurally coupled to code with over-mocking, thus fragile when refactoring&lt;/li&gt;
&lt;li&gt;The Test Pyramid does not include Acceptance Tests needed for testing Acceptance Criteria, but instead it relies on fragile E2E Tests for that&lt;/li&gt;
&lt;li&gt;The Test Pyramid doesn’t provide us guidance for testing microservices, specifically it doesn’t even mention Component Tests &amp;amp; Contract Tests which are crucial for microservice testing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To dive deeper into the problems of the old Test Pyramid, read the &lt;a href="https://journal.optivem.com/p/old-test-pyramid" rel="noopener noreferrer"&gt;full article&lt;/a&gt; on Optivem Journal.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
