TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Karate

Data Driven Testing using Karate Automation Tool

Overview

In this tutorial, we will learn Data Driven Testing using Karate Automation Tool.  We use Examples table to data drive a Scenario in this example.

Data Driven Testing

Sometimes, we want to run the same Scenario multiple times with different sets of data. This is the benefit of Automation testing when compared to manual testing. It would be boring and tedious for a manual tester to repeat the same scenario multiple times.

Scenario Outline

Scenario Outline is the list of steps for data-driven testing using as an Examples and variables with <placeholder>.

Scenario Outline feature in same as in Cucumber for data-driven tests to run a Scenario with multiple sets of data. Scenario repeats itself multiple times replacing the values of the variable with Examples tables data. The Scenario would run multiple times. For example, if the examples table has three rows of data, the Scenario would run three times.

Examples

Examples is the container table for the place holders in the Scenario.

Notice the path in the example has an <id> placeholder variable. For each run the id would be replaced with the data in the Examples table. Also, notice that we have added Background at the same indentation of Scenario Outline. Background allows us to give context to the scenarios that repeat. The Background can contain one or more steps.

Sample Feature File

The Examples table in this tutorial has one column. We would replace the Mantis Issue id with several ids and check the GET issue call.

## Karate API Tool Demo
#Sample Feature - www.TestingDocs.com

@Mantis
Feature: Get Multiple Issues with Table
 I want to test Rest API
 
 Background:
 * url 'http://localhost'


 Scenario Outline: GET multiple Issues
 Given path '/mantis/api/rest/issues/<id>'
 And header Authorization = 'DoZSsCCiTFEx8jIm67F4mM7RWh_NLEVd'
 When method GET
 Then status 200
 
 Examples:
 | id | 
 | 1 | 
 | 2 |
 | 3 |
 | 4 |

Sample Output

Run report of the Feature.

Data Driven Testing Karate

—

Karate Automation Tutorials

Karate tool tutorials on this website can be found at:

https://www.testingdocs.com/karate-automation-tool-tutorials/

More information on the tool:

https://github.com/intuit/karate

Related Posts

Multiple Threads Karate Automation

Karate /

Parallel Test Execution using Karate DSL

Get API Request

Karate /

Test GET API Request with Karate DSL

New Feature File Karate

Karate /

Create Karate API Test Script( Feature File )

Karate /

CRUD Operations API Test Automation with Karate

Karate Automation Project

Karate /

Getting Started with Karate DSL

‹ Getting Started with Karate DSL› CRUD Operations API Test Automation with Karate

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version