Lecture 6 - Classifying the Most Common Types of Testing -> Quick Intro -> By Knowledge Of The Internals Of The Software -> By The Object Of Testing -> By Time Of Test Execution -> By Positivism Of Test Scenarios -> By Degree Of Isolation Of Tested Components
– Positive testing
– Negative testing
Example
Let’s look at a simple scenario (don’t execute it, just read):
1. Go to www.sharelane.com.
2. Click the “Sign up” link.
3. Enter <some value> into the “ZIP code” text field.
4. Press the “Continue” button.
There are two types of data that the user can supply as <some value>. The first type of data is valid data; i.e., 5 digits. The second type of data is invalid data; i.e., anything other than 5 digits.
A new user registration can continue ONLY if the user provides a 5-digit ZIP code – in other words, if a user executes a normal, error-free scenario by submitting valid data.
But in reality, a user can make an error and supply invalid data for the ZIP code.
Example
The file checkout.py uses the function get_ccp_result() to get the success code of a credit card transaction: “0” is success; “1” is a failure. The function get_ccp_result() connects to the server of the credit card processor, sends out certain information, and once the success code is received, checkout.py makes a decision whether the checkout is complete or not.
Now, imagine the following situation: a user enters valid credit card info and that card has enough balance for transaction, but get_ccp_result() returns 1 instead of 0. This can happen by number of reasons. One of them is that the connection to the credit card processor server is down. So, we have a situation where there is no user fault and malfunction exists within the system.
Definitions:
Negative testing checks situations that involve
– User error and/or
– System failure
Positive testing checks situation where
– The software is used in a normal, error-free way and/or
– The system is assumed to be sound
Below are some important points:
1. As a rule, negative testing finds more bugs. There are two main reasons for this:
a. Errors and failures can take many shapes and forms, so the PM and the programmer might not predict some of them, and thus the code will not be ready to handle certain abnormal situations. Leo Tolstoy put it this way: “Happy families are all alike; every unhappy family is unhappy in its own way” – i.e., abnormalities have a great diversity.
b. When writing and developing features, it is natural to concentrate on the normal usage and normal functioning of the software because that’s how we provide value to our users. In other words, users don’t come to ShareLane to see error messages; they come to buy books: books can be bought only if
– the user executes an error-free scenario and
– our system is working normally.
2. Negative testing involves more creativity and puzzle-solving than positive testing. This happens for the same reason as above: errors and failures can take many shapes and forms.
3. Both negative and positive tests must be performed as a part of functional testing, but the rule is that we must execute positive tests first. Why? If functionality doesn’t work during normal usage, it doesn’t really make sense to check if it works with abnormal usage. It’s like checking to see if a corpse has chicken pox.
4. Error handling is:
a. How the system responds to errors made by users; e.g., how the system responds if a Web form is submitted with invalid data in a required field.
OR
b. How the system reacts to errors that happen when the software is running. For example, this error message: Test Portal>More Stuff>Python Errors>register_with_error.py provides info that the file register_with_error.py calls the undefined function get_firstpage().
5. Error message is a message that provides information about error(s).
An error message is an important measure that:
– Guides users in case of mistakes. An error message is usually delivered via a Web page by a code that is specifically written for handling user errors.
– Gives debugging info to developers. An error message is usually provided by an interpreter (or a compiler), or by some logging mechanism: e.g., the Apache Web server records errors in a special error log. Next ->
Lecture 6 - Classifying the Most Common Types of Testing -> Quick Intro -> By Knowledge Of The Internals Of The Software -> By The Object Of Testing -> By Time Of Test Execution -> By Positivism Of Test Scenarios -> By Degree Of Isolation Of Tested Components