软件测试 测试策略

Testing is a process of checking any software for its correctness. Various strategies are followed by the testers while checking for the bugs and errors in the software. Let us have a look at these strategies:

测试是检查任何软件的正确性的过程。 测试人员在检查软件中的错误和错误时会遵循各种策略。 让我们看一下这些策略:

(Statement Coverage)

The strategy here is to design test suites such that every statement of the software program is executed at least once. It is very important while testing software that every single of the program is executed because unless a statement is executed, we cannot determine whether it is error-free or not.

这里的策略是设计测试套件,以使软件程序的每个语句至少执行一次。 在测试软件时,必须执行程序的每一步,这一点非常重要,因为除非执行一条语句,否则我们无法确定它是否没有错误。

This type of thing should be taken at most care when there are conditional statements in the program (like if-else). The test cases should be chosen in such a way that every condition is fulfilled at least once in any of the test cases.

当程序中有条件语句时(例如if-else),这种事情应格外小心。 选择测试用例的方式应使任何一个测试用例中的每个条件至少满足一次。

(Branch Coverage)

Branch testing is also known as edge testing. In the branch coverage testing strategy, the test cases are designed in such a way that both valid and invalid values are checked for that particular branch or edge. Then, according to the test cases, the result of the branch statements is assumed for true or false.

分支测试也称为边缘测试。 在分支覆盖测试策略中,测试用例的设计方式是针对该特定分支或边缘检查有效值和无效值。 然后,根据测试用例,假设分支语句的结果为是或否。

It is a stronger testing strategy than the statement coverage testing strategy because it ensures statement coverage as well as ensures that each edge condition to assume true and false values in turn.

与语句覆盖率测试策略相比,它是一种更强大的测试策略,因为它可以确保语句覆盖率,并确保每个边缘条件依次采用真值和假值。

(Condition Coverage)

The condition testing strategy is a much more stringer strategy than both branch coverage and statement coverage strategies. In this technique of testing, the tester looks forward to reach every possible condition available in the program code. Now, with every condition fulfilled, comes another set of values that the particular block can have as an input. All these cases are covered in the condition coverage strategy of testing. Therefore, it assumes true and false values for every composite conditional expression, leading to a requirement of 2n test cases where n conditions are available in the program code. However, as the number of test cases in this strategy increases exponentially with the increase in the number of conditions available, it is suitable to perform this type of testing only for smaller values of n or can also be performed where the testing process is automated one.

与分支覆盖和语句覆盖策略相比,条件测试策略要严格得多。 在这种测试技术中,测试人员期待达到程序代码中可用的所有可能条件。 现在,在满足所有条件的情况下,出现了特定块可以具有作为输入的另一组值。 所有这些情况都包含在测试的条件覆盖策略中。 因此,它为每个复合条件表达式都假设为真和假值,从而导致需要2n个测试用例,其中程序代码中有n个条件可用。 但是,由于此策略中的测试用例数量随可用条件数量的增加呈指数增长,因此仅对较小的n值执行这种类型的测试是合适的,或者也可以在测试过程自动化的情况下执行。

(Path Coverage)

The path coverage strategy is based on the inter-dependency of the modules on each other. The output of one module can affect the processing of the other modules. Also, a single change in the output generated by initial modules may result in a complete change in the subsequent modules. Therefore, this type of testing strategy aims to cover all the linearly independent paths available in the program. However, this type of testing requires even more test cases than the condition coverage strategy when the number of linearly independent paths is high, but still is an effective way of thoroughly checking the software for any bugs.

路径覆盖策略基于模块之间的相互依赖性。 一个模块的输出会影响其他模块的处理。 同样,初始模块生成的输出中的单个更改可能会导致后续模块中的完整更改。 因此,这种测试策略旨在覆盖程序中所有可用的线性独立路径。 但是,当线性独立路径的数量很多时,这种类型的测试需要比条件覆盖策略更多的测试用例,但仍然是彻底检查软件中任何错误的有效方法。

翻译自: https://www.includehelp.com/basics/strategies-of-testing-software-engineering.aspx

软件测试 测试策略