Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Positive test cases and negative test cases

what are positive test cases and negative test cases?

Upon googling about it i have found answers that are very confusing. Can anyone explain with example?

like image 366
a Learner Avatar asked Oct 14 '13 07:10

a Learner


People also ask

Which of the following is an example of negative test case?

Use an invalid URL for a button link What if there is a typo in the URL? This is a clear example of a negative test case. To test, you would enter an invalid URL in the CMS for that button then save it.

What is positive and negative test cases in Junit?

A positive test is a test that verifies a correct functionality, a negative test verifies that a function will fail or throw an exception.


2 Answers

A positive test case tests that a system does what it is supposed to. Example: will allow you to login when valid credentials are supplied.

A negative test case tests that a system does not do things it shouldn't. Example: should not allow you to login when invalid credentials are supplied.

like image 173
Scott Helme Avatar answered Oct 21 '22 08:10

Scott Helme


Positive case is a case where the system validated against the valid input data

For example, consider a scenario where you want to test a application which contains a search field and requirements say that you should not enter special characters.

ID: 1

Name/Idea: Verifying that search field works with valid input

Precondition steps: "Search" screen should be opened

Steps to reproduce:

  1. Fill search field with valid information

  2. Tap on "Search" button

Expected result: The screen with results of search should be displayed

Positive/Negative: 1

Negative case is case where the system validated against the invalid input data. A negative test checks if a application behaves as expected with its negative inputs

For example, consider the same example which should accept only letters. So here provide the characters like “@,#,/” in the search field and check the behavior of application, either it should show a validation error message for all invalid inputs or system should not allow to enter special characters.

ID: 1

Name/Idea: Verifying that search field works with invalid input

Precondition steps: "Search" screen should be opened

Steps to reproduce:

  1. Fill search field with invalid information (e.g. @,#,/)

  2. Tap on "Search" button

Expected result: Pop-up with error message should appear

Positive/Negative: 0

like image 39
QArea Avatar answered Oct 21 '22 08:10

QArea