软件测试(software testing)细碎知识

目录

 

一、Basic knowledge and Unit Testing

二、Integration testing

三、System testing


一、Basic knowledge and Unit Testing

1. In unit testing. Why do we use the term System Under Test? Aren’t we testing Units? 

    在xUnit Test Patterns的官方文档中可以找到以下说明: "system under test". It is short for "whatever thing we are testing" and is always defined from the perspective of the test. When we are writing unit tests the system under test (SUT) is whatever class (a.k.a. CUT), object (a.k.a. OUT) or method(s) (a.k.a. MUT) we are testing; when we are writing customer tests, the SUT is probably the entire application (a.k.a. AUT) or at least a major subsystem of it. The parts of the application that we are notverifying in this particular test may still be involved as a depended-on component (DOC).

2. Weak-Strong和Normal-Robust关系的理解?

    https://blog.csdn.net/weixin_42569673/article/details/103427650

3. How many assertions in a test method? Is it OK to put multiple assert statements in one test statement? 

    It depends. If a test runs the exercise phase and then needs to check several items about the SUT, then it is OK to use several assert statements.

    Is a method trying to test too many things? e.g. one test checks if setup is successful and then checks if sending emails is successful. If it is, then avoid doing this – split into separate methods.

4. Access to Private Methods?

    Tools like JUnit are designed to access the public interface  In a good design, the protected and private methods are there to support the operations of the public interface Testing the public interface should also exercise the protected/private elements. 

    If you really need to test a protected and private method directly, there are tools that can be used to get access to the private method For protected, you can subclass the SUT and call the protected methods For the private methods, you can use some tricks to change the access modifier.

5. Test doubles and test driver module.

    Test Double: is used to simulate the modules that the SUT will interact with. These are typically used to process limited situations (‘pre-set data’)

     Test driver module: is used to exercise the SUT. It either receives data or loads tests. It runs those tests and collects the results. The results are then available for analysis.

                       

6. 4 kind of test doubles

Dummy: An object that is passed around but never used. Typically used to fulfill the parameter list of a method.

Stub: An object that always returns the same canned response. May also hold some dummy state.

Fake: An actual working implementation (not of production quality or configuration) that can replace the real implementation.

Mock: An object that represents a series of expectations and provides canned responses.

二、Integration testing

1. 需求活动与测试环节的对应,V-model。

                          

2. 集成方法

    Big bang: 将全部module链接在一起成一个system。可限制test doubles和drivers的个数,但很难辨别并隔离出错误所在处,同时没有验证mudule边界的interface。

    Top-Down: 包含深度优先和广度优先。

    Bottom-Up:  从底层依赖少的部分开始实现,然后顺着链接向上,通过driver来验证。相比Top-Down使用较少的test doubles。

    Mixed approach: Top-down和Bottom-up混合使用

三、System testing

1. Why system testing?

    Some properties only verifiable at system level

         Installation , usability, compatibility, etc.

    We may involve users at this level:

        Use cases may not map to any specific integration unit,

        Use of alpha and beta tests

    The environment of the system is taken into account

猜你喜欢

转载自blog.csdn.net/weixin_42569673/article/details/103442589