Search code examples
unit-testingtdd

What is positive test and negative test in unit testing


I'm pretty new to TDD. I see some docs says about positive test, negative test, boundary test etc. Can any one tell me the difference between a positive test and negative test? Is there any reference out there that says about the different types of tests? (I'm not looking for books)


Solution

  • Positive Testing - testing the system by providing valid data.

    Negative Testing - testing the system by providing invalid data.

    For 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 & to check whether its working properly or not means it is Positive Testing. If giving the input other than String means it is negative Testing..

    Negative testing improves the testing coverage of your application. Using the negative and positive testing approaches together allows you to test your applications with any possible input data (both valid and invalid) and can help you make your application more stable and reliable.

    Refer this Glossary for different type of tests