Is testing features enough? [closed]

2019-06-25 08:58发布

问题:

The title says it all, if I test using capybara :

visit this page
expect this content 

and do this for every single feature(e.g signin, signup, search, clicking all the links and buttons, etc), would that be enough? Why would I need to test controllers and models? If features are working as expected, doesn't that mean everything is working in harmony?

回答1:

That technique is called black box testing also know as functional testing. If you are testing as if you are a user of the application it is considered black box. If you are testing it from within it is considered glass box testing.

The question of whether or not is it enough is a matter of personal opinion. My opinion is if it is thorough enough then yes it could be enough.

Some of the advantages of black-box testing include:

  • You have a good chance of writing tests that weren’t imagined by the programmer.

  • The environment the program is running is also tested

  • The invested effort can be used multiple times

Some advantages of glass-box testing include:

  • It forces you to reason carefully about implementation.

  • Spots the Dead Code or other issues with respect to best programming practices.

  • Reveals errors in hidden code.