# given-when-then

Published articles for given-when-then.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Leveraging Kotlin for Tests

DevFeed: [Leveraging Kotlin for Tests](<https://devfeed.tech/articles/leveraging-kotlin-for-tests-25968.md>)

Original publisher: [Read original article](<https://jossiwolf.medium.com/leveraging-kotlin-for-tests-311bfd8335ee?source=rss-8efc0359e234------2>)

Author: Jossi Wolf

Published: 2021-12-01T15:00:03Z

Content type: tutorial

Language: en

Sources: [Stories by Jossi Wolf on Medium](<https://devfeed.tech/sources/stories-by-jossi-wolf-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Behavior-driven development](<https://devfeed.tech/topics/bdd.md>), [Cucumber](<https://devfeed.tech/topics/cucumber.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [bdd](<https://devfeed.tech/tags/bdd.md>), [given-when-then](<https://devfeed.tech/tags/given-when-then.md>), [junit](<https://devfeed.tech/tags/junit.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

This article explains how Kotlin language features and naming patterns can improve test readability. It covers the Given/When/Then pattern, meaningful test names, and using Kotlin backtick function names to make tests clearer.

### Source excerpt

Writing tests can be an important part of developing applications. Whether unit tests, integration tests or others, Kotlin's language features and clever naming patterns can help us increase the readability of tests. The patterns suggested here aren't new or innovative; rather they are more modern adaptions of well-established practices. I learned about these adaptions from my lovely colleague Volodymyr Galandzij who did fantastic work in setting up the testing framework in a codebase we worked on together. Given/When/Then You may have heard of the Given/When/Then pattern -- also known as the Cucumber/Gherkin syntax -- if you have written tests before, or you might even recognize it from Jira tickets. Originally introduced as a part of BDD (Behavior Driven Development), similar patterns like the Four-Phase Test (you'll see some similarities to JUnit here) have existed for a good amount of time. Martin Fowler gives a good small summary of all of this in his article about the Given/When/Then pattern: The essential idea is to break down writing a scenario (or test) into three sections:The given part describes the state of the world before you begin the behavior you're specifying in this scenario. You can think of it as the pre-conditions to the test.The when section is that behavior that you're specifying.Finally the then section describes the changes you expect due to the specified behavior. Regardless of the testing philosophy you follow, there's a good chance that the Given/When/Then pattern can be applied to your tests. But how does this look in practice? I heard that adding a featured image helps increase clicks. Does it work? Who knows! If it does, thank you, Sigmund on Unsplash!Test Names I argue that test names are one of the most important parts of writing good tests. The name of the test should help you understand what the test does. One quality of a good test is that it fails when the actual outcome is different from the expected outcome. When a test fails, it

## Automation-First Approach Using the Karate API Testing Framework

DevFeed: [Automation-First Approach Using the Karate API Testing Framework](<https://devfeed.tech/articles/automation-first-approach-using-the-karate-api-testing-framework-27978.md>)

Original publisher: [Read original article](<https://tech.trivago.com/post/2019-11-14-apitestautomationusingkarate/>)

Author: Anila Saifan Software Engineer QA; Test Automation enthusiast

Published: 2019-11-14T00:00:00Z

Content type: tutorial

Language: en

Sources: [Trivago](<https://devfeed.tech/sources/trivago.md>)

Topics: [Automation](<https://devfeed.tech/topics/automation.md>), [API](<https://devfeed.tech/topics/api.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Behavior-driven development](<https://devfeed.tech/topics/bdd.md>), [Framework](<https://devfeed.tech/topics/framework.md>), [Java](<https://devfeed.tech/topics/java.md>), [Maven](<https://devfeed.tech/topics/maven.md>), [Cucumber](<https://devfeed.tech/topics/cucumber.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [api-testing](<https://devfeed.tech/tags/api-testing.md>), [automation](<https://devfeed.tech/tags/automation.md>), [backend](<https://devfeed.tech/tags/backend.md>), [bdd](<https://devfeed.tech/tags/bdd.md>), [cli](<https://devfeed.tech/tags/cli.md>), [given-when-then](<https://devfeed.tech/tags/given-when-then.md>), [ide](<https://devfeed.tech/tags/ide.md>), [java](<https://devfeed.tech/tags/java.md>), [maven](<https://devfeed.tech/tags/maven.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [specflow](<https://devfeed.tech/tags/specflow.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

This tutorial explains how to use Karate, an open-source API test automation tool, with behavior-driven development syntax. It covers project setup with Java and Maven, writing API tests, running them, and using custom functions.

### Source excerpt

Adopting an automation-first mindset is the first step to reduce manual and repetitive work. Thinking this way enables us to move faster, and more efficiently. It unburdens us from mundane, repe...