13

We recently had a consultant tell us that if a feature can only be tested via automated UI tests (e.g. Selenium, Coded UI), then there is an underlying architectural issue. While this statement might be a bit extreme, it is along the same lines of the testing pyramid in that UI tests should make up a small portion of your overall automated test suite.

So, what kinds of features should have automated UI testing? Will a system with a cogent architecture still have features that can only be verified through UI tests, or should these tests just serve as "back-up" for a suite of unit and service tests?

Jake Kreider
  • 233
  • 1
  • 5

3 Answers3

12

Presumably you have some sort of architecture that connects buttons and other widgets to actions -- click on save and the save function should be called, etc.

Assuming you have good test coverage of the actions themselves via unit or integration tests, the goal of automated UI testing is to insure that the widgets are all making proper calls to the underlying actions, and correctly displaying the results of those actions.

In other words, they validate that the UI properly reflects the state of the model, and is properly hooked up to the controller.

The other component is when some business logic is in the UI code. For example, maybe you require certain characters in a password field. You need to test those features somehow, since it may be difficult or impossible to do that via unit tests.

Bryan Oakley
  • 25,192
  • 5
  • 64
  • 89
4

What features should be tested via automated UI testing?

All ui features.

You should test:

  • All functions that users can do.
  • Functions that users do in all the browsers (and versions of) that they do them in.
  • Both happy (doing the right thing at every step) vs sad (user makes errors) paths.
  • Valid and invalid Data.
  • Large and Small numbers.
  • All roles and functions roles specific to role.
  • User and Admin interfaces.
  • Attempts to break-in.
  • Creating vs. Updating data works as intended.
  • Delete's work and delete associated database data in other tables.
  • Keyboard vs. Mouse style users.
  • Different devices or simulators of - pc's, phones, ipads, etc.
Michael Durrant
  • 13,101
  • 5
  • 34
  • 60
0

There is no such thing as a feature that can only be tested via automated UI tests. Tools like Selenium just mimic the behavior of a human, without boring the human to the point of suicide. Ask yourself (or your consultant) a question: "How would a program test UI aspects that a person cannot?" The next question is: "If so, why would you care what they do?"

On the other hand if, you have such a feature, well, yeah, I'd say you have an underlying architectural issue. :-)

Ross Patterson
  • 10,277
  • 34
  • 43
  • 1
    I think by "only" they are referring to automated UI tests versus unit or integration tests. I don't think it's possible to create something that selenium can test that a human cannot (modulo the speed of humans versus the speed of selenium) – Bryan Oakley Jan 15 '13 at 23:27
  • Sorry, I can see where you'd get that from the question. Though you've challenged me to develop an application that can only be used by Selenium -- just to stick it to our UX team :) – Jake Kreider Jan 16 '13 at 13:49