I am currently working on automation project along with another guy. He prepares a test case for the automation and I implement it. Here is my question, generally we use to write test cases for positive scenarios only. In Automation testing we try only positive test cases.

For a web application signup process, how many test cases can we write? As per our current scenario we are writing only one positive case(i.e.. successful signup). As per the industry standards, do we need to write a test cases for,

  1. Validating the required fields

  2. Validating the email validations

  3. validating the phone number

  4. etc.

  • 1
    So what is your question - do you need to write negative tests or how many tests you should write? – Embedded Jun 14 '16 at 8:11

Absolutely you need negative cases!
In fact developers will likely have focused on the positive cases so the negative cases not present can add the most value!

I recommend the following breakdown:

Happy, positive tests.
These test what happens when the user does everything right. They also used defaults as much as possible for input values

Sad, negative tests.
These are when the user messes up, usually through entering incorrect data or clicking on the wrong link or selecting the wrong option.

Option tests.
A creation of my own here. These tests exercise optional components that are not required in either happy or sad. For example adding multiple family members to an account. Option tests should also have both happy and sad paths!

how many test cases can we write?

Every time you ask that question, the answer will be "it depends". There is no industry standard or best practice that says, "You need 9 test cases" or "You need 1.4 times as many negative tests as positive tests."

If your business contract includes conditions around test cases, you should probably honor your contract. Otherwise, you need to figure it out for yourself.

Here are some guidelines:

  • Write the positive test cases first.
  • If a negative test case is hard to automate, it may not be worth automating.
  • If a negative test case is hard to automate, and the test case is important, there may be a way to change the product that makes testing easier.
  • Some negative test cases are more important than others. Every negative test case has an associated risk and likelihood. If the risk is low and the scenario is unlikely, it may not be important to test.

You can write test cases for both positive and negative scenarios.

For example;

phone number starts with a 0 phone number does Not contain "+"

What most people tend to do is to devise their negative tests to be a positive scenario. This way, each test that passes is in a True state. This makes it far easier to interpret the results of your runs.

The more you write, the more coverage you have. At some point, there will be a diminishing return where adding more doesn't add benefit for the work involved. This call is something that comes with experience as a tester and dialogue with other members of the team. Credit card payment has more risk, therefore more tests than a phone number field for example.

  • "What most people tend to do is to devise their negative tests to be a positive scenario. This way, each test that passes is in a True state." - this is the normal way of doing. I wonder how could it be done another way. – Embedded Jun 14 '16 at 11:37
  • that's a separate question to the one asked here, but one that has been posed before on SQA. If you raise a new question I would be happy to discuss! – ECiurleo Jun 14 '16 at 12:07

For testing the application positively you have only one scenario that is successful.But testing the application negatively you have number of scenarios depending on the validations on particular fields followed in your organization. we cant say how many test scenarios for negative testing.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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