盒子
盒子
文章目录
  1. Test a real world object (like a pen)
  2. Test a piece of software
  3. Write test code for a function
  4. Troubleshoot an existing issue
  5. 符合要求的QA有下列标准:
    1. 1.Come up with a reasonable list of test cases
    2. 2.Big picture understanding
    3. 3.Knowing how the pieces fit togehter
    4. 4.Organization
    5. 5.Practicality
  6. Some Questions

How To Test

面试一般分四类:
(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

Test a real world object (like a pen)

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.

Test a piece of software

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
    updating controls
    removing controls
    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.

Write test code for a function

  • 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

  • normal cases:
    due to partitioning, input array might has odd or even numbers

  • extreme cases:
    empty array, small array, large array

  • nulls and “illegal” input:
    negative input

  • strange
    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

Troubleshoot an existing issue

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.

  1. Go to Windows Start menu
  2. Click on Chrome icon
  3. Browser instance starts
  4. Browser loads settings
  5. Browser issues HTTP request for homepage
  6. Browser gets HTTP response
  7. Browser parses webpage
  8. Browser displays content

Step 3: Create specific, Manageable tests
Give the customers instructions that they can or will do

符合要求的QA有下列标准:

(show you are a structured, methodical person)
Demonstrating these aspects will show that you will be a valuable member of the testing team.

  1. 需要能够提出 a reasonable list of test cases
  2. 需要有一个 Big Picture Understanding
  3. Understand hwo the pieces fit together
  4. Organization
  5. Practicality

1.Come up with a reasonable list of test cases

2.Big picture understanding

  • 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.

3.Knowing how the pieces fit togehter

  • 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
ecosystem.

4.Organization

  • 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.

5.Practicality

Your testing plans need to be feasible and realistic for a company to implement

Some Questions

12.1 Find the mistakes in the following code:

1
2
3
unsigned int i;
for (i = 100; i >= 0; --i)
printf("%d\n", 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 出问题的那一块

Cracking the coding interview, chapter 12
How to Report Bugs Effecitively

支持一下
扫一扫,支持forsigner
  • 微信扫一扫
  • 支付宝扫一扫