Thursday 31 December 2015

Performance tests

Code can always be optimized in terms of resources used. It makes sense adding performance tests when resources matter and their acceptable usage is a part of the requirements.

Resources can be time, memory, number of threads, sockets etc...but probably most measured are time and memory.

These tests are integration tests because:
- they rely on external factors (they are system- and hardware-dependent)
- asserted results can vary in time
- they can take much time to execute

An example of performance test is verifying that some algorithm performs some task within the acceptable time range.

There is a question on their consistency: e.g. the same algorithm takes more time to execute on slower machines so how to determine pass/fail criteria?



Further reading:
https://en.wikipedia.org/wiki/Software_performance_testing
http://www.dynatrace.com/en/javabook/performance-in-continuous-integration.html
http://stackoverflow.com/questions/751626/performance-testing-best-practices-when-doing-tdd
http://stackoverflow.com/questions/2870322/performance-testing-versus-unit-testing
http://stackoverflow.com/questions/457605/how-to-measure-code-performance-in-net
http://stackoverflow.com/questions/969290/exact-time-measurement-for-performance-testing
http://stackoverflow.com/questions/15181358/how-can-i-unit-test-performance-optimisations-in-c


No comments: