Top 10 most popular negative test cases
Usage of test cases allows checking the productivity of developed software in case of incorrect data coming to the system or there is a wrong behavioral logic with components. Such test cases must be executed during general testing.
Any negative testing is important and equal to the positive one. That’s because all of us are people who can make a mistake. And you can’t get rid of the human factor.
If a client visits a special site and buys something there, he/she will probably want to visit such a portal again. But if the client makes a mistake while buying something (for example, pastes the phone number in the field where should be the letters only), then he/she will most likely want to see a tolerant system message that such an action isn’t recommended.
Detailed negative testing is performed for these exact situations. What is negative testing? It’s when incorrect data is deliberately inputted into a system. We enter it and watch on web product’s reaction, whether it shows correct error messages or not.
How should such tests be created?
Further, we’ll talk about top 10 most popular negative test scenario that can be used during the testing of any web product.
Embedded Single Quote
Many SQL-requests of the database have some problems with single quotes inside the request’s body (for example, Jones’s bar).
Required Data Entry
All fields for necessary data input should be clearly displayed in the specification of the developed product.
You need to test forms with different fields that should be compulsory and can’t be saved without information inside them.
Field Size Test
A maximal number of symbols in each field should be also written in the specification of the developed product (for example, the number of symbols in the field with user’s nickname shouldn’t be more than 45).
You must check if the component doesn’t allow inputting or saving more symbols that are mentioned inside the approved specification. Also, you shouldn’t forget that these fields have to work correctly and validate the input value as well as warn a client about set system limitations (for example, through texts or messages about an error).
Numeric Bounds Test
Some numeric fields can have special numeral bounds. Such limits can be directly in the specification of the developed product or be clear from the product logic (for example, you test productivity, that’s connected with an interest charge to client’s account; from this, it is clear that such an interest accrual shouldn’t take negative values).
Test the situations when the web product shows system messages about the errors in the cases when the input value is outside acceptable numeric bounds (for example, there always should be a text message about the error when the user entered the value from 9 to 51 symbols in the field where set limits are from 10 to 50, or he/she entered the negative value where the system allows using only positive symbols and their total).
Numeric Limits Test
More than a half of databases and programming languages consider numeral values as special variables with some type (for example, integer or long integer), which have a limit on acceptable numeral values input (for example, value integer should be between -32768 and 32767 but long integer – from -2147483640 to 2147483647).
Test the set border values of used variables for numeric fields whose border values aren’t determined in the specification.
Date Bounds Test
It happens that there is a special logical constraint for the fields that are responsible for entering and displaying the time and date inside the developed application. For example, if you check the field that contains the user’s date of birth, then it would be logical to test the possibility of prohibiting the entry of a date that has not come yet (in other words, the date in the future), or the restriction on entering a date that is different at the time of the test for more than 150 years.
The date entry field should always be validated for entering certain values (for example, entering 31-11-2009 – cannot be considered a valid date). You should also remember that the date field should be tested for leap years.
Web Session Testing
Most modern web products use special browser sessions to monitor the actions of a user who has been verified within the system. All this happens by using special settings for a specific user. At the same time, some of the system parameters can’t work until the client has passed the verification inside the system. Test that the current functionality of the product, which is “hidden” behind the password, is not available to the client, who hasn’t passed the verification yet.
After a new version of the product has been released, it is necessary to perform testing of components for overall productivity (for example, monitor the process of adding information, deleting data, or editing certain elements on a web page). Compare it with the productivity testing of previous web product versions. This practice will not only find all the current problems of the general program productivity but also help to predict possible changes in the program code for new builds of the developed software in the future.
Creating your own test for negative testing
For example, it is very interesting for us to understand how the function of calculating the root behaves in a simple calculator.
The very first thing that comes to mind: what will happen if you try to calculate the root of a negative value? What is there to think about?
- A root from zero – you need to remember the famous boundary values. The user can’t enter a line of negative length, unlike with boundary value;
- The root of the value “4” – similar characters can be divided into “conditional number”;
- We will try to enter a line that, naturally, means a number. And then take a number from it.
As you can see from this example, there can be an infinite number of tests.
By the way, you don’t need to enter a huge number as root, but simply enter an ordinary number so that the root comes out very, very long and doesn’t fit in the viewport of a PC or mobile device screen, then something should just break or simply go wrong.
QA engineers are able to provide you with all useful information on negative or any other testing type you are interested in. Running various kinds of tests, specialists of a quality assurance organization prevent the users from causing many software problems.