forked from OrkoHunter/keep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introducing the table keyword that converts a cucumber data-table int…
…o json, which makes the call feature in loop based data-driven testing even more elegant - which fixes OrkoHunter#11
- Loading branch information
Showing
7 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
karate-demo/src/test/java/demo/calltable/CallTableRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package demo.calltable; | ||
|
||
import cucumber.api.CucumberOptions; | ||
import demo.TestBase; | ||
|
||
/** | ||
* | ||
* @author pthomas3 | ||
*/ | ||
@CucumberOptions(features = "classpath:demo/calltable/main.feature") | ||
public class CallTableRunner extends TestBase { | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
karate-demo/src/test/java/demo/calltable/kitten-create.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@ignore | ||
Feature: re-usable feature to create a single cat | ||
|
||
Scenario: | ||
|
||
Given url demoBaseUrl | ||
And path 'cats' | ||
And request { name: '#(name)' } | ||
When method post | ||
Then status 200 | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Feature: calling another feature file in a loop | ||
|
||
Background: | ||
* url demoBaseUrl | ||
|
||
* def creator = read('kitten-create.feature') | ||
|
||
* table kittens = | ||
| name | age | | ||
| Bob | 2 | | ||
| Wild | 1 | | ||
| Nyan | 3 | | ||
| Keyboard | 5 | | ||
| LOL | 3 | | ||
| Ceiling | 2 | | ||
|
||
* def result = call creator kittens | ||
|
||
* def created = get result[*].response | ||
|
||
Scenario: create parent cat using kittens | ||
|
||
# create mom cat | ||
Given path 'cats' | ||
And request { name: 'Billie', kittens: '#(created)' } | ||
When method post | ||
Then status 200 | ||
And def billie = response | ||
|
||
# get kittens for billie | ||
Given path 'cats', billie.id, 'kittens' | ||
When method get | ||
Then status 200 | ||
And match each response == { id: '#number', name: '#string' } | ||
And match response[*].name contains ['LOL', 'Nyan'] | ||
And assert response.length == 6 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters