(1) Test a real world object, like a pen
(2) Test a peice of software
(3) Write test code for a function
(4) Troubleshoot an existing issue
Question: How would you test a paperclip?
Step 1: Who will use it? and why?
e.g. by teachers, to hold papers together
e.g. by artists, to bend into the shape of animal
Step 2: What are the use cases?
It will be useful for you to make a list of the use cases.
e.g. fastening paper together in a non-damaging (to the paper) way.
Step 3: What are the bounds of use?
e.g. holding up to thirty sheets of paper in a single usage without permanent damage (bending) and thirty to fifty sheets with minimal permanent bending.
e.g. The bounds also extend to environmental factors, should the paperclip work during very warm temperatures? What about extreme cold?
- Step 4: What are the stress/failures conditions?
Analyzing failure conditions needs to be part of your testing. Need to discuss with interviewer about when it’s acceptable or even neccessary for the product to fail, and what failure should mean.
e.g. testing the laundary machine, might decide the machine should handle at least 30 shirts or pants.
loading 30-45 pieces of clothing may result in minor failure, such as the clothing being inadequately cleaned.
at more than 45 pieces of clothing, extreme failure might be acceptable. (means the machine never turn on the water, not flood or a fire)
- Step 5: How would you perform the testing?
e.g. a chair can withstand normal usage for five years, define “normal usage” as how many “sits” per year on the seat? In addition to doing some manual testing, you would likely want a machine to automate some of the usage.
Manual V.S. Automated Testing
In an ideal world, we might love to automate everything, but that’s rarely feasible. Computer can generally recognize only issues that it’s been told to look for. Human observation may reveal new issues that havn’t been specifically examined.
Black Box Testing V.S. White Box Testing
This referes to the degree of access we have into the software.
In black box testing, we’re just given the software as-is and need to test it. With white box testing, we have additional programmatic access to test individual functions.
Step 1: Are we doing Black Box Testing or White Box Testing?
Check with your interviewer first.
Step 2: Who will use it? And why?
Software typically has one or more target users, and the features are designed with this in mind.
e.g. parental controls on a web browser, target users include
both parents (who are implementing the blocking)
and children (who are the recipients of blocking)
and guests (who should neither be implementing nor receiving blocking)
Step3 and Step4 should define the use cases.
- Step 3: What are the user cases?
e.g. use cases of the parents include
installing the software
their own personal internet usage
need to discuss with your interviewer.
- Step 4: What are the bounds of use?
figure out what exactly this means.
e.g. what does it mean for a website to be blocked?
– should just the “illegal” page be blocked
– or either the entire website?
– is the application supposed to “learn” what is bad content,
– or is it based on a white list or black list?
– if it is supposed to learn what inappropriate content is, what degree of false positives or false negatives is acceptable?
- Step 5: What are the stress conditions / failure conditions?
– when software fails – what should the failure look like ?
e.g. it should not crash the computer, instead, it’s likely that the software should just permit a blocked site, or ban an allowable site
Step 6 define the cases from 3 and 4, like how to perform the testing
what exact situations are you testing
Which of these steps can be automated?
which require human intervention
- Step 6: What are the test cases? How would you perform the testing?
pay attention to the manual test or automated testing, black box and white box testing.
- Validating input and output
Discuss any assumptions with your interviewer, particularly with respect
to how to specific situations.
Test function sort(int array) :
Step 1: Define the test cases
due to partitioning, input array might has odd or even numbers
empty array, small array, large array
nulls and “illegal” input:
passed an array already sorted
array sorted in reversed order
Step 2: Define the expected result
- the right output
- the original array is not changed, if return a copy of the array
Step 3: Write the test code
- some Junit code
How would you debug or troubleshoot an existing issue.
E.g. You are working on the Google Chrome tesam when you receive a bug report:
Chrome crashes on lauch. What would you do?
Approach these questions in a structured manner.
Step 1: Understand the Scenario
Ask questions to understand as much about the situation as possible
- How long has the user been experiencing this issue?
- What version of the browser is it? what is the operating system/
- Does the issue happen consistently, or how often does it happen? When does it happen?
- Is there an error report that launches?
Step 2: Break down the problem
Break down the problem into testable units.
- Go to Windows Start menu
- Click on Chrome icon
- Browser instance starts
- Browser loads settings
- Browser issues HTTP request for homepage
- Browser gets HTTP response
- Browser parses webpage
- Browser displays content
Step 3: Create specific, Manageable tests
Give the customers instructions that they can or will do
(show you are a structured, methodical person)
Demonstrating these aspects will show that you will be a valuable member of the testing team.
- 需要能够提出 a reasonable list of test cases
- 需要有一个 Big Picture Understanding
- Understand hwo the pieces fit together
- understand what the software is really about
- prioritize test cases properly
e.g. At Amazon
payments work reliably
products are added to the sipment queue
customers are never double charged
are more important than
product images appear in the right place.
although this is also very important.
- Do you understand hwo software works
- How it might fit into a greater ecosystem?
e.g. Test Google Spreedsheets
Besides test opening, saving, and editing documents.
you need to test integration with Gmail, with plug-ins
and other components because it is part of a larger
- Do you approach the problem in a structured manner?
- Do you just spout off anything that comes to your head?
e.g. Test the camera
The structured approach will help you to do a more thorough
job creating the test cases.
Good thinking: break down the parts into categories like Taking Photos, Image Management, Settings, and so on. Bad thinking: when asked to come up with test cases for a camera, will just state anything and everything that comes to their head.
Your testing plans need to be feasible and realistic for a company to implement
12.1 Find the mistakes in the following code:
unsigned int i;
for (i = 100; i >= 0; --i)
12.2 You are given the source to an application which crashes when it is run. After running it
ten times in a debugger, you find it never crashes in the same place. The application is single
threaded, and uses only the C standard library. What programming errors could be causing this crash?
How would you test each one?
12.3 We have the following method used in a chess game:
boolean canMoveTo(int x, int y).
This method is part of the Piece class and returns whether or not the piece can move to position(x, y).
Explain how you would test this method.
12.4 How would you load test a webpage without using any test tools?
12.5 How would you test a pen?
12.6 How would you test an ATM in a distributed banking system?
总结时间都花在哪里， Bug 都出在哪里
尽量narrow down 出问题的那一块