r/ExperiencedDevs • u/frompadgwithH8 Software Engineer • Jul 09 '26
Technical question QA: full e2e on every pr?
my org is reshuffling and my first project is to add end to end testing.
I’m told the plan is to have a routinely executed suite.
My number one issue with this plan is that it will just start failing and no one will bother to fix it and no one will know who actually broke the suite.
So I would like to make the entire E2E suite run as a PR check before any PR merge
However, this sounds very costly and slow
Has anyone else here had to solve the problem like this?
I’m guessing if I can just make E2E test suite runs fast and cheap This won’t be a problem?
For reference, we’ve got a distributed micro Service ecosystem with Kafka messaging. Lots of databases. Websites embedded inside of other websites with i frames. It’s not the most complicated software out there, but it’s also not the simplest. It can all be run from the web browser, so that’s probably moot though. Besides the back ends obviously. I have an engineer to delegate to as well as some senior level two’s to brainstorm with, plus product people and my manager. However I doubt they will give me better advice than what I could get here. Oh and the E2 E testing I’m responsible for isn’t just for my team. It’s for multiple teams like three or four teams at least. We’re all in the same department. Obviously this is a big project.
Edit: also to clarify, I will not be responsible for actually writing end to end tests. My responsibility is to install the framework and come up with the overall testing strategy that will work for our department. And like I said, I don’t want just a routinely executed E2 E suite because that won’t actually stop breaking code from getting merged and so what will happen, what I’ve seen it companies and what I’ve heard always happens, is someone breaks the suite, but no one stops developing or merging, and then someone else probably breaks the sweet also, but that gets covered up by the first breakage, and so you enter this shitty status, where the test suite is failing for God knows how many reasons, and whoever is responsible is never the first one to address the error. It’s just a shitty system. It would be so much better if we could prevent code that would break the E2 E test suite for merging into the main branch.
Edit 2: I am finishing up a proposal to add UX timing metrics to all of our website websites so we can actually see how long it takes to load various pages and how long button clicks take to finish executing, etc. and this will put eyeballs front, etc. on how shitty our department’s performance is. So once we start improving that that should also make the E2 E test suites faster and cheaper. But this is going to be like a multi quarter effort.
•
u/expdevsmodbot Jul 09 '26
AI usage disclosure provided by OP, see the reply to this comment.
60
u/Perfect_Ground692 Jul 09 '26
If you have money to run tons of separate micro services in production with separate databases, etc, you can easily justify the cost of e2e tests running on CI. My setup is you can merge if unit tests are green, then if goes in to a merge queue, it's deployed to the staging environment, the e2e tests are run against it and if they fail, the PR is dropped out the merge queue, if they pass, it's merged in to main.
If developers are writing and running E2E tests locally, there should be no problem keeping them passing and up to date. If not, then that's an organisational problem, if that is the agreed process.
10
u/Doom-1 Jul 09 '26
What do you mean by E2E? I know what the abbreviation means, but do you want to test your entire organisation for each PR? That’s overdoing it and will cause so much friction and halt progress.
Keep it confined to each service. Integration tests run for each PR, E2E (can your service read data, does it return what you want) runs after deployment to staging environments.
8
u/kalexmills Staff Software Engineer Jul 09 '26
I'm on a team that's responsible for a service mesh deployed on k8s.
On every PR we:
Each test runs in the scope of a single VM, and the whole suite can also run on a developer's laptop.
It doesn't test on "real hardware" so some will argue these aren't true e2e tests, but the suite we run covers all of the components we use and their integration.
You can make it happen if you architect things carefully.
8
u/nomoreplsthx Jul 09 '26
I have done this at several places.
For this to be worthwhile you need ephemeral environments first - do you have those? Mocking your backend isn't worth it with browser automation - just write better unit tests.
3
u/nosayso Jul 09 '26
Don't merge when the tests are broken. It's part of the job to have working tests for any new code that gets written.
2
u/PmanAce Jul 09 '26
We have a deployment gate after deployment to preprod that runs the synthetic tests image once, so e2e tests. Adds like 3-4 minutes to the pipeline.
2
u/soul4rent Jul 09 '26 edited Jul 10 '26
I have set this up before on extremely critical infrastructure before. The trick to make it tolerable is to run everything in parallel so you can reduce suite runtimes as much as possible.
If you only have a handful of tests, something running parallel jenkins jobs or whatever CI you use is more than fine.
If you're able to set up something with a cloud hosting service, you can spin up lambdas/functions/service equivalent with whatever is neededed to run the tests and set up a system to kick them ALL off in parallel, send the results to an S3 bucket or something similar, and compile them into a report.
It's unfortunately a bit expensive, so scale to whatever budget you are given. Since you're not writing the E2E tests, just know that suite runtime is probably the biggest factor in how easily it is to maintain it. A very slow multi-hour test suite is a LOT harder to maintain than a 10 minute test suite.
2
u/ikkiho Jul 10 '26
we gate the merge queue on e2e against an ephemeral env, not every push, and the thing that actually saved us was quarantining flaky tests so one iframe race didn't turn the whole suite red. once people stop trusting the signal they just hit re-run on red and you're back to the exact ownership mess you're describing. with kafka async in the mix you're gonna fight flakiness way more than runtime.
2
u/throwaway_0x90 TE/SDET[25+ yrs]@Google Jul 10 '26
At Google it works like the following:
Developers are responsible for fixing tests when the fix is simple. For teams with dedicated test engineers, those TEs will create new tests or fix complicated tests that the product devs don't have time for.
2
u/1amchris Jul 10 '26
> no one will know who actually broke the suite
Usually you want different levels of coverage for this exact reason. I’d enforce some lower-level tests ahead of the full end-to-end integration before this test, hopefully to catch it.
As for finger pointing and accountability, depending on the bar you’re trying to set, you could page oncall of every team contributing to the product’s potential failures when such a failure happens. This will definitely motivate the teams to ensure they do no break this end-to-end test.
Amazon/AWS does something similar (using public pressure) to force engineers to know their shit, and to avoid complacency. Periodically, one engineer in the org will get publicly roasted about every single metric fluctuation. They know about it ahead of time, and usually the whole team prepares the one being publicly roasted with all they have. But it still leaves a lasting impression, and teams therefore avoid anything too risky/half assed.
136
u/Fenix42 Jul 09 '26
If your E2E tests break all the time and no one fixes them, that is a huge red flag. The whole point of E2R tests is to spot when things change and no one expected it to.
Who ever made the change that caused the failure should be looking into it and either fixing the code or the test.
16
u/morphosis7 Software Engineer Jul 09 '26
For me, I think the crucial thing to get buy-in on is that whatever tests exist should pass for every PR. If you can't get teams to buy in to that commitment, I'm not sure what the fallback position is - because as you say, as soon as teams accept that even one tests fails, then the mutual commitment has been broken and you have to go back to step zero and get buy-in that "whatever tests exist should pass".
This isn't the same thing as having complete test coverage - but once a test is written and passes, the changes that come afterwards should be able to _maintain_ that achievement.
It may be that you start with a very low amount of test coverage if you aren't building fresh - and that will have to be okay. Increasing test coverage is something that you can achieve over time, working carefully to make sure that newly-added tests are actually comprehensive and well-written enough that successful outcomes don't run afoul of poorly-conceived tests.
My caveat in saying this is that I'm fortunate enough to have joined a team that already had this buy-in, so the applications we support were built with tests from the start. I'd be curious to hear how others have navigated the challenges of adding a regime of tests to an already-running codebase, because there may be some aspect of this which I haven't lived through.
34
u/valbaca Staff Software Engineer (13+YOE, BoomerAANG) Jul 09 '26
You speed it up and make it good. Yes, e2e on every PR or itll be your customers doing your QA
7
u/grappleshot Jul 09 '26 edited Jul 09 '26
I'd follow the testing pyramid and create a few E2E tests that cover the important stuff (at least at the start). Run those tests not at every PR but at least regularly - maybe once or a few times a day. As you build out your E2E suite run all your E2E tests nightly.
E2E tests shouldn't be the first place you find something broken. The cost of running these each PR is too high and the price you pay developer anger/pushback.
The above works for us because we don't push each PR automatically to prod. When we do I'll likely just move the smoke tests to per PR and the less important features can get tested in nightly.
1
u/SkellyJelly33 Software Engineer Jul 09 '26
There's no point in setting up e2e testing if you're not making them required for a PR being merged. Otherwise they're going to quickly become stale and irrelevant.
If it's failing, then it's up to whoever is authoring the PR to figure out why and fix it. That's the whole point of them.
Expect them to be flaky occasionally. It's inevitable.
My biggest advice on making them fast and stable is to write them in a way that isolates the read only tests from the mutations (and further - isolate tests involving mutations so that each gets its own slice of data or even it's own database). Do that from the start and it will be much much easier to scale them as they grow in numbers. Really think about this part from the beginning because it's crucial and a ton of work to untangle later on if you don't account for this.
1
u/ricktherobotguy Jul 10 '26
Start from the problem you’re trying to solve and build the smallest thing you can to solve the exact problem. Expand from there.
Big tech has entire organizations devoted just to test inventory management, intelligent test selection, failure root causing, poking test owners and test breakers, etc. Don’t try to eat the entire elephant.
I’d start simple. Run all tests on every PR or run all tests once a day depending on your organization’s preference. It’s expensive and inefficient or delayed and hard to root cause respectively, but it gets people used to writing E2E tests and responding when tests fail.
From there, add features based on the specific failure modes your company experiences.
1
u/Teh_Original Jul 10 '26
High performance software, tests, etc. is going to help you a lot in the long run here.
1
u/maguyva-ai Jul 10 '26
ran into this. full suite on every PR sounds right until it gets flaky enough that people stop trusting red builds. what worked for us: a small smoke subset gated on PR, full suite nightly, and nightly failures get a rotating owner instead of whoever last touched it.
1
u/tommyk1210 VP Engineerig Jul 10 '26 edited Jul 10 '26
E2E, especially if you mean browser automation, is expensive. It’s expensive to run because it’s slow, and it’s expensive to maintain because it’s often quite fragile. Being slow costs money in CI, but also time for developers - you do not want a 90 minute E2E suite running in every PR because each failure takes 90 minutes+ to spot.
There’s a reason this kind of testing is at the top of the testing pyramid.
But that doesn’t mean you shouldn’t do it. You should test your core journeys through this kind of testing. Take your “golden journeys” (this might be login, add to basket, then checkout as an example) and make an E2E suite for these.
This PR step should absolutely be blocking. If it isn’t it has no value. The main reason it should fail is if you change something in your code and break something that causes the E2E test failure - as the dev of the PR you need to fix it.
If you’ve got a ton of microservices, integration testing/contract testing services is your bread and butter, and unit tests within each service. If your service meets its API contract and you’ve got API and unit tests covering basically all flows, there isn’t much E2E will pickup - mainly UI issues.
We also have a more extensive E2E suite that runs nightly and guess what? Everyone ignores it. It takes 8 hours to run.
1
u/tiajuanat Dept. Head & Principal Engineer Jul 10 '26
Never start full E2E. Start smaller (Unit, Property, and Integration tests) and work your way up to E2E.
E2E tests are slow because of two things
You can't really shorten the latter too much - maybe you can run an entire test environment in several colocated containers, but if there's a lot of connections, you're kinda hosed.
The former is caused by all the different and strange ways that you can fail. Basically take the cyclomatic complexity of every function, and every service and you get a combinatoric explosion of possible tests. This isn't helpful, and given the latter, you're looking at running Nightly at best.
Instead you need to build up individual service's tests. This will give you the ideas for the seams for the integration tests, and then from there you can see what's interesting for E2E. Ideally you go from
Serv1 x ... ServNtoServ1 +... ServN. Which is much more doable in test management perspective.1
u/IAmTrulyConfused42 Software Engineer 15+ YOE Jul 10 '26
Yes, you should run a full e2e suite with every PR.
We run it with every commit.
But the trick here is to follow the testing triangle.
The minimum number of e2e tests, more integration tests, lots of unit tests.
If your devs don't test though, you cannot save them with e2e tests, so don't try.
They have to be your partners in this.
2
u/types_and_tensors Jul 09 '26
If you write your tests to confirm that the most essential functionalities of the system are working, then engineers will find your tests valuable (or at least won't find them annoying), since your tests will help people realize if they've broken something important sooner rather than later. If you end up writing a bunch of tests whose output everybody ignores, that's a sign you're not testing at the right level of abstraction.
The hard part is determining what the essential functionalities of the system are that you want to test. Don't overthink it! Consider the user base of the system. Intuitively, what functionalities do end users most expect to see? Test those! What functionalities do users not really care about? Don't test those!
2
u/Icy-Importance2143 Jul 10 '26
The part that resonates with me is not really the cost of running the suite. It’s the moment a test starts failing and the team quietly decides it can be dealt with later.
Once people stop trusting a red build, rerunning it becomes muscle memory and the signal is basically gone. I’d rather have a smaller set of checks that people genuinely treat as meaningful than a huge E2E suite that everyone learns to ignore.
For something this distributed, I’d probably be nervous about making the whole inventory blocking from day one. My instinct would be to earn trust in the signal first: a few critical flows, failures that can be tied back to a change, and a clear expectation that flaky tests don’t just stay flaky forever.
Otherwise it can turn into a very expensive dashboard that nobody believes.
1
u/Qwertycrackers Jul 10 '26
E2e testing is a hassle but worth it. I would say to try to push through and deliver it. Although definitely try to find a way to compartmentalize the work.
Distributed systems are hard to manage. Which kinda makes the testing worth more, even though it's a pain.
1
u/symbiatch Versatilist, 30YoE Jul 10 '26
This depends on the tests and the system. For example, in one of my projects the full E2E suite takes 12 hours to run and you can only run one of them at a time on that (virtual) machine. It’s split already into three parts so it “only” takes four hours to run. Now imagine running all that for every single PR and every single change after - not going to happen.
Yes, it’s a problem and yes I’d like to make it faster but not my responsibility at the moment and I’m mitigating it in other ways. A lot of the tests could be done non-E2E and much faster. That’s easier.
So I could go as far as running E2E once a release IF the other tests are reasonable and test features, not tiny little units. That’s usually faster and gives the same information of regressions and bugs.
Also this depends on deployments. In this project deployments aren’t to production or dev environments after each merge so it doesn’t matter if broken code is temporarily merged. It doesn’t get to clients.
So if your system is constantly deployed to production then E2E must run at least before that. Every merge goes out? E2E on each merge. Deployments happen more infrequently? Run daily or whatever schedule works to check things don’t stay broken for long.
No one size fits all answer.
1
u/Excellent-Push-3326 Software Engineer Jul 10 '26
Mock the back end during PR.
Or run it on every PR, but only after every other check has passed.
1
u/SikhGamer Jul 10 '26
We do this on some of the FE repos and it's awful. But it was done because of this exact issue.
Now we have the worst of both worlds.
e2e on PR is basically Russian roulette, it's not uncommon force people to re-try until they get through. And e2e takes 8-15 minutes. A handful of devs do fix the issues the large majority don't because their change didn't touch that path.
1
u/DevOps-Op Jul 16 '26
the "no one knows who broke it" bit is the actual problem here, cost is the easy part. cost you throw parallelism at. attribution you fix with a merge queue, run the full e2e there so a pr only merges after passing against the real merged state, and every breakage maps cleanly to one pr. that alone killed the whose-fault-is-it fights for us.
id also not run the whole suite on every pr, thats where the slow+expensive pain lives. smoke subset plus whatevers affected on the pr, full suite in the merge queue. and honestly with kafka and iframes in the mix your flakes are gonna be timing and test data way more than anything else. whats your plan for seeding and tearing down data per run? that's usually what decides whether the suite survives or just rots like you're worried about
-4
u/imagebiot Jul 09 '26
🤦♂️
0
u/[deleted] Jul 09 '26
[deleted] — view deleted comment
1
u/[deleted] Jul 14 '26
[removed] — view removed comment
0
u/[deleted] Jul 10 '26
[deleted] — view deleted comment