📅  最后修改于: 2020-12-04 05:48:57             🧑  作者: Mango
有多种方法可用于软件测试。本章简要介绍了可用的方法。
在不了解应用程序内部运作的情况下进行测试的技术称为黑盒测试。该测试仪无视系统架构,并且无法访问源代码。通常,在执行黑盒测试时,测试人员将通过提供输入和检查输出而与系统的用户界面进行交互,而不知道如何以及在何处处理输入。
下表列出了黑盒测试的优点和缺点。
Advantages | Disadvantages |
---|---|
Well suited and efficient for large code segments. | Limited coverage, since only a selected number of test scenarios is actually performed. |
Code access is not required. | Inefficient testing, due to the fact that the tester only has limited knowledge about an application. |
Clearly separates user’s perspective from the developer’s perspective through visibly defined roles. | Blind coverage, since the tester cannot target specific code segments or errorprone areas. |
Large numbers of moderately skilled testers can test the application with no knowledge of implementation, programming language, or operating systems. | The test cases are difficult to design. |
白盒测试是对内部逻辑和代码结构的详细研究。白盒测试也称为玻璃测试或开盒测试。为了在应用程序执行白盒测试,测试器需要知道代码的内部工作。
测试人员需要查看源代码内部,并找出代码的哪个单元/大块行为不当。
下表列出了白盒测试的优缺点。
Advantages | Disadvantages |
---|---|
As the tester has knowledge of the source code, it becomes very easy to find out which type of data can help in testing the application effectively. | Due to the fact that a skilled tester is needed to perform white-box testing, the costs are increased. |
It helps in optimizing the code. | Sometimes it is impossible to look into every nook and corner to find out hidden errors that may create problems, as many paths will go untested. |
Extra lines of code can be removed which can bring in hidden defects. | It is difficult to maintain white-box testing, as it requires specialized tools like code analyzers and debugging tools. |
Due to the tester’s knowledge about the code, maximum coverage is attained during test scenario writing. |
灰盒测试是一种在对应用程序的内部工作知识有限的情况下测试应用程序的技术。在软件测试中,短语越多,就越容易在测试应用程序时承担更大的压力。
精通系统的领域总是使测试人员在领域知识有限的人面前具有优势。与黑盒测试不同,黑盒测试仅测试应用程序的用户界面。在灰盒测试中,测试人员可以访问设计文档和数据库。有了这些知识,测试人员可以在制定测试计划时准备更好的测试数据和测试方案。
Advantages | Disadvantages |
---|---|
Offers combined benefits of black-box and white-box testing wherever possible. | Since the access to source code is not available, the ability to go over the code and test coverage is limited. |
Grey box testers don’t rely on the source code; instead they rely on interface definition and functional specifications. | The tests can be redundant if the software designer has already run a test case. |
Based on the limited information available, a grey-box tester can design excellent test scenarios especially around communication protocols and data type handling. | Testing every possible input stream is unrealistic because it would take an unreasonable amount of time; therefore, many program paths will go untested. |
The test is done from the point of view of the user and not the designer. |
下表列出了区分黑盒测试,灰盒测试和白盒测试的要点。
Black-Box Testing | Grey-Box Testing | White-Box Testing |
---|---|---|
The internal workings of an application need not be known. | The tester has limited knowledge of the internal workings of the application. | Tester has full knowledge of the internal workings of the application. |
Also known as closed-box testing, data-driven testing, or functional testing. | Also known as translucent testing, as the tester has limited knowledge of the insides of the application. | Also known as clear-box testing, structural testing, or code-based testing. |
Performed by end-users and also by testers and developers. | Performed by end-users and also by testers and developers. | Normally done by testers and developers. |
Testing is based on external expectations – Internal behavior of the application is unknown. | Testing is done on the basis of high-level database diagrams and data flow diagrams. | Internal workings are fully known and the tester can design test data accordingly. |
It is exhaustive and the least time-consuming. | Partly time-consuming and exhaustive. | The most exhaustive and time-consuming type of testing. |
Not suited for algorithm testing. | Not suited for algorithm testing. | Suited for algorithm testing. |
This can only be done by trial-and-error method. | Data domains and internal boundaries can be tested, if known. | Data domains and internal boundaries can be better tested. |