Interview Question: How Would you Test a Software Component
You are given a software component that takes input from the user, performs some computation on it, and then outputs a response. What test cases would you create to verify this component is functional?
When approaching a question such as this, I always start by going to the white board and writing down the categories of test cases. For example: Positive cases, Negative cases, Security cases, Multithreading cases, Fault Tolerance/Environmental, and Performance.
Next a good interviewee will start asking the specifics of the input/output and how the component is used in relation to other components. From these details they should be able to derive the positive cases and negative cases.
Examples of security cases include: authentication and authorization, buffer overflows, integer overflows, string format bugs.
Examples of multithreading cases include: identifying/looking for shared resources, testing with multiple instances, asking about locking.
Examples of fault tolerance include: network hiccups, remote machines die, local machine is rebooted, started in wrong user context, issues in dependent components, hardware failures.
Examples of environmental issues: Environment variables, different behaviors from attached hardware, behavior changes from virtualization or other emulation systems, behavior when ran in nonstandard supported configurations.
Examples of performance include: tests for scale out and up, measuring execution times or memory/disk utilization as data size grows