分享

Types of Test Cases 2

 hildaway 2012-09-18

Writing Test Cases: Part 8 “Types of Test Cases: Positive & Negative Test Cases”

In our earlier post, we made discussion on two types of test cases “Formal and Informal Requirement Based Test Cases”. Now we shall discuss next two types of test cases “Positive and Negative Test Cases”.

Positive Test Case

A positive test case is when the test is designed to return what is expected according to the requirement.

Negative Test Case

A negative test case is when the test is designed to determine the response of the product outside of what is defined.

Explanation

Terms “negative test case” and “positive test case” are more of a concept than a strict activity. In both cases we are dealing with an “input”, an “action”, and an “output”. The action acts upon the input to obtain a certain output. So a good test case is just one that deals with those three things. Both test cases can generate errors and, in fact, some say that the success of a test case is based upon the probability of it finding new errors in an application.

Positive testing is a testing which attempts to show that a given module of an application does what it is supposed to do. Negative testing is a testing which attempts to show that the module does not do anything that it is supposed to do. So, by that logic, and to make a real example, an application delivering an error when it should is actually an example of a positive test. A negative test would be the program not delivering an error when it should or delivering an error when it should not. But this sounds like it is more based on what the application does during testing rather than how the tester is actually going about testing it.

Note: We do not determine the type of test by results, but by the expected results based on the input.

Example (positive and negative test case)

For an example, an application contains a textbox and as per the user’s requirements the textbox should accept only strings. By providing only string as input data to the textbox and to check whether it’s working properly or not means it is positive testing. If we give input other than string to the textbox means it is negative testing.

Positive Testing = (Not showing error when not supposed to) + (Showing error when supposed to)So if either of the situations in parentheses happens we have a positive test in terms of its result – not what the test was hoping to find. The application did what it was supposed to do. Here user tends to put all positive values according to requirements.

Negative Testing = (Showing error when not supposed to) + (Not showing error when supposed to). Here if either of the situations in parentheses happens we have a negative test in terms of its result – again, not what the test was hoping to find. The application did what it was not supposed to do. User tends to put negative values which may crash the application. For example in Registration Form, for Name field, user should be allowed to enter only alphabets. Here for Positive Testing, tester will enter only alphabets and application should run properly and should accept only alphabets. For Negative Testing, in the same case user tries to enter numbers, special characters and if the case is executed successfully, negative testing is successful.

In our forthcoming post we’ll discuss “Types of Test Cases: Functional and Non-functional Test Cases”.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多