Live data from Hacker News

100,000 e2e selenium tests? Sounds like a nightmare

watirmelon.com

41–50 of 58 posts

Re: 100,000 e2e selenium tests? Sounds like a nightmare

#43
Your unit tests aren't going to catch browser bugs which sounds like the big reason there are so many "tests" (it's 7,500 tests across a lot of browsers). I bet they have a lot of unit tests too for components that aren't on the user facing web app.

The slide "Why Salesforce loves WebDriver" explains it perfectly. It's a feature--not a bug--that they experience latency (users do too and latency is realllly important for web apps).

It is a lot of VMs, but Salesforce is a $32B company entirely based in the cloud, a few million bucks of metal to test their breadwinner seems cheap.

Re: 100,000 e2e selenium tests? Sounds like a nightmare

#44
post #32

Earlier quoted context omitted.

I don't see how your definition of refactoring and mine differ.

In your definition if you introduce or remove a bug your not refactoring. More basically for things like simulations or graphics you may trade accuracy for speed so your code may behave slightly differently, but be much faster. The important bit with refactoring is the goal is not fixing a specific bug, however realistically for any sufficiently large change bugs can and will be both added and removed. Edit: "Typical…

I feel we may be getting into bike-shedding territory here. When I'm refactoring, as part of the TDD Red/Green/Refactor cycle, I'm changing how code is implemented, usually to improve the design and readability, such that the functionality stays the same e.g. all of my tests pass without touching them. Anything I gain from the refactoring is bonus on top.

Refactoring without introducing bugs is the #1 reason people do TDD vs Test After. But if you don't trust the test suite to catch bugs introduced when refactoring then I'd argue the test suite itself probably isn't that useful and needs work.

On a side note I believe the term "refactoring" has been way overused these days. You can change code without it being "refactoring". When I've seen people use the term "refactoring" (and I've caught myself multiple times on this) they mean rewriting, for in most cases this rewriting means changing the code and changing the tests. If you have to change the tests because of changes to the code, that's not refactoring, that's just changing code.

Re: 100,000 e2e selenium tests? Sounds like a nightmare

#45
post #2

> I would definitely choose a comprehensive suite of automated unit tests over a comprehensive suite of end-to-end/system tests any day of the week. Huh, after working on very large applications with tens of thousands of unit tests I'd choose the opposite. I've found little value from unit tests. They're sometimes good enough for catching the lowest common errors. With very complex applications that involve a great d…

I think it depends how tightly your business logic and your view are bound and how well your business logic is abstracted. I use Angular at work and 90% of the bugs we get can be caught by a unit test. On a rare occasion something will be mis-labeled on the markup and the two-way-binding "fails" silently, but usually our bugs are errors in the logic. Whenever you fix a bug in your code, try to cover it with a unit te…

Whenever you fix a bug in your code, try to cover it with a unit test. If you can't, ask yourself whether it might be because the code is poorly abstracted.

This, big time. Whenever I get a bug report I first write a test that fails because of the bug. Only then can I a) be sure I understand the bug and why it happened and b) be sure I fixed the bug and finally c) prevent a regression in the future.

Even for people who are not TDD or big on tests in general can make great use out of writing tests to verify and fix bugs.

Re: 100,000 e2e selenium tests? Sounds like a nightmare

#46
post #39

Selenium creator and Sauce founder here. Not enough automated e2e is also a nightmare. (Ask me about my experience helping to fix HealthCare.gov sometime!) As usual, the right answer is: a little bit of every kind of test, depending on the risks involved. The article starts (and ends) quite hyperbolic, but comes to the same "everything in moderation" conclusion.

I'd actually be extremely interested in hearing more about your experiences with HealthCare.gov. I'm working on implementing test infrastructure for my current employer and would love to learn from folks more experienced than myself about the process!

Re: 100,000 e2e selenium tests? Sounds like a nightmare

#47
post #46
post #39

Selenium creator and Sauce founder here. Not enough automated e2e is also a nightmare. (Ask me about my experience helping to fix HealthCare.gov sometime!) As usual, the right answer is: a little bit of every kind of test, depending on the risks involved. The article starts (and ends) quite hyperbolic, but comes to the same "everything in moderation" conclusion.

I'd actually be extremely interested in hearing more about your experiences with HealthCare.gov. I'm working on implementing test infrastructure for my current employer and would love to learn from folks more experienced than myself about the process!

Thanks for taking the bait. :-) I don't have time to write about it today, but hope to someday. Since this won't be the last time the government creates a website, the government needs to get good at this stuff. The tech team did an amazing job rescuing the site, and I hope the geeky lessons (especially from the testing perspective) get shared someday.

Re: 100,000 e2e selenium tests? Sounds like a nightmare

#48
I think the difference between an Airbus Airplane and a Software System is that once Airbus chooses a material that it meets it characteristics it does not go back an change that material. And the material does not change by itself. So the airbus test pyramid works because the bottom is stable.

In my personal experience in software systems is that the bottom is not stable you never end up selecting a material and having component that never changes after you build it. All layers of an application tend to change as the application changes and user needs change. Therefore you can't really say that oh we tested the bottom of the pyramid and know for sure that it works.

Writing end to end tests for application is quite hard work and requires a lot of though to design an application that can tested both at the unit level, the component level, and the system level.

Even though end to end testing is very hard it's value is massive as an industry we should be focused on lowering the cost of end to end testing rather than saying that unit is good enough.

Re: 100,000 e2e selenium tests? Sounds like a nightmare

#49
post #21

Earlier quoted context omitted.

Then you're not refactoring. Refactoring is defined as changing how the code is implemented without affecting the functionality / behavior of said code. Also, Unit tests are where you ensure the non-happy-paths are functional (error handling, input robustness, etc).

That's a ridiculous definition, that's like suggesting coding is turning requirements into bug free computer code. Refracting is attempting to replace working code with code better suited to your long term goals.

The standard definition of refactoring is that it doesn't change behaviour. As Martin Fowler put it:

Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure.

You correctly identified a consequence of this in your later comment:

> In your definition if you introduce or remove a bug your not refactoring.

That is indeed the case.

And also correctly observed that:

> realistically for any sufficiently large change bugs can and will be both added and removed.

If a change adds or removes a bug, it was not a pure refactoring. It may have been an attempt at a pure refactoring, and it may have been otherwise successful, but the introduction of a change in behaviour means that it was not purely a refactoring. This isn't necessarily a bad thing - i'd rather bugs be removed than not! - but it's possible to distinguish the refactoring and bug-fixing aspects of the change. Ideally, i would like to see those aspects formally separated, for example into separate commits in source control. But even if not, we can at least use the terminology correctly and precisely.

Re: 100,000 e2e selenium tests? Sounds like a nightmare

#50
post #2

> I would definitely choose a comprehensive suite of automated unit tests over a comprehensive suite of end-to-end/system tests any day of the week. Huh, after working on very large applications with tens of thousands of unit tests I'd choose the opposite. I've found little value from unit tests. They're sometimes good enough for catching the lowest common errors. With very complex applications that involve a great d…

>I've found little value from unit tests. Not even when re-factoring? Refactoring code without unit tests makes me extremely anxious and I try to avoid it.

Refactoring code without tests is definitely scary. But those tests don't need to be unit tests.

(caveat: i understand "unit test" to mean a test which tests a single class, or sometimes a very small number of classes, with any collaborators replaced with stubs or mocks)

In my experience, bigger tests - what my colleagues call integration tests, which might involve 3-30 classes and often the database - give me a lot more confidence in my changes.

Tests are only a useful safety net for changes which are entirely confined to the thing they test. If you're changing the way some particular method is implemented, say from looping over a collection to mapping a lambda over it, then the change is confined to that class, and a unit test can help. But if you're changing the method's contract, say from taking a collection of objects to taking one at a time, then the change takes in that class and its clients, and the unit test is useless - it tests that the method does something that it should no longer do! Yes, you can rewrite the unit test, but that does nothing to reassure you that the overall behaviour hasn't changed. You're starting from scratch.

The thing is, in my experience, valuable refactorings tend to take in more than one class. Sometimes much more than one class. I want to be able to make those refactorings with a safety net. Unit tests can't give me that.

Post reply on HN