What is a sanity test/check

2019-01-21 07:44发布

What is it and why is it used/useful?

9条回答
家丑人穷心不美
2楼-- · 2019-01-21 07:56

The act of checking a piece of code (or anything else, e.g., a Usenet posting) for completely stupid mistakes.

Implies that the check is to make sure the author was sane when it was written;

e.g., if a piece of scientific software relied on a particular formula and was giving unexpected results, one might first look at the nesting of parentheses or the coding of the formula, as a sanity check, before looking at the more complex I/O or data structure manipulation routines, much less the algorithm itself.

查看更多
叛逆
3楼-- · 2019-01-21 07:59

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.

查看更多
Bombasti
4楼-- · 2019-01-21 08:02

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

查看更多
何必那么认真
5楼-- · 2019-01-21 08:07

Good example is a sanity check for a database connection.

SELECT 1 FROM DUAL

It's a simple query to test the connection, see:

SELECT 1 from DUAL: MySQL

It doesn't test deep functionality, only that the connection is ok to proceed with.

查看更多
ゆ 、 Hurt°
6楼-- · 2019-01-21 08:10

For a software application, a sanity test is a set of many tests that make a software version releasable to the public after the integration of new features and bug fixes. A sanity test means that while many issues could remain, the very critical issues which could for example make someone lose money or data or crash the program, have been fixed. Therefore if no critical issues remain, the version passes sanity test. This is usually the last test done before release.

查看更多
Lonely孤独者°
7楼-- · 2019-01-21 08:11

A sanity test isn't limited in any way to the context of programming or software engineering. A sanity test is just a casual term to mean that you're testing/confirming/validating something that should follow very clear and simple logic. It's asking someone else to confirm that you are not insane and that what seems to make sense to you also makes sense to them... or did you down way too many energy drinks in the last 4 hours to maintain sanity?

If you're bashing your head on the wall completely at a loss as to why something very simple isn't working... you would ask someone to do a quick sanity test for you. Have them make sure you didn't overlook that semicolon at the end of your for loop the last 15 times you looked it over. Extremely simple example, really shouldn't happen, but sometimes you're too close to something to step back and see the whole. A different perspective sometimes helps to make sure you're not completely insane.

查看更多
登录 后发表回答