Functional Testing
I am going to list out all generic test cases for the following function signatures
(blackbox testing)
func(char*) // note not a const char* , eg : strlen
func(char* , char*) // eg: strcpy, strstr , strcp etc etc
func(int*) // eg: sort , find duplicates in an arr etc etc
func(char* s)
1. s == null
2. s == "" //not empty
3. very large strings (strlen > int_max, to check for interger overflows)
4. char* of nulls
5. non-null terminated (strange case...in c all strs are null terminated...terminating condition violated)
6. char* made of lower case chars only
7. char* made of upper case chars only
8. char* made of combo of upper/lower case chars
9. char* made of special chars
10. char* made of non-printable chars
11. char* made of numerals
12. char* made of numerals/chars
13. char* made of patterns like '\ n' (shouldnt be intepreted as \n)
how can func(char*) be implemented?
14. recursion (check for stack overflow)
15. check for manipulation of passed char* (can char* be modified as per reqs?)
16. pass read-only mem as char* (check for clean termination with proper err msgs)
security checks:
17. buffer overflow (pass very long strings and something else? ...need to fill in the blanks)
since char* can be interpreted as a pointer to any mem location, pass pointers to other datatypes
err msg checks (usability)
18. check for proper err msgs/codes
clean termination tests:
19. see how cleanly the function terminates
a. when err occurs
b. when there are no errs
performance tests:
20. memory footprint
21. resource usage (file desc? , io device usage, interrupts/signals?)
22. runtime characteristics ( big-Oh and worst case analysis)
23. system calls and context switches (why should anyone invoke sys calls in a func like strlen(), but still a valid test case. for eg, if u need to find strlen of a str that is 10^100 long, one might be tempted to use files for intermediate processing, and opening, reading and writing to files are sys calls even if u use fread/fwrite and fopen)
packaging
24. does the function depend on external libaries? are the libs statically bound. dynamically bound (perf issues)
25. protability (does it use code that doesnt compile in other archs)...not ok for generic lib calls like strlen
documentation
26. check for dumnetation (eg: check manpage for strlen)
Most test cases will repeat for func(char* s1 , char* s2)
1. s1 == null
2. s1 == ""
3. s2 == null
4. s2 == ""
5. s1 and s2 null
6. s1 and s2 ""
7. s1 >> s2 (s1 much longer than s2)
8. s2 >> s1 (s2 much longer than s1)
9. s1, s2 overlap (important case)
10. s1 == s2 (pointer wise)
11. s1 == s2 (content wise)
12. s1 subset of s2 content-wise
13. s2 subset of s1 content-wise
0 Comments:
Post a Comment
<< Home