Ref | Source Code | Description |
---|---|---|
C | Consumer.java |
The 'consumer' or client application that consumes the demo 'Payment Service' and also listens to a queue |
P | PaymentService.java |
The provider 'Payment Service' implemented in Spring Boot and using an in-memory data-store |
1 | ConsumerIntegrationTest.java |
An end-to-end integration test of the consumer that needs the real provider to be up and running |
KC | payment-service.feature |
A 'normal' Karate functional-test that tests the 'contract' of the Payment Service fro |
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
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>' |
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
Feature: karate 'hello world' example | |
Scenario: create and retrieve a cat | |
Given url 'http://myhost.com/v1/cats' | |
And request { name: 'Billie' } | |
When method post | |
Then status 201 | |
And match response == { id: '#notnull', name: 'Billie' } | |
Given path response.id |
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
Given def cat = | |
""" | |
{ | |
name: 'Billie', | |
kittens: [ | |
{ id: 23, name: 'Bob' }, | |
{ id: 42, name: 'Wild' } | |
] | |
} | |
""" |
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
Scenario: set via table where variable does not exist | |
note how karate will create parent paths if needed | |
* set foo | |
| path | value | | |
| bar | 'baz' | | |
| a.b | 'c' | | |
| fizz | { d: 'e' } | | |
* match foo == { bar: 'baz', a: { b: 'c' }, fizz: { d: 'e' } } |
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
[INFO] \- com.intuit.karate:karate-core:jar:1.1.0.RC4:test | |
[INFO] +- org.graalvm.js:js-scriptengine:jar:21.1.0:test | |
[INFO] | \- org.graalvm.sdk:graal-sdk:jar:21.1.0:test | |
[INFO] +- org.graalvm.js:js:jar:21.1.0:test | |
[INFO] | +- org.graalvm.regex:regex:jar:21.1.0:test | |
[INFO] | +- org.graalvm.truffle:truffle-api:jar:21.1.0:test | |
[INFO] | \- com.ibm.icu:icu4j:jar:68.2:test | |
[INFO] +- ch.qos.logback:logback-classic:jar:1.2.3:test | |
[INFO] | +- ch.qos.logback:logback-core:jar:1.2.3:test | |
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.25:test |
refer to this for a working example: schema-like.feature
* def actual = [{ a: 1, b: 'x' }, { a: 2, b: 'y' }]
* def schema = { a: '#number', b: '#string' }
* def partSchema = { a: '#number' }
* def badSchema = { c: '#boolean' }
* def mixSchema = { a: '#number', c: '#boolean' }
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
Feature: person mock server | |
Background: | |
* def persons = | |
""" | |
{ | |
'1': { id: 1, firstName: 'FN1', lastName: 'LN1', email: '[email protected]' }, | |
'2': { id: 2, firstName: 'FN2', lastName: 'LN2', email: '[email protected]' }, | |
'3': { id: 3, firstName: 'FN3', lastName: 'LN3', email: '[email protected]' }, | |
'4': { id: 4, firstName: 'FN4', lastName: 'LN4', email: '[email protected]' } |
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
Feature: customer manager | |
Background: | |
* driver 'http://localhost:3000' | |
Scenario: | |
* match driver.title == 'Angular TypeScript JumpStart App' | |
* click('{}Login') | |
* rightOf('{}Email:').input('[email protected]') | |
* rightOf('{}Password:').input('password1234') |
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
Feature: | |
Scenario: listen to system out and stop after 5 pings | |
* def count = 0 | |
* def listener = | |
""" | |
function(line) { | |
var temp = karate.get('count'); | |
if (line.contains('bytes from')) { | |
temp = temp + 1; |
OlderNewer