Tag Info

New answers tagged

1

Indeed, such fixtures are not a good way to run unit tests. The goal of unit tests is to test a very specific (and often very small) part of the code in isolation from the remaining code and the environment. By making those tests rely on the particular state of the web page, you lose the “unit” aspect of your tests, meaning that you'll rather have system and ...


0

My rule of thumb: The smallest unit of code which is still complex enough to contain bugs. Whether this is a method or class or subsystem depends on the particular code, no general rule can be given. For example, it does not provide any value to test simple getter/setter methods in isolation, or wrapper methods which only call another method. Even a whole ...


3

There is no "one size fits all" answer to where you should put the boundaries of your SUT. The optimal size of a SUT for unit-testing depends on a lot of factors, including The language and toolchain you are working with (how many errors can be detected by static analysis/compiling the code) The complexity of the product you are making How familiar the ...


3

Ideally things would vary according to the rule of common sense. Martin Fowler talks about a unit as a class (plus related classes in some cases) and IMHO a unit should be a useful lump of code, this may be a single method where a method is quite complex, or a whole class as classes are the means of dividing a system into manageable components. A single ...



Top 50 recent answers are included