Unit Tests vs. Acceptance Tests

后端 未结 5 1688
不思量自难忘°
不思量自难忘° 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:17

    Unit Tests - my specific function does what it's supposed to do, nothing more, and nothing less.

    Acceptance Test - my application does what it's supposed to do.

    Example: Application to calculate roots of quadratic functions. Takes inputs of a, b, and c, returns roots x1 and x2. This application is built by functions I write to add two numbers, subtract two numbers, multiply two numbers, divide two numbers, and take the square root of two numbers.

    Unit tests - check that my divide and multiply functions work correctly, my square root works correctly, my add and subtract work correctly.

    Acceptance tests - check that my application calculates roots of quadratic functions.

    Since my entire application is to calculate roots, I should not have a unit test that also calculates roots because there is no individual function which does so.

提交回复
热议问题