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 08:12

Smoke test is for quick test of a new build for its stability. Sanity test is a test of newly deployed environment.

查看更多
Anthone
3楼-- · 2019-01-21 08:17

The difference between smoke and sanity, at least as I understand it, is that smoke test is a quick test to see that after a build the application is good enough for testing. Then, you do a sanity test which would tell you if a particular functional area is good enough that it actually makes sense to proceed with tests on this area.

Example:

Smoke Test: I can launch the application and navigate through all the screens and application does not crash.

-If application crashes or I cannot access all screens, this build has something really wrong, there is "a fire" that needs to be extinguished ASAP and the vesion is not good for testing.

Sanity Test (For Users Management screen): I can get to Users Management screen, create a user and delete it.

  • So, the application passed the Smoke Test, and now I proceed to Sanity Tests for different areas. If I cannot rely on the application to create a user and to delete it, it is worthless to test more advanced functionalities like user expiration, logins, etc... However, if sanity test has passed, I can go on with the test of this area.
查看更多
女痞
4楼-- · 2019-01-21 08:21

The basic concept behind a sanity check is making sure that the results of running your code line up with the expected results. Other than being something that gets used far less often than it should, a proper sanity check helps ensure that what you're doing doesn't go completely out of bounds and do something it shouldn't as a result. The most common use for a sanity check is to debug code that's misbehaving, but even a final product can benefit from having a few in place to prevent unwanted bugs from emerging as a result of GIGO (garbage in, garbage out).

Relatedly, never underestimate the ability of your users to do something you didn't expect anyone would actually do. This is a lesson that many programmers never learn, no matter how many times it's taught, and sanity checks are an excellent tool to help you come to terms with it. "I'd never do that" is not a valid excuse for why your code didn't handle a problem, and good sanity checks can help prevent you from ever having to make that excuse.

查看更多
登录 后发表回答