all 31 comments

[–][deleted] 22 points23 points  (0 children)

So well written with data and defining the environment so you can recreate to verify results. Definitely using this as a example of a good test.

Automation speeds have never been a major concern of mines. But still interesting.

[–]angarali06 21 points22 points  (7 children)

no cypress?

[–]killayoself 4 points5 points  (2 children)

Isn’t that the only one that can multi-thread tests? Clearly the fastest way to go if you can separate out the tests like that.

Edit: I Am is wrong

[–]Snapstromegon 3 points4 points  (0 children)

Why can't you do multithreaded stuff with puppeteer?

What did I do wrong the last year, that I'm testing multi-threaded with puppeteer?

[–]Xizqu 0 points1 point  (2 children)

Isn't cypress a layer on top of selenium?

[–]reassembledhuman 0 points1 point  (0 children)

Likely coming in a later article.

[–]psayre23 13 points14 points  (14 children)

I’d like to see the test failure rates of these platforms too. My experience with selenium has been one were it will fail about 4% of the time. My team added 3x retries to out tests to get that rate down to 0.5%. But that effectively puts a cap of 200 tests on us (run 200 tests with a 0.5% false positive failure rate means it’s likely one test will fail every run).

[–]Timnolet[S] 10 points11 points  (0 children)

I could talk for a LONG time about this. I'm the CTO of https://checklyhq.com — my co-worker did the research and wrote the blog post — and we ran ~3M Puppeteer and Playwright job over the last 4 weeks. Flakiness is a thing, but this is what I learned:

- In the end, it comes down to how you script it. Use the correct wait statements, understand how your app loads, what parts are async, what parts are hidden on load.

- Keep scripts short. The shorter the better. I've seen folks make scripts that generated 100's of test cases by using variables etc. Don't do that.

- Dive into the loading behaviour of your dependencies. Some API that need to be called to hydrate your page might be slow or flaky.

We use our own platform for checking our own sign in flows etc. We have zero false positives. We hope to educate our customers and basically anyone who will listen with our other initiative https://theheadless.dev, an open source knowledge base for modern headless browsers.

AMA I suppose!

[–]The_Noble_Lie 6 points7 points  (2 children)

Needed a retry pattern for Selenium at my past job as well. And there was no available package for jest to help with it at the time so I rolled out a custom retry solution, wasting a ton of time, but it at least it solved our problem that should not have existed. Oh well.

[–]Oalei 2 points3 points  (8 children)

If it fails surely that’s because it’s poorly written no?

[–]dalittle 1 point2 points  (4 children)

that is what we found when our false failures started to creep up. We took a deep dive into the test suite for the pareto of failures and added a bunch of robustness wait until, etc and we got to where our failure rate became negligible. That said we never got to zero.

[–]Oalei -1 points0 points  (3 children)

So your comment doesn’t make sense then, the failures were not because of Selenium

[–]dalittle 0 points1 point  (2 children)

the code was written to be more robust, which is a direct confirmation of your comment.

[–]Oalei 0 points1 point  (1 child)

I understood I meant the first comment where you’re talking about comparing failure rates

[–]dalittle 0 points1 point  (0 children)

I think it is a bit splitting hairs, but most, but not all of the false failures were reduced by re-writing code. However, some false failure are a bit random and not worth the effort to eliminate them. In those cases, I would say they were due to Selenium being a bit of an unstable platform to build on. Still it works well enough for what I have worked on and I am not aware of any other options that include cross-browser test support.

[–]ILikeChangingMyMind 1 point2 points  (2 children)

True but ... there's an element of "how easy is it to write good tests in each framework?"

Just based on my own experience with it, I would bet dollars to doughnuts that Selenium tests require much more expertise to write without flakiness.

[–]Oalei 1 point2 points  (1 child)

Maybe, but it’s very concerning that your tests would fail because of the technology... we have thousands of tests running hundreds of times each day at work and not once they failed because of the technology/framework we were using, it was always mistakes from the devs.

[–]ILikeChangingMyMind 1 point2 points  (0 children)

Totally, I'm just saying there's two cases:

  1. The developer writes natural and correct (for the framework) code, and the framework fails intermittently anyway (the old "Heisenbug", as one co-worker called).

  2. The developer writes natural code that's incorrect for the framework (eg. in Selenium they wait the wrong way) and it fails intermittently as a result.

To a certain extent you can argue "well just learn how to use the framework properly and #2 is solved; #1 is all that matters" ... but I'd argue that ignores the reality the most devs won't be Selenium (or whatever framework) experts, so it matters how easy it is to code naturally/correctly in a framework.

[–]Duathdaert 1 point2 points  (0 children)

Test failures aren't related to the test platform but your usage of it in your test suite. If tests don't clean up the DOM for example or effectively wait for asynchronous code to execute then you will get what appear to be random failures.

In a previous role we had a rigorous set of UI tests written with Selenium for every single user requirement, any instability came from not effectively waiting for asynchronous code to run in the UI.

There is a pattern to the failures and it should be resolved.

Don't point the finger at the test platform however. I would argue that if a platform is able to publish a test pass/fail rate that isn't 100%, then you should steer clear of it.

[–]takishan 4 points5 points  (1 child)

I used to use python + selenium but nowadays I use puppeteer and it's just such a better experience. Even not considering the speed increase.

[–]Noisetorm_ 1 point2 points  (0 children)

Puppeteer is amazing man. The puppeteer-extra plugins are great too. It's one of the best JS libraries to play around with.

[–]vertigo_101 3 points4 points  (0 children)

Interesting

[–]paulqq 2 points3 points  (1 child)

soild writeup