1 Purpose of software testing
The purpose of testing is to find out various potential errors and defects in the software with the least time and manpower, and prove that the function and performance of the software conform to the requirements. Glenford J.Myers once proposed the following viewpoints:
- The test is to prove that the program is wrong, not error-free
- A good test case finds errors that have hitherto gone undetected
- A successful test is one that finds errors that have hitherto gone undetected
The purpose of software testing often includes the following:
- Testing is not just about finding errors. By analyzing the causes and trends of errors, it can help project managers find defects in the current software development process for timely improvement
- Testing helps testers design targeted testing methods to improve the efficiency and effectiveness of testing
- Testing without finding bugs is also valuable, and complete testing is a way to assess software quality
2. Principles of software testing
- Software tests are falsified, not falsified
- Test your software early and often
- Pay attention to invalid data and unexpected tests
- Every test result should be thoroughly checked
- Test site protection and data filing
- Programmers should avoid checking their own programs
- Be aware of clustering in tests
- Use cases should be reviewed periodically
3 Software test classification
3.1 Divided by test phase
It can be divided into:
- Unit tests: Tests that verify that a small, specific feature of the code under test is correct
- Integration testing: Tests diagrams of dependent interfaces between modules that have been unit-tested
- Validation testing: Used to verify the effectiveness of software
- System testing: Testing the entire software system with computer hardware, peripherals, support software, data, personnel and other system elements
- Acceptance testing: A process in which end users participate in testing
3.2 Classification by execution state
It can be divided into:
- Dynamic testing: Run the program under test, check the difference between the results and the expected results, and analyze performance such as running efficiency and robustness. It consists of “constructing test instances, executing programs, and analyzing the output of programs.
- Static testing: the assembly of the method of characteristic analysis of the program under test, which means that the computer does not run the program under test, but analyzes and checks the program and documents, including walk check, symbol execution, requirement confirmation, etc
3.3 Division by test technology
It can be divided into:
- Black box testing: also known as functional testing or data-driven testing, testing the program as a can’t open the black box, not considering internal structure and characteristics of program for program interface test, check whether program function normal use according to the terms of the requirements specifications, whether the program can properly receive input data and produce output information correctly, and keep the integrity of the external information
- White box testing: also known as structure testing or logic driven testing, used to check the internal structure of the product and each path in the inspection program can work correctly according to the predetermined requirements
- Gray box test: between white box and black box test, mainly used to test whether the logical relationship between each component is correct, using pile drive to string together each function according to certain logic, to achieve the result output in the case of products without interface
Generally speaking, unit test adopts white box test method, integration test adopts gray box test method, and system test and confirmation test adopts black box test method. The comparison between black box test and white box test is as follows:
- Planning: Black-box testing is for functional testing, while white-box testing is for structural testing
- Nature: Black box testing is a confirmation (
Validation
), and white-box testing is a form of validation (Verification
) technology - Advantages: the advantages of black box testing from the perspective of the user, applicable to each stage of testing, from the Angle of the product function test, easy to generate test data, and the advantages of white box testing including procedures within a particular part for coverage testing, test data can make the part for test of specific programs, have certain sufficiency measurement method, can obtain more tools support
- Disadvantages: Black box testing defects including can’t test procedures within a particular part, some code without testing, if the specification error cannot be found, it is not easy for adequacy of testing, white-box testing defects including external characteristic can’t test procedures, often not easy to generate test data, not part of unrealized specification test, big workload are usually only used in unit testing
- Application scope: The application scope of black box test includes boundary analysis method, equivalence class division method, decision table test, and the application scope of white box test includes: statement coverage, decision coverage, condition coverage, path coverage, etc
3.4 Division by execution subject
It can be divided into:
Alpha
Testing: Also known as acceptance testing or developer testing, where developers and users work together to verify that the implementation of the software meets the requirements specified in the software design specification or software requirements specificationBeta
Testing: Often referred to as user testing, the evaluation of inspection software through heavy user use- Third party testing: also called independent testing, tests performed by a third party
4. Software testing model
Software testing model is used to guide the practice of software testing, and the common ones are:
The V model
W model
H model
X model
Front model
4.1 The V model
V model reflects the relationship between testing activities and development activities, indicates the different levels of testing process, and clearly describes the corresponding relationship between each stage of testing and each stage of development process.
- On the left is the development phase, which begins with defining software requirements, translating them into outline designs and detailed designs, and finally forming program code
- On the right is the testing phase: after the code is written, unit tests are followed by integration tests, system tests, and customer acceptance tests
4.2 W model
Compared with V model, W model adds the verification and validation activities that should be carried out simultaneously in each software development stage. W model emphasizes:
- Testing accompanies the entire software cycle
- The test object is not only the program, requirements, design to test
- Testing is synchronized with development
4.3 H model
H model completely independent test activities, test preparation activities and test execution activities clearly reflected, so that test preparation and test execution separated, conducive to resource allocation, reduce costs, improve efficiency.
4.4 X model
- Left: describes coding tests against individual pieces of program, followed by frequent handoff and integration into executable programs
- Right: the finished product that has passed the integration test is located at the top for sealing and presenting to the user, or as part of the larger scale and scope integration, and the exploratory test is located at the bottom
4.5 Pre-model
The pre-model tightly integrates testing and development with the following advantages:
- Combine development and testing
- Test each deliverable
- Keep acceptance testing and technical testing independent of each other
- Alternate development and testing
- Introduce new testing concepts
4.6 Test the characteristics of the model
The V model
: highlights several levels of testing that need to be experienced throughout the development of a software project, each corresponding to a development phase, but it does not specify that requirements, design, and testing should be performedW model
:The V model
It was supplemented with emphasis on test planning and other work in advance and heap system requirements and software design for testing, but alsoThe V model
Again, there are no specific procedures for software testingH model
: the performance of the test is independent, for each software test details, there is an independent operation process, as long as the test premise has, you can start to testX model
: Represents the process of test design, test backtracking, and helps experienced testers find software errors outside of the test planFront model
The pre-model tightly integrates testing and development, alternating execution over and over again
5 Test cases
5.1 define
A test case is a description of a test task for a specific software product. It embodies the test scheme, method, technology, and strategy, including:
- Test objectives
- The test environment
- The input data
- The expected results
- The test script
And so on, and finally form a document.
A test case has the following properties:
- Priority order
- targeted
- Scope of ownership
- periodic
- stateful
- timeliness
- Owner, date, and so on
5.2 Test case design method
Corresponding design methods can be divided into white box and black box test. For example, use case design of black box test can adopt:
- Equivalence division
- Causality diagram method
- Boundary value analysis
- User interface testing
- Configuration testing
- Verification of installation options
Etc. The design method of white box test cases is as follows:
- The test case design method with logical coverage structure is adopted
- Design method of domain test case based on program structure
- Design test cases based on object state or wait state changes
- Design test cases based on variations in program errors
- Test case design method based on algebraic operation symbol test
5.3 Misunderstandings in test case design
- The test case design is equal to the design of the test input data: determination of input data in the test case only a subset of the test case design, test case design also includes how to according to the test requirements, design, specifications and other documents design cases to the execution of the strategy, implementation steps, expected problems such as structure, organization and management form
- The more detailed the test case design, the better: writing too detailed test cases consumes a lot of resources, it is necessary to analyze the characteristics of the tested software, use effective test case design means, use as few test cases as possible, and meet the reasonable test coverage
- Pursuit of test case design “one pace reachs the designated position” : any software project development process in the changing process, the test may be found in the process of designing test cases to be thoughtless, need to improve, and it is also possible that the users of software function put forward requirements change, need to adjust the test case according to the software
- Mixing multiple test cases into a single use case: It’s easy to confuse a single test case with a lot of content, making test results difficult to document