Unit Tests vs. Acceptance Tests

后端 未结 5 1605
不思量自难忘°
不思量自难忘° 2021-01-30 01:29

Are you for one or the other? Or both?

My understanding is unit tests:

  • validate the system from the developer\'s point of view
  • help developers pr
5条回答
  •  执笔经年
    2021-01-30 02:10

    These are just my personal opinion on the issue of some kinds of tests:

    However, for minimization of redundant work, is it a good idea to try to incorporate unit tests into acceptance tests?

    I'd second S. Lott's no on this and add that there is a danger here of the unit tests being rigged to some extent that may have some bugs pass through. For example, on a drop down someone may test a few states but likely not all of them, where a tester may use different data to uncover a potential bug.

    In other words, have the latter call the former. Does going in the opposite direction make any sense?

    I'd be careful of ever coupling them together. The unit tests represent tests of the smallest bits of functionality, often so small that an end-user wouldn't understand that there may be hundreds of tests just to get a web form to enter data into a CRM system. Acceptance tests are more about what the user of the application wants which can be more subjective,e.g. "Does this look pretty?" versus "Does this look right?" There can be that mark of "good enough" with acceptance tests that I'm not sure would work with unit tests. Generally if a unit test fails, then someone has to decide either to fix the code or remove the test as each can be a good option depending on circumstance.

    What are your thoughts in general on unit tests vs. acceptance tests, and how to manage them in relation to each other?

    Unit tests are about verifying the simplest pieces of code. There can be integration tests but this is a level higher as once all the little pieces are checked, do the combination of the pieces work together,e.g. there were Saturday morning cartoons I watched growing up that had toys one could put together like "Voltron" or various Transformers like the Constructicons that formed Devastator. Acceptance tests are generally from an end user perspective of, "Can I do X with the application now?" having an answer of "Yes," before something goes out the door. While some error cases may be checked in an acceptance test, it isn't common to do a thorough test of every possible combination that one could enter into an application. However, unit tests may cover boundary conditions and a few other random-like cases.

提交回复
热议问题