How do you unit test business applications?

前端 未结 6 1204
执念已碎
执念已碎 2021-02-19 07:05

How are people unit testing their business applications? I\'ve seen a lot of examples of unit testing with \"simple to test\" examples. Ex. a calculator. How are people unit tes

6条回答
  •  孤街浪徒
    2021-02-19 07:32

    It sounds like you might be testing message based systems, or systems with highly parameterised interfaces, where there are large numbers of permutations of input data.

    In general all the rules of standard unti testing still hold:

    • Try to make the units being tested as small and discrete as possible.
    • Try to make tests independant.
    • Factor code to decouple dependencies.
    • Use mocks and stubs to replace dependencies (like dataaccess)

    Once this is done you will have removed a lot of the complexity from the tests, hopefully revealing good sets of unit tests, and simplifying the sample data.

    A good methodology for then compiling sample data for test that still require complex input data is Orthogonal testing, or see here.

    I've used that sort of method for generating test plans for WCF and BizTalk solutions where the permutations of input messages can create multiple possible execution paths.

提交回复
热议问题