Should black box or white box testing be the emphasis for testers?

前端 未结 17 1062
春和景丽
春和景丽 2020-12-02 05:09

Which type of testing would you say should be the emphasis (for testers/QAs), and why?

A quick set of definitions from wikipedia:

Black box testing

17条回答
  •  温柔的废话
    2020-12-02 05:31

    Here is my 5 cents:

    As a developer, I mostly write tests for methods (in a class) as white box tests, simple because I do not want my test to break just because I change the inner works of my code.

    I only want to my tests to break if my method behavior changes (e.g. returns a different result than before).

    Over the last 20 years of development, I simple got tired of doing up-to double work just because my unit tests was strongly tied to the code and I need to maintain both application code and test code.

    I think making decoupling code (also when you code tests) is a very good practice.

    Another 5 cents: I hardly never use mocking frameworks, because when I find it necessarily to mock something I prefer to decouple my code instead - and yes in many cases that is very possible (especially if you are not working in legacy code) :-)

提交回复
热议问题