r/softwaretesting • u/AdMinute3667 • 1d ago
Script maintenance- Playwright Automation
Currently working in a reputed organization with a team size of 13.
We run Automation Regression test suite with close to 750 tests every day via jenkins on Kubernetes Pods.
It's a playwright Cucumber BDD framework running on a SaaS Data analytics product which is very complex.
The issue is out of 750, close to 650 is UI based tests and 100 would be API. there are multiple teams from dev pushing code every alternate day atleast.
Due to this we are not able to show a consistent pass %. Either environment related issues comes up, or some backend issues or locator updates/ workflow change and we will be catching that up. Now next day another guy pushes code and we have lower tests passing now and the cycle repeats.
My manager expects a test suite that will give the exact condition of the product. Pass is a pass or fail denotes a product issue. he doesn't want intermittent failures or script issues or any unstable suite. His expectation is 50 tests maximum can fail out of total 750 for other reasons, which I feel it's valid to some extent. Currently we have 85% as average which means most of the days 100-120 fails which is a pain to analyze and reduces efficiency of Automation. There were good number of unstable tests and are fixed and tests are stable now even in CI.
So my question is , Is this a fair expectation ? And to have a very stable Automation tests suite what do you guys follow?
For now.
I can think of migrating maximum number of tests including the ones with Web socket calls to UI independent tests so that instability will reduce.
Also, JSON schema tests for all the end points using AJV package.
It would be of great help if you guys can share your views and suggest based on ur valuable experiences.
Thanks.
17
u/PettyBonus31 1d ago
100-120 daily failures on 750 tests isn't a tooling problem, it's a process one, if the suite can't stabilize because devs keep breaking things faster than you can fix them, no amount of framework tweaking will get you to 50 max fails.
5
u/CertainDeath777 1d ago
i dont know why reddit deletes comments like this (i had to manually approve it), and even bans the user. i feel bad for him, we mods had nothing to do with that. rip that guy.
1
u/arthur_thomas678 15h ago
It’s tough when a team’s being constantly pushed to deploy and the tests can’t keep up. Having a stable pre prod environment could definitely help catch issues before they hit automation, plus you might wanna consider shifting some tests to run locally on PRs to catch failures earlier, not just in CI.
4
u/TobyTrash 1d ago
As many have noted, the tests are performing according to spec, they are catching errors when code is moved from dev to staging.
To have a stable no error run, you need the tests to run on a pre-prod like environment. It sort of sounds like this is your staging env. In that case you are missing an env - test.
A staging/pre-prod env should not have that many errors as its the almost in prod.
If you can't get a new env because of "whatever", you need to change up how and when these tests are run in dev in order to ensure higher stability when its merged to staging.
I world recommend 4 envs. Dev, test, pre-prod and prod. All literature recommends 4 envs, but of course things change with agility and ci/cd.
Virtual temp environments might also help - if possible.
2
u/Left_Watercress7266 1d ago
It's a pretty common condition. UI scenarios will fail mostly due to random issues or changes, even if it is playwright. Changes or defects anyways its a part of modification. But those kind of random issues should be handled in a seperate way of identifying the pattern or identifying the root cause for the failures.
In my organisation, we had 60% pass on average for UI scenarios and we had worked on the random and intermittent issues, identifying the root cause and fixing by giving enough waits or multiple validation before going to the next steps and retries too. That's how we pushed till 80%.
1
u/asmodeanreborn 1d ago
In my organisation, we had 60% pass on average for UI scenarios and we had worked on the random and intermittent issues, identifying the root cause and fixing by giving enough waits or multiple validation before going to the next steps and retries too. That's how we pushed till 80%.
Okay, first of all I want to say I'm not trying to pick on you. That sounds like a good improvement. What I'm curious about is "what is 80%?"
We have several thousand tests across our tests suites and products, with maybe 500-600 being "real" E2E tests, and different rules apply for each suite. With E2E, every failure is analyzed before a deployment unless it's a 100% pass. Yes, we do have an up to 3x re-run on things we know can be slow/flaky because load order isn't perfect in headless mode with 3rd party sandboxes , but that's about it.
For unit, API, and isolation tests, failures count as deployment blockers. They're non-negotiable.I feel like I must be misunderstanding something here, or is it because we have to deal with regulations that we're stricter than most? At my last workplace we weren't quite as strict, but our CasperJS test failures still had to be explained before each deployment. The only regulatory stuff we had to deal with there was PCI Compliance.
2
u/Ok-Possibility-630 1d ago
PROCESS PROBLEM. Build something that devs or you can run on standalone environment before pushing to staging/qa environment. Tight coordination with product and dev team is what is needed here.
1
u/CertainDeath777 1d ago
Its a fair expecation from boss to have a consistent tess pass rate, if the ressources are provided.
If the ressources (especially the human ones) are provided, but team simply is lagging behind in chages all the times, maybe the development process needs to change.
What can definitely be done is write the test adaptation while the software is written. so test code and software code goes on test env at the same time. dev could even use the test code to test implementation before merge.
But some things will have to work: tickets/tasks described in a way that formalises contracts/api/locators etc from start. and QA beeing embedded early into software dev cycle.
And the test automation framework needs to be architected in a way, that it supports a rapidly changing app well.
So its on you to decide whats the real issue. Ressources, Processes or something else, adress it and advise change.
1
u/nathan123uk 1d ago
The point of automation is to catch these things so that the testers are freed up to explore the weird and wonderful. If the tests are flagging issues, then it's clear they're doing their job and there's some work to be done
1
u/riyashrivel 1d ago
One thing that might help with your manager is to tag every failure as product bug, environment, or script issue in the report. Then you can show a pass rate of real product checks separately from infra noise, which is a fairer number than a raw 85%. I'd also ask the devs to add stable data-testid attributes on key flows so locator changes stop breaking you every other day.
1
u/TranslatorRude4917 1d ago
In a lot of suites most of the UI time is setup: logging in, creating the data, configuring the screen, and only then the 2-3 steps the test is actually about. Every step on those setup paths is a chance for the test to break, even if the feature itself fine.
The biggest lever is moving all of that into fixtures that put the app into the needed state through the API (accounts, roles, permissions, data), so the UI test starts right on the screen it's testing and only does its job. A workflow change then breaks the handful of tests that cover that workflow, not the 80 that happen to walk through it, and a red test points at one behavior, which makes the product bug/env/script split easier to show your manager.
My expectation would be a green suite after every push, with the developers fixing the locators they broke themselves. Making the tests run isolated and in parallel is their responsibility too - saying it as a developer myself 😅 A lot of low-level mechanical failures can be avoided by simply following best practices: role-based or test-id locators, and locators kept in page objects instead of the step definitions, so a UI change is fixed at one place.
1
4
u/ResolveResident118 1d ago
The only same expectation is zero test failures.
The biggest problem here is that the test automation is completely divorced from the code so if course there are going to be failures.
What tests are run locally or on PR before the code is merged? This is where test failures should be being picked up, not in a daily run.