Test development prepare for autumn recruitment interview 3

After working hard for so many years, looking back, it is almost all long setbacks and sufferings. For most people's life, smooth sailing is only occasional, and frustration, unbearable, anxiety and confusion are the main theme. We take the stage we did not choose, play the script we did not choose. Keep going!

Table of contents

1. Tell me about the difference between redis and mySQL?

2. Tell me about the difference between put/get/post?

3. Redis cache breakdown, cache penetration, cache avalanche?

4. HTTP common status code?

5. What are the usage scenarios of message queue?

6. What is the test case of like function in circle of friends?

7. How is the singleton mode implemented?

8. What is the process of DNS resolution?

9. How to judge the intersection of linked lists?

10. What is the testing process?

11. Test method?

12. Pay to design test cases?

13. Log design test cases?

14. How to judge whether the bug is front-end or back-end?

15. What are the basic data types of Python?

16. What is interface testing?

17. What are the postman request methods?

18. What is the difference between get and post?

19. Automated testing framework?

​20. What is the difference between a process and a thread?

21. Do you understand the json data, and what tools have you used to view it?


1. Tell me about the difference between redis and mySQL?

mysql is a relational database , which is mainly used to store persistent data. The data is stored in the hard disk, and the reading speed is relatively slow.
Redis is NOSQL , that is, a non-relational database , which stores data in the cache. The cache reads fast and can greatly improve operating efficiency, but the storage time is limited.

Mysql is used to store data persistently to the hard disk. It is powerful but slow. Based on disk, the read and write speed is not as fast as Redis, but it is not limited by the space capacity and is cost-effective.

Redis is used to store frequently used data in the cache. The reading speed is fast. Based on memory, the reading and writing speed is fast. It can also be persisted, but the memory space is limited. When the amount of data exceeds the memory space, the memory needs to be expanded, but RAM is expensive

Mysql and redis are generally used together because of different requirements.
Redis is used where high performance is required, and MySQL is used where high performance is not required. The stored data is synchronized between MySQL and Redis.


2. Tell me about the difference between put/get/post?

The most intuitive difference is that Getthe request contains parameters url, but the request Postby request bodypassing parameters
Getis an idempotent request. Generally, Getthe request is used in scenarios that do not affect server resources (such as requesting a web page resource); Postit is not an idempotent request. The request is generally used in scenarios that will affect server resources (such as registered users)

The most intuitive difference is that Getthe request includes the parameters in url, but Postby request bodypassing the parameters

  • PutThe request is to send data to the server to modify the content of the data, but it will not increase the type of data, etc., that is to say, no matter how many operations are performed, the result is not different, which can be regarded as updating data

  • PostAfter sending data to the server during the request, the request will change the type of data and other resources, and will create new content

3. Redis cache breakdown, cache penetration, cache avalanche?

① Cache penetration: A large number of requests for keys that do not exist at all, requests for resources that do not exist at all (DB itself does not exist, and Redis does not exist)

solution:

Use Bloom filter to cache null values 
​​(Use BitMap as a Bloom filter, put all currently accessible resources into the Bloom filter through a simple mapping relationship (hash calculation), when a request comes When using the Bloom filter, first judge the Bloom filter, if there is, then it will be released, otherwise it will be directly intercepted)
② Cache avalanche: a large number of keys in redis collectively expire

③ Cache breakdown: A hotspot key in redis expires (a large number of users access the hotspot key, but the hotspot key expires)

Cache avalanche and cache penetration solutions:

Set the hot words in advance, adjust the key duration,
adjust in real time, monitor which data is popular data, and adjust the key expiration time in real time.
Use the lock mechanism (when the hot key expires, use the lock mechanism to prevent a large number of requests from directly opening in DB)

4. HTTP common status code?

The following are common HTTP status codes:

  • 200 - Request succeeded
  • 301 - The resource (webpage, etc.) has been permanently moved to another URL
  • 404 - The requested resource (page, etc.) does not exist
  • 500 - Internal Server Error

5. What are the usage scenarios of message queue?

Four scenarios of asynchronous processing, application decoupling, traffic cutting and message communication.

Application decoupling: In a distributed system, different applications need to communicate with each other, but direct dependencies will lead to excessive code coupling. Using MQ as middleware allows for decoupling. Each application only needs to send messages to MQ without knowing the specific implementation details of other applications.

Traffic sales peak: use MQ as middleware to cache requests during the peak period into the queue, and process them one by one after the system load decreases. This avoids system crashes or slow responses.

Asynchronous call: The application sends a message to MQ without waiting for the processing result of the message, so as to realize asynchronous call. The processing result can be returned to the application through a callback function or other means.

Peak shaving and valley filling: use MQ as a cache, write requests into the queue and consume them at a certain rate, so as to avoid excessive pressure on the system caused by sudden requests. When the system load is low, the consumption of messages can be accelerated to "fill the valley" to ensure that all messages are consumed before the peak period.
 

6. What is the test case of like function in circle of friends?

Function test:
Normal: 1. Normal use of likes and cancellations 2. Whether the WeChat name is displayed normally at the bottom after the likes 3. The displayed name
disappears after the cancellation of the likes 4. Whether the display order of the names after the likes is in chronological order
5. Whether it supports multiple likes 6. The number of likes supported by a circle of friends
7. Whether to remind the users who have been liked after liking 8. Will the user be notified when the circle of friends that the user has liked is liked by WeChat
friends9 .After liking, it can be seen whether the group friends are visible, and whether others are invisible. 10. The same circle of friends is on the mobile phone and at the same time on the computer. 11. The display
order of the same circle of friends
is abnormal: 1. Disconnected 2. Low battery of mobile phone/computer
3. Abnormal server 4. Offline 5. Incoming call, text message 6.
Like the circle of friends that was just deleted Like 3. When a large number of users give likes concurrently, the response time of the interface, the maximum acceptable qps 4. When a large number of users give likes concurrently, the interface will give likes at this time, whether the like function is normal 5. After likes, the friend message Update speed Security test 1. After liking, you can see whether the group friends are visible or not. 2. Check the liking information when you are not logged in. 3. The content of the liking is illegal . 4. Liking a message with a virus . Ease of use test 1. Typesetting, buttons are normal, no typos 2. The interface is beautiful 3. The avatars of users who like them are displayed normally 4. How many avatars of users who like them are displayed at most




















5. How many users' avatars are displayed on a line of likes, and how many lines are displayed at most
6. The operation is simple and easy to understand

Compatibility
1. Different platforms: Windows, Mac
2. Different systems: Windows7, Windows10
3. Different mobile devices: Iphone.Andriod
4. Different regions
5. Different versions
 


7. How is the singleton mode implemented?

The singleton mode is divided into the hungry man mode and the lazy man mode. Only one instance is created in each class, and a global access point is provided to access this instance. The hungry man model is thread-safe, while the lazy man model is not thread-safe. Double detection locks need to be used to ensure thread safety. The specific Java code implementation is as follows:

/**
 * 单例模式:确保每个类只有一个实例,并提供全局访问点来访问这个实例
 */
//饿汉模式:线程安全
class Singleton1 {
    private static Singleton1 instance = new Singleton1() ;
    public Singleton1 getInstance(){
        return instance ;
    }
}
 
//懒汉模式:线程不安全,需要通过双重检查锁定机制控制
class Singleton2{
    private static Singleton2 instance2 = null ;
    public Singleton2 getInstance2(){
        if(instance2 == null){
            instance2 = new Singleton2() ;
        }
        return instance2 ;
    }
}
//使用双重检查锁的方式保重线程安全
class Singleton3{
    //使用双重检查进行初始化的实例必须使volatile关键字修饰
    private volatile static Singleton3 instance3 = null ;
    public Singleton3 getInstance3(){
        if(instance3 == null){
            synchronized (Singleton3.class){
                if(instance3 == null){
                    instance3 = new Singleton3();
                }
            }
        }
        return instance3 ;
    }
}
public class Main {
    public static void main(String[] args) {
        Singleton1 singleton1 = new Singleton1() ;
        Singleton1 singleton2 = new Singleton1() ;
        Singleton2 singleton21 = new Singleton2() ;
        Singleton2 singleton22 = new Singleton2() ;
        Singleton1 instance1 = singleton1.getInstance();
        Singleton1 instance2 = singleton2.getInstance();
        Singleton2 instance21 = singleton21.getInstance2();
        Singleton2 instance22 = singleton22.getInstance2();
        System.out.println(instance1 == instance2);
        System.out.println(instance21 == instance22);
    }
}


8. What is the process of DNS resolution?

The client will first send a DNS request, asking what is the IP of www.server.com, and send it to the local DNS server (that is, the DNS server address filled in the client's TCP/IP settings).
After the local domain name server receives the request from the client, if the table in the cache can find www.server.com, it returns the IP address directly. If not, the local DNS will ask its root domain name server: "Boss, can you tell me the IP address of www.server.com?" The root domain name server is the highest level, it is not directly used for domain name resolution, but it can specify a road.
After the root DNS receives the request from the local DNS, it finds that the suffix is ​​.com, and says: "The domain name www.server.com is managed by the .com area", I will give you the address of the top-level domain name server of .com, and you can ask ask it. After the local
DNS receives the address of the top-level domain name server, it initiates a request and asks, "Second child, can you tell me the IP address of www.server.com?" "
The top-level domain name server said: "I will give you the address of the authoritative DNS server responsible for the www.server.com area, and you should be able to ask it." The
local DNS then turned to ask the authoritative DNS server: "The third child, www.server What is the IP corresponding to .com? " server.com's authoritative DNS server, which is the original source of domain name resolution results. Why is it called authoritative? I am the master of my domain name. After the authoritative DNS server queries, it will
tell the corresponding IP address XXXX to the local DNS.
The local DNS will then The IP address is returned to the client, and the client establishes a connection with the target.
 


9. How to judge the intersection of linked lists?

First obtain the lengths lenListA and lenListB of the two linked lists respectively, and then use the fast and slow pointer method to let the longer linked list go N steps first, N=(lenListA-lenListB) absolute value. Then the two linked lists go at the same time until the nodes of the two linked lists are the same, and this node is the starting node where the two linked lists intersect.


10. What is the testing process?

Project approval (determining the project) ——> product specification (PRD) —> requirements document (requirement personnel) —> requirements review (development, testers, managers) —> development personnel (detailed outline design —> coding— —> Self-test —> Test) —> Tester conduct (test plan —> write test case —> test case review) —> smoke test (test whether the main process passes) —> functional test ——>ZenTao records bugs——>Regression testing (verify whether the problems in the previous version are resolved, and whether new problems appear)——>Acceptance testing (customers, managers, requirements, development, testers)——>Online


11. Test method?

1. From the perspective of whether you care about the internal structure

(1) White box testing: also known as structural testing or logic-driven testing, it is a testing method that designs test data and completes testing according to the internal logic structure and coding structure of the program.

(2) Black-box testing: also known as data-driven testing, the test object is regarded as an invisible black box. Without considering the internal structure and processing process of the program, the tester only considers the requirements specification of the program function to determine The correctness of test cases and inferred test results is a test conducted from the perspective of using software or programs, starting from the corresponding relationship between input data and output data.

(3) Gray box testing: It is a comprehensive testing method that combines "black box" testing and "white box" testing. It is based on the external performance of the program when it is running and combined with the internal logic structure to design use cases and execute the program. A testing technique that collects path execution information and external user interface results.

2. Judging from whether the code is executed

(1) Static testing: refers to checking the correctness of the program by analyzing or checking the syntax, structure, process, interface, etc. of the source program without running the program itself.

(2) Dynamic testing: It refers to checking the difference between the running results and the expected results by running the tested program, and analyzing performance indicators such as running efficiency, correctness and robustness.

3. From the perspective of the development process level

(1) Unit test: also known as module test, it is a test for the correctness of the smallest unit of software design - program module or function module. Its purpose is to check whether there are various errors in each module of the program, whether its functions can be correctly realized, and its performance and interface requirements are met.

(2) Integration test: also called assembly test or combination, it is a multi-level extension of unit test, and it is an orderly test based on unit test. It aims to test the interface relationship between software units, expect to find the problems existing between the interfaces of each software unit through testing, and finally compose the tested units into software that meets the design requirements.

(3) System test: It is a test activity for the integrated software and hardware system to judge whether the system meets the requirements. Combining equipment, some supporting software, personnel, data and other system elements together, a series of assembly tests and confirmation tests are carried out on the computer system in the actual operating environment.

4. From the point of view of whether manual intervention is required in the execution process

(1) Manual testing: testers manually input and execute one by one according to the test cases written in advance to cover the requirements of the software under test according to the test steps and methods described in the test outline, including interacting with the software under test (such as inputting test data, recording test results, etc.), and then observing the test results to see if there is a problem with the program under test, or whether there will be a problem during execution, which is a relatively primitive but necessary step.

(2) Automated testing: In fact, a large amount of repetitive testing work is handed over to the computer, usually by using automated testing tools to simulate manual testing steps, and executing a process written in a programming language (automatic testing is It means that in the process of automatic testing, the whole process of testing is automatically completed by the program without manual intervention; semi-automatic testing means that in the process of automatic testing, it is necessary to manually input test cases or select test paths, and then the automatic testing program follows the manually specified required to complete the automated test)

5. From the perspective of test implementation organization

(1) Development testing: testing performed by developers

(2) User testing: testing conducted by the user side

(3) Third-party testing: different from testing by developers or users, the testing is undertaken by a professional third party to ensure the objectivity of the testing work

6. From the environment of the test

(1) Alpha test: It is a test conducted by a user in the development environment, or it can be a test conducted by users within the company in a simulated actual operating environment

(2) Beta testing: typical end users in all aspects of the user company organization actually use the beta version in their daily work, and require users to report

7. Other test types

(1) Regression testing (regression testing) refers to the use case of repeating the test of the previous version when testing the new version of the software.

(2) Smoke testing (smoke testing) refers to verifying whether the basic functions of the software are realized and whether it is testable before conducting large-scale testing on a new version.

(3) Random testing means that all input data in the test is randomly generated, and its purpose is to simulate the real operation of the user and find some marginal errors.


12. Pay to design test cases?

Payment process:
1: Initiate a data recharge request normally, check points:
1) The information sent by the user has a key value
2) The local data of the merchant system will retain a copy of the user's order information, and will be based on each order information Generate a payment information (and save it locally)
3) The third-party payment is successful, and the third-party has stored payment order information
4) The recharge is successful, and the user's traffic balance has increased correspondingly

Abnormal use case
1. Modify the data sent by the user:
1) The product ID and value are not equal ----> check point: tamper with the data and key, check the merchant system and report an error: the key value is wrong or the user data is wrong. 
2) Cancel the recharge data  
3) Repeat the data recharge request

2. Between the merchant system and the third party:
1) The key is wrong - the third party reports an error and does not receive the key
2) Submit an order/payment order that does not exist in the merchant system -> the third party cannot pass the request here
3) Tampering The amount paid by the user --> the third party should also check

3. The third party - between users:
1) Wrong payment password/insufficient balance 
2) Cancel payment 
3) Duplicate payment [reconciliation ---> process refund]


refund process

Normal use cases:
1. The user initiates a refund ---> the user's order and payment order number must exist. ---Check point: Merchant system/third-party inspection data is no problem, the refund can be successful--->transaction status changed to refund

Abnormal use cases:
1: Initiate a refund without reason: Submit an order number or payment order number that does not exist ---> the order number does not exist/the payment order number does not exist 2: The information does not match and initiate a refund
: Submit the order number and payment order number Mismatched data ---> The order number/payment order number is wrong
3: The refund is greater than the actual amount: The submitted refund amount is greater than the actual payment order amount --> The merchant system will report an error
4: The merchant system sent it here Request: The refund amount is greater than the actual payment amount --> the third party should report an error


13. Log design test cases?

Features, security, performance, compatibility, interruptions, and more.


14. How to judge whether the bug is front-end or back-end?

Judgment method:

1. Packet capture tools are often used to check whether the front-end display is wrong or the data returned to the front-end by the back-end is wrong. Usually, the browser's own tools such as F12, fiddler, and httpwatch are all fine. Mainly analyze from three aspects: request interface, parameter passing, and response.

Check whether the URL of the request interface is correct. If it is wrong, it means that the front-end has passed it wrong. Similarly, if the parameters passed are wrong, it is also because of the front-end. If the URL and parameters are correct and the response is wrong, it is the back-end. If the back-end code makes an error, you can check the log, the data corresponding to the database, and the cache to specifically determine where the error occurred; in addition, remembering the meaning of common response status codes is also helpful for judging bugs.

2. Check the log

When a bug occurs, check the logs in the server. If there is no output in the log, it is basically considered that the function has not interacted with the backend, and it is not a backend bug; if there is output, check whether there is any relevant error log information for further analysis.

3. Check the database

Many bugs appear in the case of mutual calls of interfaces. You can judge which interfaces have problems by querying data in the database and comparing them. For example: add a piece of data in module A, but it is not displayed in module B. At this time, we can confirm by querying the data in the database that module A does not Insert data, or the B module is not queried. And if you know whether the interface is developed by the front end or the back end, you will know who should fix the bug.

4. Experience judgment

With a lot of usual experience, I have a deeper understanding of the function realization and interaction of front-end and back-end codes, and I can think about it in time afterwards, and I will naturally level up. The key is attitude and action.
 


15. What are the basic data types of Python?

There are 8 main data types in Python: number (number), string (string), list (list), tuple (tuple), dict (dictionary), set (set), Boolean (Boolean), None (empty) value).


16. What is interface testing?

Interface testing: it is a test method for testing the interface between system components. The
focus of interface testing: checking the exchange of data, the correctness of data transmission, and the logical dependency between interfaces.
The significance of interface testing: carried out earlier, in software development Simultaneously realize parallel testing, reduce in-depth problems of page layer testing, reduce development costs, and shorten the testing cycle of the entire project; get rid of the limitations of pages, conduct more comprehensive testing, and discover lower-level problems.


17. What are the postman request methods?

HTTP request method: HTTP 1.0 defines three request methods: GET / POST / HEAD HTTP 1.1 adds five request methods: OPTIONS / PUT / DELETE / TRACE / CONNECT Commonly used GET and POST two methods of request.


18. What is the difference between get and post?

Both POST and GET are basic methods of HTTP requests. The most intuitive difference is that GET includes parameters in the URL, and POST passes parameters through the request body.

1) GET requests are harmless when the browser refreshes or rolls back. If POST, the data will be resubmitted.

2) GET can exist in the cache. POST doesn't work.

3) The encoding format of GET can only use ASCII code, and there is no limit for POST.

4) Visibility parameters can be seen by users in the URL, and POST parameters will not be seen by users in REQUSET BODY. GET is relatively insecure and POST is relatively safe.

5) The parameter transmitted in the URL of the GET request has a length limit, but there is no POST.

6) When GET and POST are requesting:
6-1 GET is to send the hearder and data in the data to the server together, and return 200code
6-2 POST is to send the hearder to the server first and return 100continue, and then send data to the server , return 200
6-3 GET sent a TCP packet to the server and POST sent two TCP packets to the server
 


19. Automated testing framework?


20. What is the difference between a process and a thread?

Essential difference: Process is the basic unit of operating system resource allocation, while thread is the basic unit of processor task scheduling and execution.

Containment relationship: A process has at least one thread, and a thread is a part of a process, so a thread is also called a lightweight process or a lightweight process.

Resource overhead: each process has an independent address space, switching between processes will have a large overhead; threads can be regarded as lightweight processes, threads in the same process share the address space of the process, each thread Each has its own independent running stack and program counter, and the overhead of switching between threads is small.

Impact relationship: After a process crashes, other processes will not be affected in protected mode, but a thread crash may cause the entire process to be killed by the operating system, so multi-process is more robust than multi-thread.


21. Do you understand the json data, and what tools have you used to view it?

jsonView, which can also be viewed in other interface testing tools.

Guess you like

Origin blog.csdn.net/nuist_NJUPT/article/details/130094663