1、软件测试入门中英www.mypm.cc1一:软件测试基础Part 1: Basics of Software Testing一:初识软件测试1. A First Look at Software Testing为什么需要软件测试?Why do we need to perform Software Testing?背景Background由于信息技术的飞速发展,使软件应用深入到各行各业。在残酷的竞争中,软件的质量自然而然成为了软件开发的重要目标和竞争的首要条件。质量差的软件产品,不仅增加了维护的费用,还可能由此导致风险,从而影响到开发商本身的利益。所以说,质量是重中之重。With the ra
2、pid development of information technologies, the software applications areapplied to various industries. As the competitions is becoming more and more drastic, thesoftware quality no doubt becomes the important objective of software development andthe primary condition of competitions. For a softwar
3、e product with poor quality, it needsmore maintenance cost, and may increase risk. This will affect the benefits of developer.Obviously, the quality becomes first.缺陷存在原因Reasons that defects exist1、交流不够、交流上有误解或者根本不进行交流Communications are insufficient, or thereare misunderstandings between the communic
4、ations, or no communication exists atall.2、软件复杂性The software is too complex.3、程序设计错误Perform the wrong programming.4、需求变化The requirements varied.5、时间压力 Be under the pressure of time.6、代码文档贫乏Be short of code documents.7、软件开发工具Wrong development tools are used.软件测试定义Definition of Software Testing软件测试是为了
5、发现错误而进行的一系列活动Software testing covers a series of activities performed in order to discover errors.测试是为了证明程序有错,而不是证明程序无错误The purpose of testing is to testify that there exist errors in the program, not to testifythat there exists no error in the program.测试并不仅仅是为了要找出错误。还改进了软件管理过程Not only to discover t
6、heerrors, also improve the process of software management.软件测试的复杂性与经济性Complexity and Economy of Software Testing不论是黑盒测试方法还是白盒测试方法,由于测试情况数量巨大,都不可能进行彻底的测试。Both Black Box software testing and White Box software testing can not performthorough testing due to the great quantities of testing cases.软件工程的总目
7、标是充分利用有限的人力和物力资源,高效率、高质量地完成测试。测试不足意味着让用户承担隐藏错误带来的危险,过度测试则会浪费许多宝贵的资源。The general objective of software engineering is to accomplish the high-efficiency andhigh-quality testing with limited workforce and materials resources. Insufficient testingwww.mypm.cc2means to make the customer undertake the haza
8、rd resulting from the hidden errors, andover-testing will waste many valuable resources.测试任是艰巨的, 不可能做到完成测试,那测试的目的是什么?何时可结束测试?The testing task is so arduous. It is impossible to accomplish the testing. Then what isthe purpose of testing? When can we close the testing?测试的最终目的是确保最终交给用户的产品的功能符合用户的需求,把尽可
9、能多的问题在产品交给用户之前发现并改正。The final purpose of testing is to ensure the final products delivered to customersmeet the demands of customers. Discover more problems as possible and fix them beforeyou deliver the products to customers.结束测试的考量Considerations on when to close the testing发现所有的漏洞时才停止测试是不可能的It is
10、impossible to stop testing when we findout all the defects.关键在于是否经济 The key is whether it is economic or not.-市场压力Pressure from the market-质量目标Quality objectives-客户要求Requirements of customers-费用约束Limit of cost-所有测试用例都得到执行All testing cases are performed.-没有严重问题存在,或是存在的风险不大No severe problem exists, or
11、 the risk is notsevere.总之应遵循的原则是:经济又足够好In brief, the principle you should follow is: economic and good enough.1、 Good-enough 原则就是一种权衡投入/产出比的原则:不充分的测试是不负责任的;过分的测试是一种资源的浪费,同样也是一种不负责任的表现。Good-enough is to measure theinput/output ratio: Insufficient testing is carefree; over testing will waste the resou
12、rces,and is also carefree.2、软件开发过程中应在早期就开展各种质量保证活动。Various quality assurance activitiesshould be performed in the early of software development procedures.3、在改错之后一定要马上重新测试,以免引入新的错误Redo the testing immediately after thefix, to avoid new error.4、在文档和代码的修改过程中,防止因为修改而带来新的错误(修改验证与回归测试)Duringthe course of
13、 doc and code modifications, you should prevent new error from themodification (modification, check and regression test).5、对每一个测试结果分析并进行记录,防止以后发生类似的错误 Analyze and record each ofthe testing results to avoid similar error later.需要纠正的偏见Prejudices needed to be corrected软件测试等于程序测试?Is software testing equ
14、al to program testing?什么人都可以做测试吗?Can anyone do the test work?人们常常以为,开发一个程序是困难的,测试一个程序则比较容易。这其实是误解。设计测试是一项细致并需要高度技巧的工作,稍有不慎就会顾此失彼,发生不应有的疏漏。It is considered that it is difficultto develop a program, but easy to test a program. Actually it is not. Design test? is a meticulous jobwww.mypm.cc3and needs p
15、rofessional skills. Or it will be out of control, and careless omission would happen.好的测试工程师应具备的素质是?Accomplishments that a good testing engineer should possess:1、沟通能力。Good communication skills2、移情能力。 Empathy ability3、技术能力。Professional skills4、自信心。Self-confidence5、幽默感。Sense of humor8、很强的记忆力。Better me
16、mory7、耐心和怀疑精神。Patience and suspicion9、洞察力。Insight一个好的测试工程师具有“测试是为了破坏”的观点,捕获用户观点的能力,强烈的质量追求,对细节的关注能力。应用的高风险区的判断能力以便将有限的测试针对重点环节。A good testing engineershould have the point of test is to destroy, the ability of capturing customers points, strong pursuit onthe quality and the ability of focusing on th
17、e details. He can judge the high risk of an application, to putthe limited testing on the important things.没有发现错误的测试是否有价值?Is it valuable if a test did not discover any error?结论:技术含量很高的工作Conclusion: it is a work with professional skills测试的是重要的,测试任是艰巨的, 不可能做到完成测试。Testing is important, and the testing
18、task isarduous. It is impossible to perform a complete testing.不论采用什么技术和什么方法,软件中仍然会有错。采用新的语言、先进的开发方式、完善的开发过程,可以减少错误的引入,但是不可能完全杜绝软件中的错误,这些引入的错误需要测试来找出。要使测试工作更加有效,更有针对性,花最少的代价满足用户要求,也是有规律可循的。There will be errorregardless of any technology and method are used. It can decrease the error when new languag
19、e,advanced development manner, improved development procedures are used, but it can not put an end tothe error. The errors needs to be found by testing. To make the testing have more efficiency andpertinency, to meet the demands of customers with least expense, we must find out the rules to befollow
20、ed.做好测试工作的第一步是什么?What is the first step to make good testing work?做何何事情都要讲究方法,测试也不例外! ?We should find a good method to do any work. Sodoes the testing.2、软件测试方法及分析Methods of Testing and Analysis主要方法有针对功能的黑盒测试和针对软件内部活动的白盒测试。Main methods: black box testingfor functions and white box testing for interna
21、l activities of software.黑盒测试 Black box testing白盒测试 White box testing另外,如果细分的话,测试分为静态和动态。静态测试指检查和审阅文档等;动态测试指真正运行和使用软件本身。In addition, it can be broken to static and dynamic testing. Static testing refers to checkand review the documents, etc. Dynamic testing refers to run and use the software itself.
22、动态测试方法要解决的问题?What are the problems to be resolved for dynamic testing一个成熟的动态测试方法必须回答如下问题:To find out a mature method for the dynamic testing, wemust answer the questions below:如何选择或产生测试数据?How to select or generate testing data?如何组织软件的测试运行?How to organize the testing run of the software?www.mypm.cc4如
23、何考察和记录软件动态运行的行为?How to check and record the dynamic running behaviors of thesoftware?如何判断软件动态行为的正确性?How to judge the validity of the dynamic running behaviors?测试过程何时结束?When to stop the testing process?如何通过软件测试结果分析软件性质?How to analysis the software nature through the testing results?哪些测试是动态测试?Which te
24、sts are dynamic tests?动态测试按测试的针对性又分为Dynamic tests can be classified as below according to the testingpurpose:1、功能测试Function test2、回归测试Regression test执行同样的测试,检查程序变更后是否存在问题,BUG 是否修复,修复是带来付面影响。Performa same testing. Check if there exists any problem, if the bug is fixed and if there is any negativeaffe
25、ct after the program is changed.3、压力测试Pressure test4、性能测试Performance test5、容错测试 Error Acceptance test6、稳定性测试Stability test7、可用性测试Availability test8、全球化测试Globalization test9、配置测试Configuration test, etc.等按软件生命周期的阶段,测试又可分为以下三类The testing can be classified into 3 categoriesaccording to the lifecycle of
26、software:1、单元测试Unit test2、集成测试 Integration test3、系统测试System test单元测试,集成测试,系统测试的区别?What is the difference between unit test, integration test, andsystem test?单元测试Unit Test单元测试的对象是软件设计的最小单位模块。对模块内所有重要的控制路径设计测试用例 Theobject of unit test is the smallest unit in the software design - module. For this test
27、, you should design testcase for all important control paths in a module.单元测试的任务包括: 1 模块接口测试; 2 模块局部数据结构测试;3 模块边界条件测试; 4 模块中所有独立执行通路测试; 5 模块的各条错误处理通路测试。The tasks of unit test include: 1 Test the module ports; 2 Test the partial data structure of themodule; 3 Test the module boundary condition; 4 Tes
28、t all separate execution paths in a module; 5 Testevery error process path in a module单元测试的作用:Functions of unit test:可以发现并修改掉修改代码带来的负面影响,如果这问题留到测试人到测试时发现?,成本成倍增长。Discover and fix the negative affect resulted from the code change. If such problem is discovered tilla tester find it?, the cost would in
29、crease doubly.单元测试的原则:Principle of unit test:1 先写测试代码,然后编写符合测试的代码?.至少要做到完成部分代码后,完成对应的测试代码?www.mypm.cc52 测试代码不需要覆盖所有的细节,但应该对所有主要的功能和可能出错的地方有相应的测试用例3 发现BUG,首先要编写对应的测试用例,然后进行调试4 不断总结出现BUG 的原因,对其他代码编写相应的测试用例5 每次编写完成代码,运行所有以前的测试用例,验证对以前代码的影响,把这种影响尽早消除6 不断维护测试代码,保证代码变动后通过所有测试1. Write the testing code firs
30、t, then write the code that coincides with the test. Finish thecorresponding testing code till finish at least partial code.?2. Testing code need not to override all details. But you should have the corresponding testcases for all key functions and matters that would be possibly wrong.3. When a bug
31、is discovered, you write corresponding test case first, then perform the debugoperation.4. Keep to make conclusions for the reasons that bug exist. And write the corresponding testcase for other codes.5. Every time you finish the code, you should run all the former test cases to verify the affect tothe former codes, in order to eliminate such affect as early as possible.6. Keep to maintain the test code. Ensure all tests pass after the code is changed.集成测试Integration Test每个模块都能单独工作,但这些模块集成在一起之后可能不能正常工作。主要原因是,模块相互调用时接口会引入许多新问题。Each module can work separately. But they may n
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1