Negative Test Cases for Functional Testing

by Nataliia Vasylyna | March 18, 2011 8:00 am

Negative testing is a testing technique when invalid input data are used for software quality assessment. Its purpose [1]is to check the software behavior in case of invalid input. In general, you check system stability by conducting negative tests. Also, this technique gives you an insight of error handling capabilities of the software.

Here we are going to present the most popular and useful negative tests for functional verification you should definitely include into QA activities[2].

Embedded Single Quote

Many SQL based applications have problems encountering embedded single quote as input data, e.g., Anna’s pencil. This happens because of SQL queries designation. So, a good testing practice would be to type embedded single quote to every field that refers to the database.

Required Data Entry

Checking fields a tester should always pay attention to whether it is marked as required for filling or not. The omission of the required fields should always provoke errors with an appropriate accompanying message.

Field Type

Different fields require appropriate data types, e.g., numbers, text, time, date, telephone numbers, etc). A tester should always try to enter an incompatible data type in the field and proceed to another step. The detailed information about fields and its compatible types can be found in the specification.

Field Size

Field Size is a maximum number of characters that can be entered into the field (e.g. the “First name” field should contain more than 40 characters). A user should not be able to type more or fewer characters than the amount defined in the specification. There could be different implementations of this limit in the system. It can be, for example, an error message after a user has already entered more characters that are specified or a prevention measure.

Numeric Bounds

Some numeric fields have evident bounds every tester should check. If the bounds are not so clear, you can use the specification. For example, let’s imagine that a field requires values from 1 to 10. Try to check boundary values as well as the next values beyond the bounds (0, 1, 10, 11). Often the results are quite unexpected.

Numeric Limits

Most commonly, numbers are saved inside the application code as integers or long integers. Check the boundary values of these number types even if there are no defined bounds in the specification. Common integer boundary values are -32,767 and 32,767 and for long integers -2147483648 and 2147483647.

Date Bounds

Testers should pay special attention to dates and consider the bounds appropriate to the field. For example, for the “Age” field try to enter values more than 150 and for the “Date of Birth” field enter the date from the future. Check whether there is an expected error message or the validation has successfully been passed.

Date validity

You definitely know that there are no such dates as the 31st of June or the 30th of February, though a user may type by mistake to the “Date” field. A tester should check all data fields with invalid data inputs as well as the valid ones from the leap years.

Web session testing

If you sign up and log in the application, you could enter your personal cabinet and see the content intended only for registered users. But what if you copy URL of such a page and paste it into another browser? What if you open it on another device without logging in? A tester should always check unauthorized access to the content intended for authorized users.

Performance changes

A tester should always check the performance of an application after software updates or other code changes. The result should be compared to the previous one received during testing of the old version. The purpose of such testing is to find out potential causes of performance[3] decreases which are caused by code changes.

Learn more from QATestLab

Related Posts:

Endnotes:
  1. purpose : https://blog.qatestlab.com/2014/12/24/what-is-the-purpose-of-negative-testing/
  2. QA activities: https://blog.qatestlab.com/2011/12/21/quality-assurance-activities-in-software-processes/
  3. performance: https://blog.qatestlab.com/2018/04/17/testing-system-bottlenecks/
  4. Useful Tips for Choosing a Test Automation Tool: https://blog.qatestlab.com/2011/06/08/useful-tips-for-choosing-a-test-automation-tool/
  5. Unit Testing SharePoint with TypeMock (Part I): https://blog.qatestlab.com/2011/03/17/unit-testing-sharepoint-with-typemock-part-i/
  6. Decoding the Science of Software Testing for Hardware: https://blog.qatestlab.com/2023/09/13/decoding-the-science-of-software-testing-for-hardware/

Source URL: https://blog.qatestlab.com/2011/03/18/top-10-negative-test-cases/