[Introduction to contract testing - Part 2] Contract testing and how Pact works

preview_player
Показать описание
Welcome to part two of our four-part introduction to contract testing series.

WE COVER
1. What is contract testing
2. The difference between contract testing and specifications
3. How Pact works

JUMP TO
00:00 - API Contracts: specification first design (Open API Specification) vs contract tests
00:44 - Consumer driven contract testing
01:12 - What is contract testing: an alternative approach to end-to-end integrated testing
02:28 - Benefits of contract testing
03:30 - What is Pact?
04:50 - How does Pact work (REST/HTTP)
08:05 - How does Pact work (Messages e.g. Kafka, AWS Kinesis etc.)

GIVE PACTFLOW A TRY

ABOUT
Рекомендации по теме
Комментарии
Автор

How do you handle state with this approach?
Like, getting the orders depends on the state of the database, i.e. on the database updates that were done previously.

Without state, this looks like it's good for type checking only, and I prefer static checks for that.

PeterZeller
Автор

You mentioned you don't need a dedicated test environment, how would you cater for a hybrid scenario where you want to test an API in a monolith application that also calls a microservice from the provider pov?

aofadero
Автор

so, on 6:22 are those Mocks responses mainly stubbed http responses?

ricp
Автор

does the example mentioned mean that it will test against the provider with order id = 10 ? what it the provider (its SOR actually) doesnt contain and order with this ID? or what if it returns data with values other than the values stored in the repository contract ? is there an option to set these values dynamically so that the values while mock testing the consumer is different than these while testing the real provider ?

صحصحمعالعيال
Автор

Where do we read the contract from? can we read it off proto files?

برنامهنویسارشد
Автор

and can it be used to test non functional and repeatitve tests ... like testing the consumer quota ... CORS options, etc ...

صحصحمعالعيال
Автор

1. We still need to deploy the actual Provider to run provider tests. right ? so why we say it is equivalent to unit?
2. What we do to the Provider dependencies ?

rahulgiri
Автор

and is there any way to expedite writing the contract (i.e. test cases) ... because I believe it is a bit verbose

صحصحمعالعيال
Автор

Hi I am having issues with understanding what to define in the providerstates when creating a interaction via consumer. So it is all good when the domain model in frontend almost has a 1-1 mapping with the backend but it is difficult to understand once the frontend requets a data object that is not pure in the backend but rather build but different sub resources that the frontend (should not and do not want to care about). How should you define providerstates in that case?

miasanmia
Автор

Sometimes these terms on testing gets confusing. So what is a unit test to you? I consider unit tests "testing the smallest piece of logic within a class or module ". Whereas a component test is "testing the smallest deployable code possible. A component test should run in its own jvm or container".

Also does pact test actual live endpoints of an api or just mocked?

rosey
Автор

I'm a bit confused with the example given from the provider side.

Is the Pact verifier checking against the provider or a mocked response from the provider? If so, surely your argument about the other dependant services falls a bit short as the provider is still potentially running against those other services? I can see the value in the consumer side though

MarkWilson-gcyq
Автор

What tool is used to draw these diagrams?? Really good

kals
Автор

How Pact knows what is the correct provider response to consumer request?

Robert-htkd
Автор

I couldn't finish that video, but the first part it's just nonsense. You are saying to drop integration and e2e tests and do just unit tests (you call it contract, but basically it's just unit tests because use mocking everything). Unit tests go along side integration and e2e, and would never replace it. It's just like you created a new quality control tool to verify car parts quality and you're saying: "Our tool is so good, you don't need assemble car's anymore and test it. We can just sell it, because all parts are tested perfectly already".

AbbeyLingord
Автор

Well its just a contract testing we can place it in the testing pyramid between unit tests and integration tests and move one - geez

Zaicas