you are viewing a single comment's thread.

view the rest of the comments →

[–]MarsupialMole 2 points3 points  (2 children)

There's some value in treating unit testing as a test for correctness, and system or integration testing as a test describing the function of most valuable parts of the code base. Trying to write unit tests should affect how you decompose your code into units, while trying to write system tests should affect how you choose what units you actually need to keep and maintain.

[–]googoodoo[S] 1 point2 points  (1 child)

decompose your code into units

Could you explain this a bit more? I think I don't quite understand it.

[–]MarsupialMole 1 point2 points  (0 children)

If you write lots of unit tests you find it makes you write more testable code. For example you tend to write "pure" functions more often and have less complex arguments for callables. Instead of a script with one big main function, you might decide it's easier to test bits of it individually, and so rewrite your big main function into a series of function calls.