Has anyone done temporal unit-testing?
I\'m not even sure if such lingo has been coined or not, but the point is to test that operations perform within temporal lim
The closest thing that I know of that's built in to a unit testing framework is timed tests that were added in JUnit 4. This could be used to ensure that an algorithm's performance doesn't degrade as input size increases.
I think you could do regression checks over unit-test runtime figures. With a lot of the unit test frameworks you can typically get a report that says testname, executiontime. I know junit/surefire does it. So basically you can compare this to previous runs and establish if any significant changes have taken place. If you keep all of this in a database (with the hostname) you can compare execution times for the same run-time environment to previous test-runs. In this way you don't really write tests for performance but you just assert separately that there have been no significant changes to execution-time.
Just some notes from my experience... We care about the performance of many of our components and have a very unittest-like framework to exercise and time them (with hindsight, we should have just used CppUnit
or boost::test
like we do for unittests). We call these "component benchmarks" rather than unittests.
If you want to check if the time increases, the hardware of different machines should not matter, if you don't check for absolute values, but for relative change. Or am I missing something here?
If you're working in C++ have a look at http://unittest-cpp.sourceforge.net/
I've not used the time stuff but it is the best (most concise) unit test framework I've found.