Skip to content

Instantly share code, notes, and snippets.

@ptrthomas
Last active January 27, 2019 14:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptrthomas/0f5c00582b345a74d20261fb346225d0 to your computer and use it in GitHub Desktop.
Save ptrthomas/0f5c00582b345a74d20261fb346225d0 to your computer and use it in GitHub Desktop.
Karate example that replaces the combination of REST-Assured and TestNG data-provider | https://bit.ly/2G4qvBe
Feature: karate answers 2
Background:
* url 'http://localhost:8080'
Scenario Outline: given circuit name, validate country
Given path 'api/f1/circuits/<name>.json'
When method get
Then match $.MRData.CircuitTable.Circuits[0].Location.country == '<country>'
Examples:
| name | country |
| monza | Italy |
| spa | Belgium |
| sepang | Malaysia |
Scenario Outline: given race number, validate number of pitstops for Max Verstappen in 2015
Given path 'api/f1/2015/<race>/drivers/max_verstappen/pitstops.json'
When method get
Then assert response.MRData.RaceTable.Races[0].PitStops.length == <stops>
Examples:
| race | stops |
| 1 | 1 |
| 2 | 3 |
| 3 | 2 |
| 4 | 2 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment