Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.

QAware GmbH
QAware GmbHQAware GmbH
qaware.de
Endlich gute API Tests
Boldly Testing APIs Where No One Has
Tested Before
Ildikó Tárkányi
ildiko.tarkanyi@qaware.de
Ildikó Tárkányi
Senior Software Engineer @ QAware GmbH 2
QAware
Sonja Wegner
Lead Software Architect @ QAware GmbH 3
QAware
API Tests
5
QAware
6
QAware
7
QAware
8
QAware
9
QAware
10
QAware
11
QAware
12
QAware
Spezifikation/Schema Testing
14
QAware
openValidation
16
QAware
17
QAware
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
responses:
'200':
description: Speaker added successfully
18
QAware
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
x-ov-rules:
culture: en
rule: |
IF Name IS NOT Ildikó Tárkányi
AND Email DOES NOT CONTAIN @qaware.de
THEN Please register with your full name and business e-mail address
responses:
'200':
description: Speaker added successfully
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
x-ov-rules:
culture: en
rule: |
IF Name IS NOT Ildikó Tárkányi
AND Email DOES NOT CONTAIN @qaware.de
THEN Please register with your full name and business e-mail address
responses:
'200':
description: Speaker added successfully
19
QAware
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
responses:
'200':
description: Speaker added successfully
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
IF Name IS NOT Ildikó Tárkányi
AND Email DOES NOT CONTAIN @qaware.de
THEN Please register with your full name and business e-mail address
responses:
'200':
description: Speaker added successfully
20
QAware
Schlüsselwörter
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
x-ov-rules:
culture: en
rule: |
responses:
'200':
description: Speaker added successfully
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
IF Name IS NOT Ildikó Tárkányi
AND Email DOES NOT CONTAIN @qaware.de
THEN Please register with your full name and business e-mail address
responses:
'200':
description: Speaker added successfully
21
QAware
Schlüsselwörter
Schema-Attribute
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
x-ov-rules:
culture: en
rule: |
responses:
'200':
description: Speaker added successfully
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
IF Name IS NOT Ildikó Tárkányi
AND Email DOES NOT CONTAIN @qaware.de
THEN Please register with your full name and business e-mail address
responses:
'200':
description: Speaker added successfully
22
QAware
Schlüsselwörter
Schema-Attribute
Operanden
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
x-ov-rules:
culture: en
rule: |
responses:
'200':
description: Speaker added successfully
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
IF Name IS NOT Ildikó Tárkányi
AND Email DOES NOT CONTAIN @qaware.de
THEN Please register with your full name and business e-mail address
responses:
'200':
description: Speaker added successfully
23
QAware
Schlüsselwörter
Schema-Attribute
Operanden
domänenspezifische Operatoren
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
x-ov-rules:
culture: en
rule: |
responses:
'200':
description: Speaker added successfully
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
IF Name IS NOT Ildikó Tárkányi
AND Email DOES NOT CONTAIN @qaware.de
THEN Please register with your full name and business e-mail address
responses:
'200':
description: Speaker added successfully
24
QAware
Fehlermeldung
Schlüsselwörter
Schema-Attribute
Operanden
domänenspezifische Operatoren
openapi: 3.0.3
info:
version: 1.0.0
title: Conference Management Service
paths:
/speakers:
post:
requestBody:
content:
application/json:
schema:
properties:
Name:
type: string
Email:
type: number
x-ov-rules:
culture: en
rule: |
responses:
'200':
description: Speaker added successfully
Stoplight - Spectral
26
QAware
27
QAware
extends: ["spectral:oas", "spectral:asyncapi"]
formats: ["oas3"]
documentationUrl: https://www.example.com/docs/api-style-guide.md
parserOptions:
duplicateKeys: warn # error is the default value
aliases:
Paths:
- "$.paths[*]~"
rules:
paths-kebab-case:
description: Paths should be kebab-case.
message: "{{property}} should be kebab-case (lower-case and separated with hyphens)"
severity: warn
formats: ["oas3"]
given: "#Paths"
then:
function: pattern
functionOptions:
match: "^(/|[a-z0-9-.]+|{[a-zA-Z0-9_]+})+$"
28
QAware
extends: ["spectral:oas", "spectral:asyncapi"]
formats: ["oas3"]
documentationUrl: https://www.example.com/docs/api-style-guide.md
parserOptions:
duplicateKeys: warn # error is the default value
aliases:
Paths:
- "$.paths[*]~"
rules:
paths-kebab-case:
description: Paths should be kebab-case.
message: "{{property}} should be kebab-case (lower-case and separated with hyphens)"
severity: warn
formats: ["oas3"]
given: "#Paths"
then:
function: pattern
functionOptions:
match: "^(/|[a-z0-9-.]+|{[a-zA-Z0-9_]+})+$"
29
QAware
extends: ["spectral:oas", "spectral:asyncapi"]
formats: ["oas3"]
documentationUrl: https://www.example.com/docs/api-style-guide.md
parserOptions:
duplicateKeys: warn # error is the default value
aliases:
Paths:
- "$.paths[*]~"
rules:
paths-kebab-case:
description: Paths should be kebab-case.
message: "{{property}} should be kebab-case (lower-case and separated with hyphens)"
severity: warn
formats: ["oas3"]
given: "#Paths"
then:
function: pattern
functionOptions:
match: "^(/|[a-z0-9-.]+|{[a-zA-Z0-9_]+})+$"
30
QAware
B:.
├───stoplight
│
└───spectral
.spectral.yaml
myOpenAPI.yaml
B:stoplightspectral> spectral lint myOpenAPI.yaml
8:10 warning operation-description Operation "description" must be present and non-empty string.
paths./speakers.post
8:10 warning operation-operationId Operation must have "operationId".
paths./speakers.post
8:10 warning operation-tags Operation must have non-empty "tags" array.
paths./speakers.post
✖ 3 problems (0 errors, 3 warnings, 0 infos, 0 hints)
31
QAware
Contract Testing
33
QAware
34
QAware
pact
36
QAware
{
"metadata": {...},
"provider": {
"name": "speaker-provider"
},
"consumer": {
"name": "speaker-consumer"
},
"interactions": [
{
"description": "A GET request for a speaker",
"request": {
"method": "GET",
"path": "/speakers/some-name"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": {
"name": "some-name",
"email": "some-email"
}
}
},
{...}
]
}
37
QAware
1
2
3
4
38
QAware
@PactTestFor(providerName = "speaker-provider", hostInterface = "localhost")
public class SpeakerProviderPactTest {
@Pact(consumer = "agenda-consumer", provider = "speaker-provider")
public V4Pact createPactForSpeakerInteractions(PactDslWithProvider builder) {
PactDslJsonBody newSpeakerRequestBody = new PactDslJsonBody();
newSpeakerRequestBody.stringValue("name", "new-name")
.stringValue("email", "new-email")
.closeObject();
return builder
.uponReceiving("A POST request to add a speaker")
.path("/speakers")
.method(HttpMethod.POST)
.headers("Content-Type", "application/json")
.body(newSpeakerRequestBody)
.willRespondWith()
.status(204)
.toPact(V4Pact.class);
}
}
39
QAware
@Test
@PactTestFor
public void testSpeakerInteractions() {
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
String jsonBody = "{"name": "new-name", "email": "new-email"}";
ResponseEntity<String> postResponse = new RestTemplate().exchange(
mockProvider.getUrl() + "/speakers",
HttpMethod.POST,
new HttpEntity<>(jsonBody, httpHeaders),
String.class
);
assertThat(postResponse.getStatusCode().value()).isEqualTo(204);
}
40
QAware
41
QAware
@Provider("speaker-provider")
@PactFolder("pacts")
class SpeakerProviderPactTest {
@BeforeEach
void setup(PactVerificationContext context) {
context.setTarget(new HttpTestTarget("localhost", 8080));
}
@TestTemplate
@ExtendWith(PactVerificationInvocationContextProvider.class)
void pactVerificationTestTemplate(PactVerificationContext context) {
context.verifyInteraction();
}
}
42
QAware
43
QAware
44
QAware
@Provider("speaker-provider")
@PactBroker(url = "http://localhost:9292")
class SpeakerProviderPactTest {
@BeforeEach
void setup(PactVerificationContext context) {
context.setTarget(new HttpTestTarget("localhost", 8080));
}
@TestTemplate
@ExtendWith(PactVerificationInvocationContextProvider.class)
void pactVerificationTestTemplate(PactVerificationContext context) {
context.verifyInteraction();
}
}
45
QAware
Trace-Testing
47
QAware
Tracetest
49
QAware
50
QAware
51
QAware
52
QAware
53
QAware
54
QAware
type: Test
spec:
id: Ugtm74WIg
name: speakers - POST
description: Create new speaker
trigger:
type: http
httpRequest:
method: POST
url: http://provider-service:8080/speakers
body: "{n "name": "some-name",n "email": "some-email"n}"
headers:
- key: Content-Type
value: application/json
specs:
- selector: span[tracetest.span.type="http"]
name: "Http span: response status code is 204"
assertions:
- attr:http.status_code = 204
- selector: span[tracetest.span.type="database"]
name: "Database span: processing time is less than 100ms"
assertions:
- attr:tracetest.span.duration < 100ms
- selector: span[tracetest.span.type="general" name="Tracetest trigger"]
name: "Trigger span: response time is less than 200ms"
assertions:
- attr:tracetest.span.duration < 200ms
55
QAware
B:.
├───tracetest
speakers_post.yaml
PS B:api-testing-demotracetest> tracetest run test --file speakers_post.yaml --output pretty
✔ speakers - POST (http://localhost:11633/test/Ugtm74WIg/run/42/test) - trace id: af60f652b4097a13120f001df3da4edd
✔ Http span: response status code is 204
✔ Database span: processing time is less than 100ms
✔ Trigger span: response time is less than 200ms
56
QAware
qaware.de
QAware GmbH
Aschauer Straße 32
81549 München
Tel. +49 89 232315-0
info@qaware.de
twitter.com/qaware
linkedin.com/company/qaware-gmbh
xing.com/companies/qawaregmbh
slideshare.net/qaware
github.com/qaware
Conclusion and Q&A
1 de 57

Recomendados

AWSug.nl Meetup @ New10 - SAM por
AWSug.nl Meetup @ New10 - SAMAWSug.nl Meetup @ New10 - SAM
AWSug.nl Meetup @ New10 - SAMMartijn van Dongen
110 visualizações47 slides
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard por
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardSV Ruby on Rails Meetup
556 visualizações123 slides
Rails3 changesets por
Rails3 changesetsRails3 changesets
Rails3 changesetsWen-Tien Chang
1.3K visualizações31 slides
Deep dive on Serverless application development por
Deep dive on Serverless application developmentDeep dive on Serverless application development
Deep dive on Serverless application developmentAmazon Web Services
2.2K visualizações46 slides
Building Serverless Backends with AWS Lambda and Amazon API Gateway por
Building Serverless Backends with AWS Lambda and Amazon API GatewayBuilding Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API GatewayAmazon Web Services
2.8K visualizações31 slides
Academy PRO: Querying Elasticsearch por
Academy PRO: Querying ElasticsearchAcademy PRO: Querying Elasticsearch
Academy PRO: Querying ElasticsearchBinary Studio
107 visualizações31 slides

Mais conteúdo relacionado

Similar a Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.

apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauret por
apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauretapidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauret
apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauretapidays
86 visualizações110 slides
Kasten securing access to your kubernetes applications por
Kasten securing access to your kubernetes applicationsKasten securing access to your kubernetes applications
Kasten securing access to your kubernetes applicationsLibbySchulze
159 visualizações25 slides
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs por
 Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbsAWS Chicago
378 visualizações50 slides
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS por
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADSKNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADSElad Hirsch
47 visualizações84 slides
Ams adapters por
Ams adaptersAms adapters
Ams adaptersBruno Alló Bacarini
264 visualizações62 slides
Working with PowerVC via its REST APIs por
Working with PowerVC via its REST APIsWorking with PowerVC via its REST APIs
Working with PowerVC via its REST APIsJoe Cropper
2.6K visualizações43 slides

Similar a Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.(20)

apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauret por apidays
apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauretapidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauret
apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauret
apidays86 visualizações
Kasten securing access to your kubernetes applications por LibbySchulze
Kasten securing access to your kubernetes applicationsKasten securing access to your kubernetes applications
Kasten securing access to your kubernetes applications
LibbySchulze159 visualizações
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs por AWS Chicago
 Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
AWS Chicago378 visualizações
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS por Elad Hirsch
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADSKNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
Elad Hirsch47 visualizações
Working with PowerVC via its REST APIs por Joe Cropper
Working with PowerVC via its REST APIsWorking with PowerVC via its REST APIs
Working with PowerVC via its REST APIs
Joe Cropper2.6K visualizações
Ninad cucumber rails por ninad23p
Ninad cucumber railsNinad cucumber rails
Ninad cucumber rails
ninad23p492 visualizações
How to Write IAC for Serverless por Ryan Jones
How to Write IAC for ServerlessHow to Write IAC for Serverless
How to Write IAC for Serverless
Ryan Jones119 visualizações
Presentation kyushu-2018 por masahitojp
Presentation kyushu-2018Presentation kyushu-2018
Presentation kyushu-2018
masahitojp568 visualizações
Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-... por Daniel Bryant
Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-...Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-...
Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-...
Daniel Bryant368 visualizações
Software as a Service workshop / Unlocked: the Hybrid Cloud 12th May 2014 por Rackspace Academy
Software as a Service workshop / Unlocked: the Hybrid Cloud 12th May 2014Software as a Service workshop / Unlocked: the Hybrid Cloud 12th May 2014
Software as a Service workshop / Unlocked: the Hybrid Cloud 12th May 2014
Rackspace Academy1.2K visualizações
Building an aws sdk for Perl - Granada Perl Workshop 2014 por Jose Luis Martínez
Building an aws sdk for Perl - Granada Perl Workshop 2014Building an aws sdk for Perl - Granada Perl Workshop 2014
Building an aws sdk for Perl - Granada Perl Workshop 2014
Jose Luis Martínez1.3K visualizações
Apache Kafka - Scalable Message-Processing and more ! por Guido Schmutz
Apache Kafka - Scalable Message-Processing and more !Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !
Guido Schmutz873 visualizações
AWS Lambda with Serverless Framework and Java por Manish Pandit
AWS Lambda with Serverless Framework and JavaAWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and Java
Manish Pandit2.4K visualizações
Document Conversion & Retrieve and Rank 一問一答 por Hisashi Komine
Document Conversion & Retrieve and Rank 一問一答Document Conversion & Retrieve and Rank 一問一答
Document Conversion & Retrieve and Rank 一問一答
Hisashi Komine1.1K visualizações
AWS Serverless concepts and solutions por ElenaIvannikova3
AWS Serverless concepts and solutionsAWS Serverless concepts and solutions
AWS Serverless concepts and solutions
ElenaIvannikova367 visualizações
Mасштабирование микросервисов на Go, Matt Heath (Hailo) por Ontico
Mасштабирование микросервисов на Go, Matt Heath (Hailo)Mасштабирование микросервисов на Go, Matt Heath (Hailo)
Mасштабирование микросервисов на Go, Matt Heath (Hailo)
Ontico2.6K visualizações
Pyrax talk por Kamesh Pemmaraju
Pyrax talkPyrax talk
Pyrax talk
Kamesh Pemmaraju827 visualizações
CloudFormation experience por Vitebsk Miniq
CloudFormation experienceCloudFormation experience
CloudFormation experience
Vitebsk Miniq189 visualizações
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview por María Angélica Bracho
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewOpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
María Angélica Bracho1.1K visualizações

Mais de QAware GmbH

Der Tod der Testpyramide? – Frontend-Testing mit Playwright por
Der Tod der Testpyramide? – Frontend-Testing mit PlaywrightDer Tod der Testpyramide? – Frontend-Testing mit Playwright
Der Tod der Testpyramide? – Frontend-Testing mit PlaywrightQAware GmbH
7 visualizações34 slides
Was kommt nach den SPAs por
Was kommt nach den SPAsWas kommt nach den SPAs
Was kommt nach den SPAsQAware GmbH
6 visualizações47 slides
Cloud Migration mit KI: der Turbo por
Cloud Migration mit KI: der Turbo Cloud Migration mit KI: der Turbo
Cloud Migration mit KI: der Turbo QAware GmbH
18 visualizações23 slides
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See... por
 Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See... Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...QAware GmbH
16 visualizações13 slides
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster por
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster QAware GmbH
16 visualizações31 slides
Kubernetes with Cilium in AWS - Experience Report! por
Kubernetes with Cilium in AWS - Experience Report!Kubernetes with Cilium in AWS - Experience Report!
Kubernetes with Cilium in AWS - Experience Report!QAware GmbH
45 visualizações17 slides

Mais de QAware GmbH(20)

Der Tod der Testpyramide? – Frontend-Testing mit Playwright por QAware GmbH
Der Tod der Testpyramide? – Frontend-Testing mit PlaywrightDer Tod der Testpyramide? – Frontend-Testing mit Playwright
Der Tod der Testpyramide? – Frontend-Testing mit Playwright
QAware GmbH7 visualizações
Was kommt nach den SPAs por QAware GmbH
Was kommt nach den SPAsWas kommt nach den SPAs
Was kommt nach den SPAs
QAware GmbH6 visualizações
Cloud Migration mit KI: der Turbo por QAware GmbH
Cloud Migration mit KI: der Turbo Cloud Migration mit KI: der Turbo
Cloud Migration mit KI: der Turbo
QAware GmbH18 visualizações
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See... por QAware GmbH
 Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See... Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
QAware GmbH16 visualizações
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster por QAware GmbH
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
QAware GmbH16 visualizações
Kubernetes with Cilium in AWS - Experience Report! por QAware GmbH
Kubernetes with Cilium in AWS - Experience Report!Kubernetes with Cilium in AWS - Experience Report!
Kubernetes with Cilium in AWS - Experience Report!
QAware GmbH45 visualizações
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP por QAware GmbH
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAPKontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
QAware GmbH20 visualizações
Blue turns green! Approaches and technologies for sustainable K8s clusters. por QAware GmbH
Blue turns green! Approaches and technologies for sustainable K8s clusters.Blue turns green! Approaches and technologies for sustainable K8s clusters.
Blue turns green! Approaches and technologies for sustainable K8s clusters.
QAware GmbH32 visualizações
Per Anhalter zu Cloud Nativen API Gateways por QAware GmbH
Per Anhalter zu Cloud Nativen API GatewaysPer Anhalter zu Cloud Nativen API Gateways
Per Anhalter zu Cloud Nativen API Gateways
QAware GmbH30 visualizações
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster por QAware GmbH
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
QAware GmbH22 visualizações
How to speed up Spring Integration Tests por QAware GmbH
How to speed up Spring Integration TestsHow to speed up Spring Integration Tests
How to speed up Spring Integration Tests
QAware GmbH21 visualizações
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster por QAware GmbH
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-ClusterAus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
QAware GmbH42 visualizações
Cloud Migration – Eine Strategie die funktioniert por QAware GmbH
Cloud Migration – Eine Strategie die funktioniertCloud Migration – Eine Strategie die funktioniert
Cloud Migration – Eine Strategie die funktioniert
QAware GmbH27 visualizações
Policy Driven Microservices mit Open Policy Agent por QAware GmbH
Policy Driven Microservices mit Open Policy AgentPolicy Driven Microservices mit Open Policy Agent
Policy Driven Microservices mit Open Policy Agent
QAware GmbH15 visualizações
Make Developers Fly: Principles for Platform Engineering por QAware GmbH
Make Developers Fly: Principles for Platform EngineeringMake Developers Fly: Principles for Platform Engineering
Make Developers Fly: Principles for Platform Engineering
QAware GmbH59 visualizações
Security Lab: OIDC in der Praxis por QAware GmbH
Security Lab: OIDC in der PraxisSecurity Lab: OIDC in der Praxis
Security Lab: OIDC in der Praxis
QAware GmbH19 visualizações
Die nächsten 100 Microservices por QAware GmbH
Die nächsten 100 MicroservicesDie nächsten 100 Microservices
Die nächsten 100 Microservices
QAware GmbH14 visualizações
Enterprise-level Kubernetes Security mit Open Source Tools - geht das? por QAware GmbH
Enterprise-level Kubernetes Security mit Open Source Tools - geht das?Enterprise-level Kubernetes Security mit Open Source Tools - geht das?
Enterprise-level Kubernetes Security mit Open Source Tools - geht das?
QAware GmbH33 visualizações
Put the ‘Auto’ in Autoscaling – Make Kubernetes VPA and HPA work together for... por QAware GmbH
Put the ‘Auto’ in Autoscaling – Make Kubernetes VPA and HPA work together for...Put the ‘Auto’ in Autoscaling – Make Kubernetes VPA and HPA work together for...
Put the ‘Auto’ in Autoscaling – Make Kubernetes VPA and HPA work together for...
QAware GmbH19 visualizações
HTTP/3 und QUIC Making the internet faster por QAware GmbH
HTTP/3 und QUIC Making the internet fasterHTTP/3 und QUIC Making the internet faster
HTTP/3 und QUIC Making the internet faster
QAware GmbH37 visualizações

Último

The Era of Large Language Models.pptx por
The Era of Large Language Models.pptxThe Era of Large Language Models.pptx
The Era of Large Language Models.pptxAbdulVahedShaik
5 visualizações9 slides
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... por
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...Deltares
9 visualizações24 slides
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema por
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDeltares
17 visualizações13 slides
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ... por
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...Deltares
11 visualizações32 slides
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the... por
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...Deltares
6 visualizações22 slides
Navigating container technology for enhanced security by Niklas Saari por
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas SaariMetosin Oy
14 visualizações34 slides

Último(20)

The Era of Large Language Models.pptx por AbdulVahedShaik
The Era of Large Language Models.pptxThe Era of Large Language Models.pptx
The Era of Large Language Models.pptx
AbdulVahedShaik5 visualizações
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... por Deltares
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
Deltares9 visualizações
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema por Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
Deltares17 visualizações
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ... por Deltares
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
Deltares11 visualizações
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the... por Deltares
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...
DSD-INT 2023 Leveraging the results of a 3D hydrodynamic model to improve the...
Deltares6 visualizações
Navigating container technology for enhanced security by Niklas Saari por Metosin Oy
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
Metosin Oy14 visualizações
DSD-INT 2023 Salt intrusion Modelling of the Lauwersmeer, towards a measureme... por Deltares
DSD-INT 2023 Salt intrusion Modelling of the Lauwersmeer, towards a measureme...DSD-INT 2023 Salt intrusion Modelling of the Lauwersmeer, towards a measureme...
DSD-INT 2023 Salt intrusion Modelling of the Lauwersmeer, towards a measureme...
Deltares5 visualizações
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium... por Lisi Hocke
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...
Team Transformation Tactics for Holistic Testing and Quality (Japan Symposium...
Lisi Hocke30 visualizações
Advanced API Mocking Techniques por Dimpy Adhikary
Advanced API Mocking TechniquesAdvanced API Mocking Techniques
Advanced API Mocking Techniques
Dimpy Adhikary19 visualizações
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko... por Deltares
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
Deltares14 visualizações
SAP FOR TYRE INDUSTRY.pdf por Virendra Rai, PMP
SAP FOR TYRE INDUSTRY.pdfSAP FOR TYRE INDUSTRY.pdf
SAP FOR TYRE INDUSTRY.pdf
Virendra Rai, PMP24 visualizações
Keep por Geniusee
KeepKeep
Keep
Geniusee75 visualizações
HarshithAkkapelli_Presentation.pdf por harshithakkapelli
HarshithAkkapelli_Presentation.pdfHarshithAkkapelli_Presentation.pdf
HarshithAkkapelli_Presentation.pdf
harshithakkapelli11 visualizações
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t... por Deltares
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
Deltares9 visualizações
Quality Engineer: A Day in the Life por John Valentino
Quality Engineer: A Day in the LifeQuality Engineer: A Day in the Life
Quality Engineer: A Day in the Life
John Valentino6 visualizações
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra... por Marc Müller
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra....NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
Marc Müller38 visualizações
Myths and Facts About Hospice Care: Busting Common Misconceptions por Care Coordinations
Myths and Facts About Hospice Care: Busting Common MisconceptionsMyths and Facts About Hospice Care: Busting Common Misconceptions
Myths and Facts About Hospice Care: Busting Common Misconceptions
Care Coordinations5 visualizações
Dapr Unleashed: Accelerating Microservice Development por Miroslav Janeski
Dapr Unleashed: Accelerating Microservice DevelopmentDapr Unleashed: Accelerating Microservice Development
Dapr Unleashed: Accelerating Microservice Development
Miroslav Janeski10 visualizações
Software evolution understanding: Automatic extraction of software identifier... por Ra'Fat Al-Msie'deen
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...
Ra'Fat Al-Msie'deen9 visualizações

Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.

  • 1. qaware.de Endlich gute API Tests Boldly Testing APIs Where No One Has Tested Before Ildikó Tárkányi ildiko.tarkanyi@qaware.de
  • 2. Ildikó Tárkányi Senior Software Engineer @ QAware GmbH 2 QAware
  • 3. Sonja Wegner Lead Software Architect @ QAware GmbH 3 QAware
  • 17. 17 QAware openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number responses: '200': description: Speaker added successfully
  • 18. 18 QAware openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number x-ov-rules: culture: en rule: | IF Name IS NOT Ildikó Tárkányi AND Email DOES NOT CONTAIN @qaware.de THEN Please register with your full name and business e-mail address responses: '200': description: Speaker added successfully
  • 19. openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number x-ov-rules: culture: en rule: | IF Name IS NOT Ildikó Tárkányi AND Email DOES NOT CONTAIN @qaware.de THEN Please register with your full name and business e-mail address responses: '200': description: Speaker added successfully 19 QAware openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number responses: '200': description: Speaker added successfully
  • 20. openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number IF Name IS NOT Ildikó Tárkányi AND Email DOES NOT CONTAIN @qaware.de THEN Please register with your full name and business e-mail address responses: '200': description: Speaker added successfully 20 QAware Schlüsselwörter openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number x-ov-rules: culture: en rule: | responses: '200': description: Speaker added successfully
  • 21. openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number IF Name IS NOT Ildikó Tárkányi AND Email DOES NOT CONTAIN @qaware.de THEN Please register with your full name and business e-mail address responses: '200': description: Speaker added successfully 21 QAware Schlüsselwörter Schema-Attribute openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number x-ov-rules: culture: en rule: | responses: '200': description: Speaker added successfully
  • 22. openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number IF Name IS NOT Ildikó Tárkányi AND Email DOES NOT CONTAIN @qaware.de THEN Please register with your full name and business e-mail address responses: '200': description: Speaker added successfully 22 QAware Schlüsselwörter Schema-Attribute Operanden openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number x-ov-rules: culture: en rule: | responses: '200': description: Speaker added successfully
  • 23. openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number IF Name IS NOT Ildikó Tárkányi AND Email DOES NOT CONTAIN @qaware.de THEN Please register with your full name and business e-mail address responses: '200': description: Speaker added successfully 23 QAware Schlüsselwörter Schema-Attribute Operanden domänenspezifische Operatoren openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number x-ov-rules: culture: en rule: | responses: '200': description: Speaker added successfully
  • 24. openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number IF Name IS NOT Ildikó Tárkányi AND Email DOES NOT CONTAIN @qaware.de THEN Please register with your full name and business e-mail address responses: '200': description: Speaker added successfully 24 QAware Fehlermeldung Schlüsselwörter Schema-Attribute Operanden domänenspezifische Operatoren openapi: 3.0.3 info: version: 1.0.0 title: Conference Management Service paths: /speakers: post: requestBody: content: application/json: schema: properties: Name: type: string Email: type: number x-ov-rules: culture: en rule: | responses: '200': description: Speaker added successfully
  • 27. 27 QAware extends: ["spectral:oas", "spectral:asyncapi"] formats: ["oas3"] documentationUrl: https://www.example.com/docs/api-style-guide.md parserOptions: duplicateKeys: warn # error is the default value aliases: Paths: - "$.paths[*]~" rules: paths-kebab-case: description: Paths should be kebab-case. message: "{{property}} should be kebab-case (lower-case and separated with hyphens)" severity: warn formats: ["oas3"] given: "#Paths" then: function: pattern functionOptions: match: "^(/|[a-z0-9-.]+|{[a-zA-Z0-9_]+})+$"
  • 28. 28 QAware extends: ["spectral:oas", "spectral:asyncapi"] formats: ["oas3"] documentationUrl: https://www.example.com/docs/api-style-guide.md parserOptions: duplicateKeys: warn # error is the default value aliases: Paths: - "$.paths[*]~" rules: paths-kebab-case: description: Paths should be kebab-case. message: "{{property}} should be kebab-case (lower-case and separated with hyphens)" severity: warn formats: ["oas3"] given: "#Paths" then: function: pattern functionOptions: match: "^(/|[a-z0-9-.]+|{[a-zA-Z0-9_]+})+$"
  • 29. 29 QAware extends: ["spectral:oas", "spectral:asyncapi"] formats: ["oas3"] documentationUrl: https://www.example.com/docs/api-style-guide.md parserOptions: duplicateKeys: warn # error is the default value aliases: Paths: - "$.paths[*]~" rules: paths-kebab-case: description: Paths should be kebab-case. message: "{{property}} should be kebab-case (lower-case and separated with hyphens)" severity: warn formats: ["oas3"] given: "#Paths" then: function: pattern functionOptions: match: "^(/|[a-z0-9-.]+|{[a-zA-Z0-9_]+})+$"
  • 30. 30 QAware B:. ├───stoplight │ └───spectral .spectral.yaml myOpenAPI.yaml B:stoplightspectral> spectral lint myOpenAPI.yaml 8:10 warning operation-description Operation "description" must be present and non-empty string. paths./speakers.post 8:10 warning operation-operationId Operation must have "operationId". paths./speakers.post 8:10 warning operation-tags Operation must have non-empty "tags" array. paths./speakers.post ✖ 3 problems (0 errors, 3 warnings, 0 infos, 0 hints)
  • 35. pact
  • 36. 36 QAware { "metadata": {...}, "provider": { "name": "speaker-provider" }, "consumer": { "name": "speaker-consumer" }, "interactions": [ { "description": "A GET request for a speaker", "request": { "method": "GET", "path": "/speakers/some-name" }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "body": { "name": "some-name", "email": "some-email" } } }, {...} ] }
  • 38. 38 QAware @PactTestFor(providerName = "speaker-provider", hostInterface = "localhost") public class SpeakerProviderPactTest { @Pact(consumer = "agenda-consumer", provider = "speaker-provider") public V4Pact createPactForSpeakerInteractions(PactDslWithProvider builder) { PactDslJsonBody newSpeakerRequestBody = new PactDslJsonBody(); newSpeakerRequestBody.stringValue("name", "new-name") .stringValue("email", "new-email") .closeObject(); return builder .uponReceiving("A POST request to add a speaker") .path("/speakers") .method(HttpMethod.POST) .headers("Content-Type", "application/json") .body(newSpeakerRequestBody) .willRespondWith() .status(204) .toPact(V4Pact.class); } }
  • 39. 39 QAware @Test @PactTestFor public void testSpeakerInteractions() { HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setContentType(MediaType.APPLICATION_JSON); String jsonBody = "{"name": "new-name", "email": "new-email"}"; ResponseEntity<String> postResponse = new RestTemplate().exchange( mockProvider.getUrl() + "/speakers", HttpMethod.POST, new HttpEntity<>(jsonBody, httpHeaders), String.class ); assertThat(postResponse.getStatusCode().value()).isEqualTo(204); }
  • 41. 41 QAware @Provider("speaker-provider") @PactFolder("pacts") class SpeakerProviderPactTest { @BeforeEach void setup(PactVerificationContext context) { context.setTarget(new HttpTestTarget("localhost", 8080)); } @TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void pactVerificationTestTemplate(PactVerificationContext context) { context.verifyInteraction(); } }
  • 44. 44 QAware @Provider("speaker-provider") @PactBroker(url = "http://localhost:9292") class SpeakerProviderPactTest { @BeforeEach void setup(PactVerificationContext context) { context.setTarget(new HttpTestTarget("localhost", 8080)); } @TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void pactVerificationTestTemplate(PactVerificationContext context) { context.verifyInteraction(); } }
  • 54. 54 QAware type: Test spec: id: Ugtm74WIg name: speakers - POST description: Create new speaker trigger: type: http httpRequest: method: POST url: http://provider-service:8080/speakers body: "{n "name": "some-name",n "email": "some-email"n}" headers: - key: Content-Type value: application/json specs: - selector: span[tracetest.span.type="http"] name: "Http span: response status code is 204" assertions: - attr:http.status_code = 204 - selector: span[tracetest.span.type="database"] name: "Database span: processing time is less than 100ms" assertions: - attr:tracetest.span.duration < 100ms - selector: span[tracetest.span.type="general" name="Tracetest trigger"] name: "Trigger span: response time is less than 200ms" assertions: - attr:tracetest.span.duration < 200ms
  • 55. 55 QAware B:. ├───tracetest speakers_post.yaml PS B:api-testing-demotracetest> tracetest run test --file speakers_post.yaml --output pretty ✔ speakers - POST (http://localhost:11633/test/Ugtm74WIg/run/42/test) - trace id: af60f652b4097a13120f001df3da4edd ✔ Http span: response status code is 204 ✔ Database span: processing time is less than 100ms ✔ Trigger span: response time is less than 200ms
  • 57. qaware.de QAware GmbH Aschauer Straße 32 81549 München Tel. +49 89 232315-0 info@qaware.de twitter.com/qaware linkedin.com/company/qaware-gmbh xing.com/companies/qawaregmbh slideshare.net/qaware github.com/qaware Conclusion and Q&A