{"id":4569,"date":"2022-10-17T08:00:52","date_gmt":"2022-10-17T07:00:52","guid":{"rendered":"https:\/\/www.diogonunes.com\/blog\/?p=4569"},"modified":"2022-10-28T09:59:46","modified_gmt":"2022-10-28T08:59:46","slug":"lean-contract-testing-with-chakram","status":"publish","type":"post","link":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/","title":{"rendered":"Lean contract testing with Chakram"},"content":{"rendered":"<figure id=\"attachment_4571\" aria-describedby=\"caption-attachment-4571\" style=\"width: 580px\" class=\"wp-caption aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?resize=580%2C387&#038;ssl=1\" alt=\"\" width=\"580\" height=\"387\" class=\"size-large wp-image-4571\" srcset=\"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?resize=1024%2C684&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?resize=400%2C267&amp;ssl=1 400w, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?resize=768%2C513&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?resize=1536%2C1026&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?resize=1200%2C801&amp;ssl=1 1200w, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?w=1920&amp;ssl=1 1920w, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?w=1740&amp;ssl=1 1740w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><figcaption id=\"caption-attachment-4571\" class=\"wp-caption-text\">Photo by <a href=\"https:\/\/unsplash.com\/@cytonn_photography?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Cytonn Photography<\/a> on <a href=\"https:\/\/unsplash.com\/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Unsplash<\/a><br \/><\/figcaption><\/figure>\n<blockquote>\n<p>\ud83c\udfc6 This post was featured in <a href=\"https:\/\/softwaretestingweekly.com\/issues\/142\">Software Testing Weekly #142<\/a> and <a href=\"https:\/\/www.lambdatest.com\/newsletter\/editions\/issue111\">CodingJab #111<\/a><\/p>\n<\/blockquote>\n<p>During my career, every time my team has to rely on a 3rd-party API, there comes the day where that API fails. Maybe it is down but usually they released a breaking change that breaks the previous contract. Our team does not notice it, but the client\/user does and then we look bad.<\/p>\n<p><!--more--><\/p>\n<p>Even though there was a problem in the backstage (provider API), our system is the one that faces the users. So there&#8217;s a problem, we are the ones who get hit with the \ud83c\udf45 rotten vegetables, thrown by the angry audience.<\/p>\n<h3>Test closer to the problem<\/h3>\n<p>There&#8217;s multiple ways to reduce the risk of this ever happening.<\/p>\n<p>You can test flows of your system, so that you can notice when something becomes broken. This approach will tell you there&#8217;s a problem, but it&#8217;s unlikely it will tell you where. That&#8217;s the problem of <em>&#8220;Testing Through the UI&#8221;<\/em>, instead of <em>&#8220;Testing the API&#8221;<\/em>. If you want to read more about it, check <a href=\"https:\/\/www.mwtestconsultancy.co.uk\/say-tatta-to-your-tuttu-talk\/\">Say TaTTa to your TuTTu<\/a> by Mark Winteringham.<\/p>\n<p>Since we want to detect a broken API, let&#8217;s test as close as possible to that API. That&#8217;s the interface or contract of the API. If you are curious, check <a href=\"https:\/\/blog.thecodewhisperer.com\/permalink\/integrated-tests-are-a-scam\">Integration tests are a scam<\/a> by J. B. Rainsberger.<\/p>\n<p>We know how to call the API and we know what we expect to get in return, both in terms of <strong>structure<\/strong> and <strong>data<\/strong>. We want a test to fail when:<\/p>\n<ul>\n<li>One required field goes missing (structure), e.g. <code>bookAuthor<\/code> field is not returned.<\/li>\n<li>One required value changes (data), e.g. <code>publishedAt<\/code> value no longer follows <a href=\"https:\/\/en.wikipedia.org\/wiki\/ISO_8601\">ISO 8601<\/a>.<\/li>\n<\/ul>\n<h3>The right tool for the job<\/h3>\n<p>Now that we know what we want to achieve, it is time to pick a tool.<\/p>\n<h4>Pact \u274c<\/h4>\n<p><a href=\"https:\/\/docs.pact.io\/\">Pact.io<\/a> is probably the best tool for long-term and large scale contract testing. The learning curve is high and on top of that it requires infrastructure (<a href=\"https:\/\/docs.pact.io\/getting_started\/sharing_pacts\">Pact Broker<\/a>). Given we are just starting this would be overkill.<\/p>\n<h4>Postman \u274c<\/h4>\n<p>Most of our requests were already saved in <a href=\"https:\/\/www.postman.com\/\">Postman<\/a> collections. We could leverage that and simply attach some tests to those requests, right? Just because you can, doesn&#8217;t mean you should:<\/p>\n<ol>\n<li>The test code was hard to edit in their UI (e.g. no formatting, no auto-complete)<\/li>\n<li>The collection needs to be exported to a JSON in order to be executed by Newman<\/li>\n<li>When the test failed due to a schema violation it was not clear what was wrong<\/li>\n<\/ol>\n<h4>Chakram \u2705<\/h4>\n<p>We decided to write Jest tests with <a href=\"https:\/\/dareid.github.io\/chakram\/\">Chakram<\/a> because:<\/p>\n<ol>\n<li>The test code exists next to the code being tested (same repo)<\/li>\n<li>It uses our current toolchain (e.g. Jest, VS Code, Prettier, etc.)<\/li>\n<li>When a schema is violated we know exactly why (structure\/type\/value mismatch)<\/li>\n<\/ol>\n<h3>Examples<\/h3>\n<p>This is the simplest test you can write, it just checks that the API is alive.<\/p>\n<pre><code class=\"js\">import { expect, get, wait } from 'chakram';\nimport { PROVIDER_X_API_URL } from '..\/configs';\n\ndescribe('Provider X', () =&gt; {\n  it('should be online and healthy', () =&gt; {\n    const response = get(PROVIDER_X_API_URL);\n    expect(response).to.have.status(200);\n    return wait();\n  });\n});\n<\/code><\/pre>\n<p>The code below goes a step further and examplifies how to build the URL under test, how to assert the structure and the data, even if the data is dynamic.<\/p>\n<pre><code class=\"js\">import { expect, get, wait } from 'chakram';\nimport { PROVIDER_X_API_URL } from '..\/configs';\n\nconst expectedSchema = require('.\/contracts\/books.schema.json');\n\ndescribe('Provider X \/books', () =&gt; {\n  const endpointUrl = new URL('books', PROVIDER_X_API_URL);\n\n  it('should exist', () =&gt; {\n    const url = endpointUrl.href;\n    const response = get(url);\n\n    expect(response).to.have.status(200);\n    return wait();\n  });\n\n  it('should reply with valid JSON schema', () =&gt; {\n    \/\/ Example: some assertions will need a regex because actual values will be dynamic\n    const regexPrice = \/\\d{1,3}\\.\\d{1,2}\/; \/\/ up to 5 digits, separated by a dot\n\n    \/\/ Example: how to use URL search parameters \n    const searchParams = new URLSearchParams({\n      language: 'PT',\n      apikey: process.env.PROVIDER_X_API_KEY,\n    });\n    const bookIsbn = '9783161484100';\n    \/\/ Example: how to build the URL under test\n    const url = `${endpointUrl.href}\/${bookIsbn}?${searchParams}`;\n\n    const response = get(url);\n\n    \/\/ Assert structure\n    expect(response).to.have.status(200);\n    expect(response).to.have.schema(expectedSchema);\n\n    \/\/ Assert values\n    \/\/ Example: how to assert fixed values\n    expect(response).to.have.json('books[0].language', 'Portuguese');\n    \/\/ Example: use the dot notation to get a specific JSON element\n    expect(response).to.have.json('books[0].price', (value) =&gt; {\n      \/\/ Example: how to assert a dynamic values (using a regular expression)\n      expect(value).to.match(regexPrice);\n    });\n    return wait();\n  });\n});\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\ud83c\udfc6 This post was featured in Software Testing Weekly #142 and CodingJab #111 During my career, every time my team has to rely on a 3rd-party API, there comes the day where that API fails. Maybe it is down but usually they released a breaking change that breaks the previous contract. Our team does not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4571,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2],"tags":[29,55],"class_list":["post-4569","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-coding","tag-testing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Lean contract testing with Chakram - The Geeky Gecko<\/title>\n<meta name=\"description\" content=\"Every time my team has to rely on an external API, one day that API fails. In this post I&#039;ll show you how you can write lean contract tests.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Lean contract testing with Chakram - The Geeky Gecko\" \/>\n<meta property=\"og:description\" content=\"Every time my team has to rely on an external API, one day that API fails. In this post I&#039;ll show you how you can write lean contract tests.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/\" \/>\n<meta property=\"og:site_name\" content=\"The Geeky Gecko\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-17T07:00:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-28T08:59:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1282\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Diogo Nunes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dialexnunes\" \/>\n<meta name=\"twitter:site\" content=\"@dialexnunes\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Diogo Nunes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/\"},\"author\":{\"name\":\"Diogo Nunes\",\"@id\":\"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/a6fa79b293f22912664654fcfbd2da0c\"},\"headline\":\"Lean contract testing with Chakram\",\"datePublished\":\"2022-10-17T07:00:52+00:00\",\"dateModified\":\"2022-10-28T08:59:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/\"},\"wordCount\":537,\"publisher\":{\"@id\":\"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/a6fa79b293f22912664654fcfbd2da0c\"},\"image\":{\"@id\":\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?fit=1920%2C1282&ssl=1\",\"keywords\":[\"coding\",\"testing\"],\"articleSection\":[\"Technology\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/\",\"url\":\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/\",\"name\":\"Lean contract testing with Chakram - The Geeky Gecko\",\"isPartOf\":{\"@id\":\"https:\/\/www.diogonunes.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?fit=1920%2C1282&ssl=1\",\"datePublished\":\"2022-10-17T07:00:52+00:00\",\"dateModified\":\"2022-10-28T08:59:46+00:00\",\"description\":\"Every time my team has to rely on an external API, one day that API fails. In this post I'll show you how you can write lean contract tests.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?fit=1920%2C1282&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?fit=1920%2C1282&ssl=1\",\"width\":1920,\"height\":1282,\"caption\":\"Photo by Cytonn Photography on Unsplash\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.diogonunes.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lean contract testing with Chakram\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.diogonunes.com\/blog\/#website\",\"url\":\"https:\/\/www.diogonunes.com\/blog\/\",\"name\":\"The Geeky Gecko\",\"description\":\"The Geeky Gecko\",\"publisher\":{\"@id\":\"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/a6fa79b293f22912664654fcfbd2da0c\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.diogonunes.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/a6fa79b293f22912664654fcfbd2da0c\",\"name\":\"Diogo Nunes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2026\/04\/Geeky-Gecko-2026-v2.png?fit=799%2C799&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2026\/04\/Geeky-Gecko-2026-v2.png?fit=799%2C799&ssl=1\",\"width\":799,\"height\":799,\"caption\":\"Diogo Nunes\"},\"logo\":{\"@id\":\"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/www.diogonunes.com\",\"https:\/\/x.com\/dialexnunes\"],\"url\":\"https:\/\/www.diogonunes.com\/blog\/author\/diogo-nunes\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Lean contract testing with Chakram - The Geeky Gecko","description":"Every time my team has to rely on an external API, one day that API fails. In this post I'll show you how you can write lean contract tests.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/","og_locale":"en_US","og_type":"article","og_title":"Lean contract testing with Chakram - The Geeky Gecko","og_description":"Every time my team has to rely on an external API, one day that API fails. In this post I'll show you how you can write lean contract tests.","og_url":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/","og_site_name":"The Geeky Gecko","article_published_time":"2022-10-17T07:00:52+00:00","article_modified_time":"2022-10-28T08:59:46+00:00","og_image":[{"width":1920,"height":1282,"url":"https:\/\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg","type":"image\/jpeg"}],"author":"Diogo Nunes","twitter_card":"summary_large_image","twitter_creator":"@dialexnunes","twitter_site":"@dialexnunes","twitter_misc":{"Written by":"Diogo Nunes","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#article","isPartOf":{"@id":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/"},"author":{"name":"Diogo Nunes","@id":"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/a6fa79b293f22912664654fcfbd2da0c"},"headline":"Lean contract testing with Chakram","datePublished":"2022-10-17T07:00:52+00:00","dateModified":"2022-10-28T08:59:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/"},"wordCount":537,"publisher":{"@id":"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/a6fa79b293f22912664654fcfbd2da0c"},"image":{"@id":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?fit=1920%2C1282&ssl=1","keywords":["coding","testing"],"articleSection":["Technology"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/","url":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/","name":"Lean contract testing with Chakram - The Geeky Gecko","isPartOf":{"@id":"https:\/\/www.diogonunes.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#primaryimage"},"image":{"@id":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?fit=1920%2C1282&ssl=1","datePublished":"2022-10-17T07:00:52+00:00","dateModified":"2022-10-28T08:59:46+00:00","description":"Every time my team has to rely on an external API, one day that API fails. In this post I'll show you how you can write lean contract tests.","breadcrumb":{"@id":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#primaryimage","url":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?fit=1920%2C1282&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?fit=1920%2C1282&ssl=1","width":1920,"height":1282,"caption":"Photo by Cytonn Photography on Unsplash"},{"@type":"BreadcrumbList","@id":"https:\/\/www.diogonunes.com\/blog\/lean-contract-testing-with-chakram\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.diogonunes.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Lean contract testing with Chakram"}]},{"@type":"WebSite","@id":"https:\/\/www.diogonunes.com\/blog\/#website","url":"https:\/\/www.diogonunes.com\/blog\/","name":"The Geeky Gecko","description":"The Geeky Gecko","publisher":{"@id":"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/a6fa79b293f22912664654fcfbd2da0c"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.diogonunes.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/a6fa79b293f22912664654fcfbd2da0c","name":"Diogo Nunes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2026\/04\/Geeky-Gecko-2026-v2.png?fit=799%2C799&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2026\/04\/Geeky-Gecko-2026-v2.png?fit=799%2C799&ssl=1","width":799,"height":799,"caption":"Diogo Nunes"},"logo":{"@id":"https:\/\/www.diogonunes.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/www.diogonunes.com","https:\/\/x.com\/dialexnunes"],"url":"https:\/\/www.diogonunes.com\/blog\/author\/diogo-nunes\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2022\/10\/cytonn-photography-n95VMLxqM2I-unsplash-1.jpg?fit=1920%2C1282&ssl=1","jetpack-related-posts":[{"id":4756,"url":"https:\/\/www.diogonunes.com\/blog\/types-2-test-categories-approaches-types\/","url_meta":{"origin":4569,"position":0},"title":"Test categories and approaches (Types #2)","author":"Diogo Nunes","date":"16 October, 2023","format":false,"excerpt":"\ud83c\udfc6 This post was featured in Software Testing Weekly #191 This is a very long post. You don't have to read it all in one go. Use it as a reference, anytime you want to check the purpose of a particular test type. Categories Functional testing Non-functional testing Black box\u2026","rel":"","context":"In &quot;Work&quot;","block_context":{"text":"Work","link":"https:\/\/www.diogonunes.com\/blog\/category\/work\/"},"img":{"alt_text":"lego pieces","src":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2023\/08\/xavi-cabrera-kn-UmDZQDjM-unsplash.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2023\/08\/xavi-cabrera-kn-UmDZQDjM-unsplash.jpg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2023\/08\/xavi-cabrera-kn-UmDZQDjM-unsplash.jpg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2023\/08\/xavi-cabrera-kn-UmDZQDjM-unsplash.jpg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2023\/08\/xavi-cabrera-kn-UmDZQDjM-unsplash.jpg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4059,"url":"https:\/\/www.diogonunes.com\/blog\/framework-review-robot\/","url_meta":{"origin":4569,"position":1},"title":"Framework review: Robot","author":"Diogo Nunes","date":"12 April, 2021","format":false,"excerpt":"Robot Framework is a test automation framework for acceptance testing (\u2026) it utilises the keyword-driven testing approach. Its testing capabilities can be extended by Python test libraries. \u2014 Official website Code Example of automation at GitHub. Use cases \ud83e\udd48 Automate end-to-end tests using the UI. You can also use it\u2026","rel":"","context":"In &quot;Technology&quot;","block_context":{"text":"Technology","link":"https:\/\/www.diogonunes.com\/blog\/category\/tech\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2020\/12\/phillip-glickman-2umO15jsZKM-unsplash.jpg?fit=1200%2C799&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2020\/12\/phillip-glickman-2umO15jsZKM-unsplash.jpg?fit=1200%2C799&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2020\/12\/phillip-glickman-2umO15jsZKM-unsplash.jpg?fit=1200%2C799&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2020\/12\/phillip-glickman-2umO15jsZKM-unsplash.jpg?fit=1200%2C799&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2020\/12\/phillip-glickman-2umO15jsZKM-unsplash.jpg?fit=1200%2C799&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2650,"url":"https:\/\/www.diogonunes.com\/blog\/browserstack-cross-browser-testing-review\/","url_meta":{"origin":4569,"position":2},"title":"Cross-browser testing with BrowserStack: a review","author":"Diogo Nunes","date":"15 August, 2016","format":false,"excerpt":"These are BrowserStack's main services or tools: Automate: Where you run your automated Selenium tests and check the results. Screenshots: Paste an URL, select the browsers and version you want, and in a few minutes you get a batch of screenshots. Live: by connecting to their data center you are\u2026","rel":"","context":"In &quot;Technology&quot;","block_context":{"text":"Technology","link":"https:\/\/www.diogonunes.com\/blog\/category\/tech\/"},"img":{"alt_text":"browserstack-logo","src":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2016\/07\/browserstack-logo.png?fit=1024%2C337&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2016\/07\/browserstack-logo.png?fit=1024%2C337&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2016\/07\/browserstack-logo.png?fit=1024%2C337&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2016\/07\/browserstack-logo.png?fit=1024%2C337&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":4709,"url":"https:\/\/www.diogonunes.com\/blog\/types-1-the-test-pyramid\/","url_meta":{"origin":4569,"position":3},"title":"The test pyramid model (Types #1)","author":"Diogo Nunes","date":"12 June, 2023","format":false,"excerpt":"\ud83c\udfc6 This post was featured in Software Testing Weekly #173 tl;dr A visual metaphor that groups tests into layers and recommends how many tests should exist in each of layers. This is part of my free testing course, focused on teaching you the fundamentals of testing \ud83d\ude09 Theory The concept\u2026","rel":"","context":"In &quot;Work&quot;","block_context":{"text":"Work","link":"https:\/\/www.diogonunes.com\/blog\/category\/work\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2023\/05\/eugene-tkachenko-TF47p5PHW18-unsplash-1.jpg?fit=1200%2C738&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2023\/05\/eugene-tkachenko-TF47p5PHW18-unsplash-1.jpg?fit=1200%2C738&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2023\/05\/eugene-tkachenko-TF47p5PHW18-unsplash-1.jpg?fit=1200%2C738&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2023\/05\/eugene-tkachenko-TF47p5PHW18-unsplash-1.jpg?fit=1200%2C738&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2023\/05\/eugene-tkachenko-TF47p5PHW18-unsplash-1.jpg?fit=1200%2C738&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3955,"url":"https:\/\/www.diogonunes.com\/blog\/framework-review-karate\/","url_meta":{"origin":4569,"position":4},"title":"Framework review: Karate","author":"Diogo Nunes","date":"2 November, 2020","format":false,"excerpt":"Karate is the only open-source tool to combine API test-automation, mocks, performance-testing and even UI automation into a single, unified framework. You don't have to compile (Java) code. Just write tests in a readable syntax. \u2014 Official website Code Example of automation at GitHub. Use cases \ud83e\udd47 Automate API tests.\u2026","rel":"","context":"In &quot;Technology&quot;","block_context":{"text":"Technology","link":"https:\/\/www.diogonunes.com\/blog\/category\/tech\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2020\/08\/thao-le-hoang-igLzPKOvZNw-unsplash-scaled.jpg?fit=1200%2C798&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2020\/08\/thao-le-hoang-igLzPKOvZNw-unsplash-scaled.jpg?fit=1200%2C798&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2020\/08\/thao-le-hoang-igLzPKOvZNw-unsplash-scaled.jpg?fit=1200%2C798&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2020\/08\/thao-le-hoang-igLzPKOvZNw-unsplash-scaled.jpg?fit=1200%2C798&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2020\/08\/thao-le-hoang-igLzPKOvZNw-unsplash-scaled.jpg?fit=1200%2C798&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4204,"url":"https:\/\/www.diogonunes.com\/blog\/framework-review-playwright\/","url_meta":{"origin":4569,"position":5},"title":"Framework review: Playwright","author":"Diogo Nunes","date":"29 March, 2021","format":false,"excerpt":"Playwright enables end-to-end testing. Test modern single page apps, across all modern browsers, using in your preferred language (JS, TS, Java, C#, Python). \u2014 Official website Code Example of automation at GitHub. Use cases \ud83e\udd48 Automate end-to-end (E2E) tests using the UI. It also supports mocks. Learning curve \ud83e\udd48 Most\u2026","rel":"","context":"In &quot;Technology&quot;","block_context":{"text":"Technology","link":"https:\/\/www.diogonunes.com\/blog\/category\/tech\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2021\/03\/fatih-kilic-m1dM7ZXvdMs-unsplash.jpg?fit=1200%2C773&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2021\/03\/fatih-kilic-m1dM7ZXvdMs-unsplash.jpg?fit=1200%2C773&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2021\/03\/fatih-kilic-m1dM7ZXvdMs-unsplash.jpg?fit=1200%2C773&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2021\/03\/fatih-kilic-m1dM7ZXvdMs-unsplash.jpg?fit=1200%2C773&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.diogonunes.com\/blog\/wp-content\/uploads\/2021\/03\/fatih-kilic-m1dM7ZXvdMs-unsplash.jpg?fit=1200%2C773&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.diogonunes.com\/blog\/wp-json\/wp\/v2\/posts\/4569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.diogonunes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.diogonunes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.diogonunes.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.diogonunes.com\/blog\/wp-json\/wp\/v2\/comments?post=4569"}],"version-history":[{"count":3,"href":"https:\/\/www.diogonunes.com\/blog\/wp-json\/wp\/v2\/posts\/4569\/revisions"}],"predecessor-version":[{"id":4582,"href":"https:\/\/www.diogonunes.com\/blog\/wp-json\/wp\/v2\/posts\/4569\/revisions\/4582"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.diogonunes.com\/blog\/wp-json\/wp\/v2\/media\/4571"}],"wp:attachment":[{"href":"https:\/\/www.diogonunes.com\/blog\/wp-json\/wp\/v2\/media?parent=4569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.diogonunes.com\/blog\/wp-json\/wp\/v2\/categories?post=4569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.diogonunes.com\/blog\/wp-json\/wp\/v2\/tags?post=4569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}