this post was submitted on 18 Jun 2023
7 points (100.0% liked)

Programming

13362 readers
2 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 1 year ago
MODERATORS
 

At my company there has been a move away from our large e2e testing suite for various reasons:

  • flaky tests
  • long build times
  • significant burden for multiple teams to contribute

The use of pact is seemingly only covering some small portion of each integration point between applications as large, comprehensive pacts that cover the full API and values used are considered too costly or coupled.

I am conflicted that we are losing test coverage of business use cases because there aren't necessarily any tests that are automatically running a use case end to end.

How do you deal with this in your workplace and what is your position on e2e vs pact testing.

you are viewing a single comment's thread
view the rest of the comments
[–] EthicalAI@beehaw.org 5 points 1 year ago* (last edited 1 year ago) (3 children)

You should end to end test. If it’s slow, do it less often. If it’s costly, again do it less often. But this is your last line of defense against bugs.

Now, every service should also unit test, with mocks of all the other services that they call. I assume this is what you mean by pact testing. These should be locally runnable, offline, as the mocks are cheap offline things. If you need data from a database, I’d recommend mocking the data too.

A pact was broken when a mock passes but an e2e fails. You can share the mock across multiple codebases and test it is accurate to any PRs in the codebase it mocks.

[–] ZeroEcks@lemmy.blahaj.zone 3 points 1 year ago (2 children)

I think pact testing means contract testing, basically a test that asserts an agreement between two things (microservice, backend, frontend, etc)

[–] EthicalAI@beehaw.org 1 points 1 year ago

My edit covers that

[–] show_me_the_clamps@vlemmy.net 1 points 1 year ago

Yep I could have been more clear this. Pact being the library I am using to fulfil the contract tests.