Mass properties of testability tactics

1. The first look of the concept of software testability

Be objective test of tactics is to allow the completion of an incremental software development, more easily test the software.

 

 

 


 

2. The purpose of testability

Software development, all are ultimately secondary sexual development in order to reduce costs as much as possible to ensure that the interests of, and simple testing purposes but also about aspects:

① in a given product as much as possible to find errors (or bug).

② demo a given software product to match with its requirements specification.

③ with minimal cost and effort to verify the quality of the software.

④ generate high-quality test cases, the implementation of effective test, and publish the correct and useful problem reports.


3. Can the importance of testing

Testing is important because software errors can be very costly and even dangerous, not a bug longer to be found, it may lead to greater risk. In addition, if the test team missed the accurate and detailed to capture and identify risks or software problems can cause some disaster occurs, you need to pay a high price to detect the bug, or so software vulnerabilities Bug may result in loss of money and personnel, too many examples in history, let's take a look at these classic stories.

April 2015, the London Bloomberg terminal downtime due to software vulnerabilities, resulting in more than 300,000 traders affected by the financial markets. Forcing the government to postpone the sale of 3 billion pounds of debt.

Nissan cars due to a software failure airbag sensing detectors, recalled more than 1 million cars. It is reported that due to software failure caused two accidents.

Starbucks coffee due to a software fault POS system can not handle the transaction, and therefore was forced to close about 60% of the stores in the US and Canada.

Amazon's third-party retailers see some of their products due to a software malfunction prices have all been reduced to 1 pound, resulting in heavy losses.


 4. How to improve testability

We learned design patterns, soft as workers, we all know that the five principles of coding: Single Responsibility Principle; open / closed principle; Richter substitution principle; the principle of separation of the interface; Dependency Inversion Principle. Especially the single responsibility principle, every function, object to complete the single responsibility. Only its main function calls, or mass participation. We testability will be greatly improved.

 1 interface UserOpr2 {
 2     boolean updatePassword(User user, String password);
 3     boolean updateUserInfo(User user);
 4 }
 5 
 6 class UserOprImpl2 implements UserOpr2 {
 7 
 8     @Override
 9     public boolean updatePassword(User user, String password) {
10         user.setPassword(password);
11         // update password
12         return true;
13     }
14 
15     @Override
16     public boolean updateUserInfo(User user) {
17         // update user info
18         return true;
19     }
20 }
View Code

So we have to change the password and change the name are treated as duty alone, change passwords, and change the name of functions are separate, like this is very clear, like what to call what is called logic clear. We testability will be greatly enhanced.

 

Guess you like

Origin www.cnblogs.com/liuxiaojieqqq/p/12411050.html