Unit Testing: Beginner Questions

后端 未结 4 791
陌清茗
陌清茗 2021-01-31 12:14

I\'m finally starting out with unit testing, having known that I should be doing it for a while, but I have a few questions:

  • Should or shouldn\'t I retest parent c
4条回答
  •  耶瑟儿~
    2021-01-31 12:44

    • Test parent, test child; if the child doesn't override the parent method, no need to retest it.
    • I'm not sure I understand the second one. You can use Selenium to automate testing a form. Is that what you mean?
    • Tests should include the "happy path" and all edge cases. If you have an optional parameter, write tests to show proper operation with the value present and absent.
    • Unit tests, integration tests, acceptance tests, load tests are all different ideas that may have some overlap.
    • I'll bet there are valid reasons, but if you're doing automated builds that run the test suite automatically why would you not run them? Maybe long run times come to mind, but that's the only reason I can think of. The value is seeing that all of them continue to pass, and that changes you've made haven't broken anything.
    • Unit test to me means the class you're testing, which can have several methods. I associate them with classes, not forms. Forms mean UI and integration testing to me.

提交回复
热议问题