I am using django python framework for building web application. I am new to testing and i have lot of doubts. Consider my statements below and please let me know whether am i right or not? Consider i am reading a input called frequency in three ways
Read it from user through the website input field. Here i have to test the condition that frequency is invalid other than integer. Here is a chance of alter the field.
If it is read from a file, i also have to test invalid condition since there is a chance to alter the data in the file.
At last consider it read from a database ( data inserted from an other function, and it ensure the inserted data is integer). Here, should i check for the invalid condition? Is there any chance to alter the data in the table due to any attack or virus? Am i required test the invalid condition?
Edit : It is to mention that i am doing unit testing. Now i am testing functions which are not checked for any standard and guidelines for coding. So its my duty to do all checks.
consider two functions, function1 will read devicename & parameter from user through website and insert the data into device table (devicename, parameter & status), status is calculated by comparing the parameter value. status can be red, yellow or green. i am using mysql and all fields are varchar type. parameter should be an integer and hence i ensure it in func1 before inserting it to table.
The function2 just read the device table and display the devicename, parameter & status on another web page.
checklist for testing of func1 is
- checked whether the data entered and inserted are correct.
- Check whether the invalid param is not inserted to database.
- Check all branch conditions in calculating status
- check the response status
Checklist for func2
- check whether the data read and displayed on web page are correct.
- check the response status
- check whether the invalid parameter is not shown on web page. This condition will fail because func2 is not capable of handling invalid parameter since it is ensured in func1.
- check whether the invalid status is not shown on web page. This will also fail because func2 is not capable of handling the status other than red,yellow and green since status inserted by func1 and func1 is ensuring that status will be in valid range.
But doubt is that for func2, am i need to perform the checklists 3 & 4. Is it required test such a condition?