Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Let's say we have some requirements

  • Req1: User name will accept 6-10 character alpha value.

  • Req2: On click of Submit button, application will show error message "Please enter value or character between 6 to 10 including" for invalid boundary value.

In this case if we are designing test cases for invalid boundary values of 5 and 11, those would be positive test cases, since we are also verifying the error message, which is mentioned in requirement.

What would be negative test case for this scenario?

share|improve this question
    
If you are tested for having a desease, and the doctor tells you the diagnosis was positive, what do you think he means? –  Doc Brown Aug 25 '13 at 8:30
add comment

3 Answers

A "Negative Test" is testing that something that shouldn't happen, doesn't happen.

In this example, a negative test would be to enter an 8 characters password, and checking that said error message is not shown.

In automated testing context, negative tests are usually harder to write and provide less value than other positive tests - for instance, a test that an 8 characters password is accepted. Some strange cases that may pass the negative test here are:

  • A different error message
  • The system crashes and the forms go away, not displaying a message but not doing anything else either.

Alternatively, such a test will have to be re-written if the password requirements are hardened, like if the new rules require a special symbol - instead of only re-writing the "system accepts valid password", you also need to fix this case.

share|improve this answer
add comment

The phrase negative testing refers to the intent of the tester. It's testing that tries to break the system.

In your example it could be:

  1. Entering 1000s of characters into the password field to overflow a buffer
  2. Passing back a form where the password has been removed from the form
  3. Entering characters that are outside the normal character set

Found this definition of negative testing:

But another surprise is how little companies are doing in the way of “negative” testing. By this I mean testing that tries to break the system, validate fault and exception handlers or otherwise force the device in to an unusual state or "edge condition".

share|improve this answer
add comment

If negative testing is testing things outside the specifications or testing things outside the normal usage is just a question of definition (and then you may also hold the view that some operator errors are so common that they are part of the normal usage).

For about every concept, there are limit conditions which can be chosen either to be part or not of the concept, the important is to ensure that you have a consistent definition in your team, and to be aware when communication outside of your team that others may have chosen something else.

share|improve this answer
1  
how does this answer the question asked? –  gnat Aug 27 '13 at 18:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.