What is it and why is it used/useful?
+2
A:
A sanity test or sanity check is a basic test to quickly evaluate whether a claim or the result of a calculation can possibly be true @ http://en.wikipedia.org/wiki/Sanity_testing
Pangea
2010-10-29 20:41:17
yes, but what does it all MEAN Watson?
whydna
2010-10-29 20:45:06
If, for example, you are calculating a square root by an iterative mechanism. You would then expect that the root you find is positive, and when multiplied by itself it approximately equal the input value. So you might add a couple of checks to ensure your logic is correct - that the answer is 'sane'. These are sanity checks - they cannot be false if the algorithm is logically consistent.
Pete Kirkham
2010-10-29 20:53:44
A:
Good example is a sanity check for a database connection.
SELECT 1 FROM DUAL
It's a simple query to test the connection, see:
http://stackoverflow.com/questions/917927/select-1-from-dual-mysql
It doesn't test deep functionality, only that the connection is ok to proceed with.
Jon
2010-10-29 20:41:47
A database sanity check might form part of a smoke test, but generally a smoke test is a set of rudimentary checks that you would run to ensure an application is working correctly.
Jon
2010-10-29 21:27:43
More info here - http://stackoverflow.com/questions/745192/what-is-a-smoke-testing-and-what-will-it-do-for-me
Jon
2010-10-29 21:30:54
A:
It is a basic test to make sure that something is simply working.
For example: connecting to a database. Or pinging a website/server to see if it is up or down.
Bryan Denny
2010-10-29 20:43:21
No, it is not. Neither of those check whether the logic of the system is 'sane', they both check whether the network is OK. So unless you are proposing that you are performing a sanity check on the principles of TCP itself (which are fairly well attested to be sane), pinging something is not a sanity check. And even then, it fails the basis of a sanity check - that if the logic is correct, the test cannot fail, whereas the logic of TCP is correct, yet pings can still fail.
Pete Kirkham
2010-10-29 20:51:15
Attempting a database connection or seeing if a host is up are much higher level operations than a basic sanity check.
meagar
2010-10-29 21:08:34