Positive test cases and negative test cases

时光总嘲笑我的痴心妄想 提交于 2019-11-30 12:49:12

问题


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?


回答1:


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.




回答2:


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




回答3:


I dont know but I was somewhat dissatisfied with above answers. So here are my views upon this topic:

  1. Positive testing is the testing for something that should happen, does happen.
  2. Negative testing is the testing for something that should not happen, does not happen.

Lets have a scenario where we have two requirements: Requirements:

  1. A text box to enter some characters.
  2. A button to submit entered text to the server.
  3. A message to be displayed when number of characters is less than 5. "Less than 5 characters".
  4. A message to be displayed when server accepts text submitted. "Text accepted".

Now, a positive scenario would be:

  1. Enter "abcdef" in the text box.
  2. Click on submit button.
  3. "Text Accepted" must be displayed.

On the other hand, a negative scenario would be:

  1. Enter "abcd" in the text box.
  2. Click on submit button.
  3. "Text Accepted" must not be displayed.



回答4:


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

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

You don't determine the type of test by the results, but by the expected result based on the input.

Hope it makes sense, here's a good example http://osdir.com/ml/programming.software-qa/2004-12/msg00060.html




回答5:


Positive test cases we are using for checking some scenario like whatever scenario we are using for our code.

Negative test cases we are checking some specific scenario in negative way.

By the help of both we can increase code coverage.




回答6:


positive or negative is meaningless unless you put the requirement in the content. Let's say, one requirement is "the log in should fail if the user ID is not correct". I know it's bit counter-intuitive, a positive test is the type of test that will generate a failure in logging in, while the negative test will generate the result of successful log in.



来源:https://stackoverflow.com/questions/19355354/positive-test-cases-and-negative-test-cases

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!