Software testing method and device, electronic equipment and medium

By preconfiguring test data on electronic devices and using interface switches to control acquisition, the problem of uncontrollable factors of external servers is solved, and software testing efficiency and flexibility are improved.

CN119311593APending Publication Date: 2025-01-14CHINA PING AN LIFE INSURANCE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411531550.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

During the server's business software testing process, the acquisition of test data depends on the availability and stability of external servers, resulting in low testing efficiency and uncontrollable factors affecting the software testing process.

Method used

By preconfiguring the test data on the electronic device and controlling the data acquisition with the preset interface switch, we ensure that the test data is directly obtained and sent from the device when the preset conditions are met, reducing dependence on external servers.

Benefits of technology

It improves software testing efficiency, avoids delays and errors caused by uncontrollable factors of external servers, and enhances the flexibility and controllability of obtaining test data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311593A_ABST
    Figure CN119311593A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a software testing method and device, electronic equipment and a medium, and belongs to the technical field of software development. The method comprises: receiving a data acquisition request sent by a first server, the first server being configured with software to be tested, the data acquisition request being used for acquiring test data, and the test data being used for testing a function to be tested of the software to be tested; under the condition that the configuration information of the electronic equipment meets a preset condition, test data are obtained from the electronic equipment, the test data are pre-configured on the electronic equipment, the configuration information comprises configuration of a preset interface switch, and the preset interface switch is used for controlling whether the test data are obtained from the electronic equipment or not; and sending the test data to the first server. Thus, the software testing process of the first server is free from dependence on the external server, delay and errors caused by uncontrollable factors of the external server are avoided, and the efficiency of the software testing process is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software development, and in particular to a software testing method, device, electronic equipment and medium. Background Art

[0002] At present, during the business software testing process of the server, the testing process needs to obtain test data from other servers, such as payment process or real-name verification process. Whether these server systems are available, whether the operation is stable, whether the data samples are sufficient, and whether they can meet the current test conditions are all uncontrollable factors. These factors may affect other servers from feeding back test data to the business server (configured with the software to be tested), affecting the testing process of the software testing and resulting in low software testing efficiency. Summary of the invention

[0003] The main purpose of the embodiments of the present application is to provide a software testing method, device, electronic device and medium, aiming to improve the testing efficiency of the software to be tested on the business server.

[0004] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application provides a software testing method, characterized in that it is applied to an electronic device, and the method includes:

[0005] Receiving a data acquisition request sent by a first server, the first server being configured with the software to be tested, the data acquisition request being used to acquire test data, the test data being used to test a function to be tested of the software to be tested;

[0006] When the configuration information of the electronic device meets a preset condition, obtaining the test data from the electronic device, the test data being pre-configured on the electronic device, the configuration information including the configuration of a preset interface switch, the preset interface switch being used to control whether the test data is obtained from the electronic device;

[0007] The test data is sent to the first server.

[0008] In some embodiments, the data acquisition request includes an identifier of the second server, and the second server is configured to determine the test data based on a preset calculation strategy according to the data acquisition request;

[0009] When the configuration information of the electronic device meets a preset condition, acquiring the test data from the electronic device includes:

[0010] Determining a preset interface switch corresponding to the second server according to the second server identifier;

[0011] When the preset interface switch corresponding to the second server is configured to be turned on, determining that the configuration information of the electronic device meets a preset condition;

[0012] The test data is obtained from the electronic device.

[0013] In some implementations, the configuration information further includes an identifier of a target user, and the data acquisition request further includes an identifier of a first user;

[0014] The determining that the configuration information of the electronic device meets a preset condition when the preset interface switch corresponding to the second server is configured to be turned on includes:

[0015] When the preset interface switch corresponding to the second server is configured to be turned on and the first user identifier is the same as the identifier of the target user, it is determined that the configuration information of the electronic device meets the preset condition.

[0016] In some implementations, the data acquisition request includes a function identifier for characterizing the function to be tested, and a function parameter corresponding to the function to be tested;

[0017] After receiving the data acquisition request sent by the first server and before sending the test data to the first server, the method further includes:

[0018] If the configuration information of the electronic device does not meet the preset condition, forwarding the data acquisition request to a second server;

[0019] The test data fed back by the second server is received, where the test data is calculated by the second server according to the function identifier of the function to be tested and the function parameter corresponding to the function to be tested.

[0020] In some implementations, before receiving the data acquisition request sent by the first server, the method further includes:

[0021] A transfer instruction is sent to the first server so that the data acquisition request sent by the first server to the second server is transferred to the electronic device, and the second server is configured to determine test data based on a preset calculation strategy according to the data acquisition request.

[0022] In some implementations, the data acquisition request includes a function type identifier of the function to be tested, where the function type identifier is used to indicate whether the function to be tested is a regular function, and acquiring the test data from the electronic device includes:

[0023] In a case where the function type identifier indicates that the function to be tested is a regular function, determining, in the electronic device, preset data corresponding to the function to be tested as the test data;

[0024] In the case where the function type identifier indicates that the function to be tested is an unconventional function, the test data is determined based on a preset logic from a plurality of preset data in the electronic device according to the function type identifier.

[0025] In some implementations, after sending the test data to the first server, the method further includes:

[0026] A data storage instruction is sent to the first server, so that the first server updates the data acquisition record in the database according to the test data, and generates a data acquisition request for sending to other servers according to the data acquisition record.

[0027] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides a software testing device, characterized in that it is applied to an electronic device, and the device includes:

[0028] A receiving module, configured to receive a data acquisition request sent by a first server, the first server being configured with the software to be tested, the data acquisition request being used to acquire test data, the test data being used to test a function to be tested of the software to be tested;

[0029] an acquisition module, configured to acquire the test data from the electronic device if the configuration information of the electronic device meets a preset condition, the test data being pre-configured on the electronic device, the configuration information including the configuration of a preset interface switch, the preset interface switch being used to indicate whether the test data is acquired from the electronic device;

[0030] A sending module is used to send the test data to the first server.

[0031] To achieve the above objectives, the third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, the memory stores a computer program, and the processor implements the software testing method described in the first aspect when executing the computer program.

[0032] To achieve the above objectives, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the software testing method described in the first aspect is implemented.

[0033] The software testing method, device, electronic device and medium proposed in the present application, the test data is pre-configured on the electronic device, and when the first server issues a data acquisition request, the electronic device directly obtains the test data from its internal part and sends it to the first server if its configuration information meets the preset conditions. Specifically, the configuration information of the electronic device includes the configuration of the preset interface switch, and the preset interface switch is used to characterize whether the test data is obtained from the electronic device, making the test data acquisition process more flexible and controllable. In this way, by using the software testing method proposed in the present application, the software testing process of the first server is freed from dependence on the external server, avoiding delays and errors caused by uncontrollable factors of the external server, thereby improving the efficiency of the software testing process. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 It is a flowchart of a software testing method provided in an embodiment of the present application;

[0035] Figure 2 It is a flowchart of the process of obtaining test data provided by an embodiment of the present application;

[0036] Figure 3 It is a flowchart of the data transparent transmission process provided by the embodiment of the present application;

[0037] Figure 4 It is an interactive schematic diagram of the software testing method provided in the embodiment of the present application;

[0038] Figure 5 is a structural diagram of a software testing device provided in an embodiment of the present application;

[0039] Figure 6 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0041] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0043] First, some nouns involved in this application are analyzed:

[0044] Software Testing: Software testing is a systematic process designed to evaluate the quality, performance, and functionality of software applications. Its main goal is to find defects, errors, or areas that do not conform to expected behavior in the software, thereby ensuring that the software meets the required quality standards before release. The main contents of software testing include:

[0045] Verify functionality: Check that the software performs its functions as expected and meets user requirements and system specifications.

[0046] Performance testing: Evaluates software response time, stability, and resource usage under different load conditions.

[0047] Security Testing: Identify security vulnerabilities in software and ensure data protection and user privacy.

[0048] Compatibility testing: Verify that the software performs consistently across different devices, operating systems, and browsers.

[0049] User experience testing: Evaluate the usability and user satisfaction of the software interface.

[0050] Test Type:

[0051] Manual testing: Testers manually execute test cases and observe software behavior.

[0052] Automated testing: Use automation tools to perform testing to improve test efficiency and coverage.

[0053] Software testing helps to find problems early before software is released, reduce subsequent maintenance costs, improve user satisfaction, and ensure software quality. Through effective testing, organizations can provide more reliable products and enhance market competitiveness.

[0054] Server: A server is a computer system or device that is designed to provide services, resources, or data to other computers (usually called clients) for access over a network. Servers can run on a local network or on the Internet and perform different functions and tasks. The main features of a server are:

[0055] Services provided: Servers can provide various services, such as web hosting, file storage, database management, email processing, etc.

[0056] High performance: Usually configured with a powerful processor, large amount of memory and high-capacity storage to meet the concurrent access needs of multiple users.

[0057] Continuous operation: Servers are usually designed to run 24 / 7 to ensure service availability and reliability.

[0058] Centralized management: The server can centrally manage resources and data for easy maintenance and backup.

[0059] Common types:

[0060] Database server: manages the database and responds to client query requests.

[0061] File server: provides file storage and sharing services.

[0062] Application server: runs specific applications and provides services to clients.

[0063] Servers are key components in modern computing environments, centrally managing and providing resources so that users and other computers can access and process data efficiently.

[0064] At present, during the business software testing process of the server, the testing process needs to obtain test data from other servers, such as payment process or real-name verification process. Whether these server systems are available, whether the operation is stable, whether the data samples are sufficient, and whether they can meet the current test conditions are all uncontrollable factors. These factors may affect other servers from feeding back test data to the business server (configured with the software to be tested), affecting the testing process of the software testing and resulting in low software testing efficiency.

[0065] Based on this, the embodiments of the present application provide a software testing method, device, electronic device and medium, which aim to improve the testing efficiency of the software to be tested on the business server.

[0066] The software testing method, device, electronic device and medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the software testing method in the embodiments of the present application is described.

[0067] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0068] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0069] The software testing method provided in the embodiment of the present application relates to the field of software development technology. The software testing method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the software testing method, etc., but is not limited to the above forms.

[0070] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0071] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.

[0072] See also Figure 1 , Figure 1 It is a flowchart of a software testing method provided in an embodiment of the present application. In a first aspect, an embodiment of the present application provides a software testing method, including steps S110 to S130.

[0073] Step S110: receiving a data acquisition request sent by a first server, the first server being configured with the software to be tested, the data acquisition request being used to acquire test data, and the test data being used to test the function to be tested of the software to be tested.

[0074] First, the electronic device receives a data acquisition request sent by the first server, which is intended to obtain test data related to the software to be tested, especially specific data used to verify the function to be tested. This step is the starting point of the test process, ensuring that the first server can receive the required test data.

[0075] For example, the first server is a payment system of an e-commerce platform. At the beginning of the test, the first server sends a request: "Please provide test data for the payment function." This request may include necessary identification information to ensure that the electronic device can recognize and return correct test data, such as "obtain a simulated response of successful payment."

[0076] Step S120: When the configuration information of the electronic device meets the preset conditions, obtain test data from the electronic device, the test data is pre-configured on the electronic device, and the configuration information includes the configuration of the preset interface switch, and the preset interface switch is used to control whether the test data is obtained from the electronic device.

[0077] After receiving the data acquisition request, the electronic device first checks its own configuration information to determine whether the preset conditions are met. The preset conditions include the state (whether it is turned on) of the preset interface switch (the preset interface switch is used to control whether the test data is obtained from the electronic device), and may also include the operating state of the electronic device (such as whether the network connection is normal). When the preset conditions are met, the electronic device will extract the pre-configured test data from its internal storage.

[0078] For example, the electronic device checks its configuration information and finds that the preset interface switch is set to "on". The device then retrieves a preset data record from the local database, such as a simulated response of "payment successful". This record may include fields such as "status: success", "transaction ID: 12345", "amount: 100 yuan", etc., to ensure that the real payment scenario can be fully simulated.

[0079] Step S130: Send test data to the first server.

[0080] After obtaining the test data, the electronic device sends the data back to the first server through the network. This step ensures that the first server can receive the required test data so that it can continue to verify and test the software functions. This is a key link in the testing process and ensures the transmission and use of data.

[0081] Exemplarily, the electronic device encapsulates the test data containing the "payment successful" information into a request and sends it back to the first server via HTTP or other network protocols. After receiving the data, the first server starts to continue the subsequent payment function test. During the test, the first server checks whether the software can correctly update the order status, send a confirmation notification, and display it to the user based on the returned "payment successful" status.

[0082] Specifically, a mock platform can be configured in the electronic device to determine and return test data, playing the role of simulating a third-party server. The mock platform is a tool or system specifically used for software development and testing, mainly used to simulate the behavior of external services or components. It allows developers and testers to perform functional testing and integration testing in the absence of a real system or interface. The mock platform helps the team verify the logic and functionality of the software by providing virtual responses or data.

[0083] Through the above steps S110-S130, the test data is pre-configured on the electronic device. When the first server issues a data acquisition request, the electronic device directly obtains the test data from its internal part and sends it to the first server if its configuration information meets the preset conditions. Specifically, the configuration information of the electronic device includes the configuration of the preset interface switch, and the preset interface switch is used to characterize whether the test data is obtained from the electronic device, making the test data acquisition process more flexible and controllable. In this way, by using the electronic device proposed in the present application, the software testing process of the first server is freed from dependence on the external server, avoiding delays and errors caused by uncontrollable factors of the external server, thereby improving the efficiency of the software testing process.

[0084] See also Figure 2 , Figure 2 is a flowchart of a process for obtaining test data provided by an embodiment of the present application. In some embodiments, the data acquisition request includes an identifier of the second server, and the second server is configured to determine the test data based on a preset calculation strategy according to the data acquisition request;

[0085] When the configuration information of the electronic device meets the preset conditions, the test data is obtained from the electronic device, including:

[0086] Step S210: determining a preset interface switch corresponding to the second server according to the second server identifier;

[0087] Step S220: when the preset interface switch corresponding to the second server is configured to be turned on, determining that the configuration information of the electronic device meets the preset condition;

[0088] Step S230: Acquire test data from the electronic device.

[0089] In this embodiment, the data acquisition request was originally configured to be sent to the second server and obtain test data. The second server is responsible for determining appropriate test data according to the request and based on a preset calculation strategy. The electronic device receives the data acquisition request that was originally sent to the second server.

[0090] During the implementation process, when the configuration information of the electronic device meets the preset conditions, the device will start to obtain test data from itself. This process includes several key steps: First, according to the identifier of the second server (the identifier can be the domain name of the second server), the electronic device determines the preset interface switch corresponding to the server. Then, if it is found that the interface switch is configured to be turned on, the device will further confirm whether its own configuration information meets the preset conditions. Only when these conditions are met, the electronic device will obtain the corresponding test data from itself.

[0091] In this way, different third-party servers (second servers) correspond to different preset interface switches. Technical personnel can configure certain third-party servers in the electronic device as the preset interface switches are turned on, that is, the simulation function is turned on, and configure the identifiers and domain names of certain third-party servers in the electronic device as the preset interface switches are turned off, that is, the simulation function is turned off (the simulation function means that the electronic device simulates the third-party server and sends test data to the first server), making the testing process more flexible.

[0092] For example, a first server of an online payment system needs to obtain simulated payment success data from a second server with a domain name of "www.example.com". The first server sends a data acquisition request, which includes the identifier of "www.example.com". The second server, according to the pre-configuration, will apply its preset calculation strategy based on the received request and decide to return a "payment successful" response. The electronic device receives the data acquisition request that was originally sent to the second server. The electronic device checks that the preset interface switch of "www.example.com" has been set to on, and its other configuration information meets the preset conditions. Therefore, it obtains the "payment successful" test data from the inside and then sends it to the first server to ensure that the payment function test can proceed smoothly.

[0093] In some implementations, the configuration information further includes an identifier of a target user, and the data acquisition request further includes an identifier of a first user;

[0094] When the preset interface switch corresponding to the second server is configured to be turned on, determining that the configuration information of the electronic device meets the preset condition includes:

[0095] When the preset interface switch corresponding to the second server is configured to be turned on and the first user identifier is the same as the identifier of the target user, it is determined that the configuration information of the electronic device meets the preset condition.

[0096] In this embodiment, the configuration information of the electronic device also includes the identifier of the target user. When the first server sends a data acquisition request to the electronic device, the request will carry a first user identifier, and this first user can be the identifier of the tester who sends the data acquisition request. During the test process, the electronic device will first check whether the preset interface switch of the second server is configured to be turned on, and then further check whether the first user identifier in the request matches the target user identifier in the configuration information. Only when the interface switch is turned on and the first user identifier is the same as the target user identifier, the electronic device will confirm that its configuration information meets the preset conditions and allow the corresponding test data to be obtained.

[0097] In this way, it is ensured that only specific users can enable the simulation function and obtain test data from the electronic device. When the test process is performed by multiple testers, the electronic device can set some testers as target users and some testers not as target users, thereby enhancing the flexibility of the test process.

[0098] Exemplarily, the first server is testing the function of the payment system, and the first server sends a data acquisition request, which includes the identifier of user A. The target user is pre-configured as user A on the electronic device, and the interface switch corresponding to the second server has been configured to be on. The electronic device first checks the interface switch status to confirm that the switch is on; then, it checks the user identifier in the request and finds that it is consistent with the target user identifier (user A). Since both conditions are met, the electronic device determines that its configuration information meets the preset conditions, and then obtains the simulated test data of "payment successful" from the inside, and returns the data to the first server for payment function testing.

[0099] See also Figure 3 , Figure 3 is a flowchart of a data transparent transmission process provided by an embodiment of the present application. In some implementations, the data acquisition request includes a function identifier for characterizing the function to be tested, and a function parameter corresponding to the function to be tested;

[0100] After receiving the data acquisition request sent by the first server and before sending the test data to the first server, the method further includes:

[0101] Step S310: forwarding a data acquisition request to a second server when the configuration information of the electronic device does not meet a preset condition;

[0102] Step S320: receiving the test data fed back by the second server, where the test data is calculated by the second server according to the function identifier of the function to be tested and the function parameters corresponding to the function to be tested.

[0103] In this embodiment, the data acquisition request not only includes the request itself, but also includes a function identifier used to characterize the function to be tested and the function parameters corresponding to the function. After the first server sends the data acquisition request, the electronic device first checks its own configuration information. If the configuration information of the electronic device does not meet the preset conditions, it will not directly obtain the test data from the inside, but forward the request to the second server, that is, the simulation function is not enabled, and it only acts as an intermediary between the second server and the first server. The second server generates corresponding test data according to the function identifier and function parameters in the request through a preset calculation strategy. Then, the electronic device receives the test data fed back from the second server and sends it back to the first server, which is the data transparent transmission process.

[0104] In this way, it is ensured that when the configuration information of the electronic device does not meet the preset conditions, the first server can still obtain the required test data through the second server, thereby maintaining the continuity of the test; at the same time, different third-party servers (second servers) correspond to different preset interface switches, and technicians can configure certain third-party servers in the electronic device as the preset interface switches are turned on, that is, the simulation function is turned on, and configure the identifiers and domain names of certain third-party servers in the electronic device as the preset interface switches are turned off, that is, the simulation function is turned off (the simulation function means that the electronic device simulates the third-party server and sends test data to the first server), making the testing process more flexible.

[0105] Exemplarily, the first server is testing the refund function of a payment system, and the data acquisition request sent contains "refund processing" as a function identifier, and is accompanied by functional parameters such as refund amount and user ID. After receiving the request, the electronic device finds that its own configuration information (such as the status of the network connection or the preset interface switch) does not meet the preset conditions, so it cannot obtain test data locally. Therefore, the electronic device forwards the data acquisition request to the second server. After receiving the request, the second server generates corresponding "refund success" test data (for example, the status is success and the amount is 100 yuan) through the calculation strategy, and feeds this data back to the electronic device. Finally, the electronic device sends the test data obtained from the second server back to the first server to continue to complete the refund function test.

[0106] In some implementations, before receiving the data acquisition request sent by the first server, the method further includes:

[0107] A transfer instruction is sent to the first server so that the data acquisition request sent by the first server to the second server is transferred to the electronic device, and the second server is configured to determine test data based on a preset calculation strategy according to the data acquisition request.

[0108] In this embodiment, before the electronic device receives the data acquisition request sent by the first server, the electronic device first sends a transfer instruction to the first server. The electronic device can set an enable switch for the domain name of the second server. When this enable switch is turned on, the electronic device sends a transfer instruction to the first server. The purpose of the transfer instruction is to enable the first server to transfer the data acquisition request that was originally sent to the second server to the electronic device. The second server is configured to generate corresponding test data according to the received data acquisition request through a preset calculation strategy, that is, the second server is a third-party server from which the first server originally wanted to obtain test data.

[0109] In this way, the electronic device can effectively transfer the data acquisition request between the first server and the second server, that is, the transfer and sending of the data acquisition request can be achieved without the tester having to change the code of the software to be tested in the first server.

[0110] For example, during the test, the first server needs to obtain the test data of the payment function, but due to the instability of the external payment system (the second server), the first server sends a transfer instruction to the electronic device. This transfer instruction is actually simulating a DNS (Domain Name System) resolution function process (DNS will resolve the domain name into an IP address and communicate. If the resolution rules are configured in the Host file, the first server will use these rules for domain name resolution first). The transfer instruction sent by the electronic device is used to modify the Host file and redirect the request that should have been sent to the second server to itself; the Host file that redirects the request that should have been sent to the second server to the electronic device can also be pre-configured in the first server. In this case, the transfer instruction can also be used to make this Host file effective.

[0111] After receiving the transfer instruction, the first server sends the data acquisition request to the electronic device instead of the second server. After receiving the request, the electronic device forwards it to the second server, which applies its preset calculation strategy to generate corresponding test data based on the function identifier and function parameters of the request. Finally, the test data is returned to the electronic device, which then transmits it back to the first server, and the payment function test is carried out smoothly.

[0112] In some implementations, the data acquisition request includes a function type identifier of the function to be tested, where the function type identifier is used to indicate whether the function to be tested is a regular function. Acquiring test data from the electronic device includes:

[0113] In the case where the function type identifier indicates that the function to be tested is a conventional function, determining preset data corresponding to the function to be tested as test data in the electronic device;

[0114] When the function type identifier indicates that the function to be tested is a non-routine function, test data is determined based on a preset logic from a plurality of preset data in the electronic device according to the function type identifier.

[0115] In this embodiment, the data acquisition request includes a function type identifier of the function to be tested, which is used to indicate whether the function is a conventional function. According to the function type identifier, the electronic device obtains corresponding test data from the inside. If the function type identifier indicates that the function to be tested is a conventional function, the electronic device directly selects the test data corresponding to the function from the internal preset data. If the function type identifier indicates that the function to be tested is an unconventional function, the electronic device will select from a plurality of preset data based on a preset logic to determine suitable test data.

[0116] This ensures that the testing of regular and non-routine functions can flexibly respond to different data requirements.

[0117] For example, the payment system of the first server is being tested, and the first server sends a data acquisition request, in which the function type identifier indicates that the request is for the "payment processing" function. The system regards "payment processing" as a regular function, so the electronic device directly selects a standard "payment success" test data from the preset data and returns it to the first server.

[0118] In another test scenario, assume that the first server requests test data for the "refund processing" function, which is identified as an unconventional function. In this case, the electronic device cannot directly use a single preset data, but applies preset logic to select appropriate test data from different preset data based on multiple factors such as the refund amount, time, and user status. For example, the electronic device may select a specific "partial refund successful" state from multiple preset data to simulate a complex refund scenario.

[0119] In some implementations, after sending the test data to the first server, the method further includes:

[0120] A data storage instruction is sent to the first server, so that the first server updates the data acquisition record in the database according to the test data, and generates a data acquisition request for sending to other servers according to the data acquisition record.

[0121] In this embodiment, after sending the test data to the first server, the electronic device also sends a data storage instruction to the first server. The purpose of the instruction is to enable the first server to update the data acquisition record in its database according to the received test data. After the update is completed, the first server will generate a new data acquisition request based on these data acquisition records so as to send it to other servers for further processing. This process ensures that the storage of test data and the subsequent test processing process can form a closed loop, which helps to maintain the consistency and integrity of the data.

[0122] For example, in a test of an online payment system, the electronic device has successfully sent "payment successful" test data to the first server. Subsequently, the electronic device sends a data storage instruction to notify the first server to update the test data into the database to form a new data acquisition record, such as recording payment status, user ID, transaction ID and other information. After receiving the instruction, the first server updates its database and saves the record. Then, the first server generates a new data acquisition request based on this record, and prepares to send a request to another server (for example, a financial system) to update the financial data. In this way, the results of the payment test are not only recorded, but also can drive subsequent financial processing, ensuring the real-time synchronization and accuracy of the data in each part of the system during the test.

[0123] See also Figure 4 , Figure 4 It is an interactive schematic diagram of the software testing method provided in the embodiment of the present application. Combining the above-mentioned multiple implementation modes, the software testing method provided in the embodiment of the present application can be described as follows: when the enable switch set for the domain name of the second server 30 in the electronic device 20 is turned on, the electronic device 20 sends a transfer instruction to the first server 10 (step S410), so that the data acquisition request originally needed to be sent to the second server 30 by the first server is transferred to the electronic device 20 (step S420); when the enable switch is turned off, the first server 10 communicates normally with the second server 30.

[0124] After receiving the data acquisition request sent by the first server 10, the electronic device 20 determines whether the preset interface switch corresponding to the domain name of the second server is turned on. If the preset interface switch is turned on and the first user who sends the data acquisition request is the target user (that is, the configuration information of the electronic device meets the preset conditions), the test data is obtained locally and sent to the first server 10 (step S430) to complete the testing process.

[0125] When the configuration information of the electronic device does not meet the preset conditions, the electronic device 20 performs data transparent transmission, and the electronic device 20 forwards the data acquisition request to the second server 30 (step S440). The second server 30 returns the test data to the electronic device 20 (step S450), and the electronic device then forwards the test data to the first server 10 (step S460).

[0126] See also Figure 5 The embodiment of the present application further provides a software testing device 500, which can implement the above software testing method. The device 500 includes:

[0127] The receiving module 510 is used to receive a data acquisition request sent by the first server, the first server is configured with the software to be tested, the data acquisition request is used to obtain test data, and the test data is used to test the function to be tested of the software to be tested;

[0128] The acquisition module 520 is used to acquire test data from the electronic device when the configuration information of the electronic device meets the preset conditions. The test data is pre-configured on the electronic device. The configuration information includes the configuration of the preset interface switch. The preset interface switch is used to indicate whether the test data is acquired from the electronic device.

[0129] The sending module 530 is used to send test data to the first server.

[0130] The specific implementation of the software testing device is basically the same as the specific implementation of the above-mentioned software testing method, and will not be repeated here.

[0131] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above software testing method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0132] See also Figure 6 , Figure 6 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0133] The processor 601 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0134] The memory 602 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 602 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 602, and the processor 601 calls and executes the software testing method of the embodiment of this application;

[0135] Input / output interface 603, used to implement information input and output;

[0136] Communication interface 604, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WI FI, Bluetooth, etc.);

[0137] Bus 605 , which transmits information between various components of the device (e.g., processor 601 , memory 602 , input / output interface 603 , and communication interface 604 );

[0138] The processor 601 , the memory 602 , the input / output interface 603 and the communication interface 604 are connected to each other in communication within the device via a bus 605 .

[0139] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned software testing method is implemented.

[0140] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0141] The software testing method, device, electronic device and medium provided in the embodiments of the present application, the test data is pre-configured on the electronic device, and when the first server issues a data acquisition request, the electronic device directly obtains the test data from its internal part and sends it to the first server if its configuration information meets the preset conditions. Specifically, the configuration information of the electronic device includes the configuration of a preset interface switch, and the preset interface switch is used to characterize whether the test data is obtained from the electronic device, making the test data acquisition process more flexible and controllable. In this way, by using the electronic device proposed in the present application, the software testing process of the first server is freed from dependence on an external server, avoiding delays and errors caused by uncontrollable factors of the external server, thereby improving the efficiency of the software testing process.

[0142] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0143] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0144] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0145] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0146] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0147] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0148] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0149] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0150] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0151] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0152] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. A software testing method, characterized in that: Applied to electronic equipment, the method comprises: Receiving a data acquisition request sent by a first server, the first server being configured with the software to be tested, the data acquisition request being used to acquire test data, the test data being used to test a function to be tested of the software to be tested; When the configuration information of the electronic device meets a preset condition, obtaining the test data from the electronic device, the test data being pre-configured on the electronic device, the configuration information including the configuration of a preset interface switch, the preset interface switch being used to control whether the test data is obtained from the electronic device; The test data is sent to the first server.

2. The method according to claim 1, characterized in that The data acquisition request includes an identifier of a second server, and the second server is configured to determine test data based on a preset calculation strategy according to the data acquisition request; When the configuration information of the electronic device meets a preset condition, acquiring the test data from the electronic device includes: Determining a preset interface switch corresponding to the second server according to the second server identifier; When the preset interface switch corresponding to the second server is configured to be turned on, determining that the configuration information of the electronic device meets a preset condition; The test data is obtained from the electronic device.

3. The method according to claim 2, characterized in that The configuration information further includes an identifier of a target user, and the data acquisition request further includes an identifier of a first user; The determining that the configuration information of the electronic device meets a preset condition when the preset interface switch corresponding to the second server is configured to be turned on includes: When the preset interface switch corresponding to the second server is configured to be turned on and the first user identifier is the same as the identifier of the target user, it is determined that the configuration information of the electronic device meets the preset condition.

4. The method according to claim 1, characterized in that The data acquisition request includes a function identifier for representing the function to be tested, and a function parameter corresponding to the function to be tested; After receiving the data acquisition request sent by the first server and before sending the test data to the first server, the method further includes: If the configuration information of the electronic device does not meet the preset condition, forwarding the data acquisition request to a second server; The test data fed back by the second server is received, where the test data is calculated by the second server according to the function identifier of the function to be tested and the function parameter corresponding to the function to be tested.

5. The method according to claim 1, characterized in that Before receiving the data acquisition request sent by the first server, the method further includes: A transfer instruction is sent to the first server so that the data acquisition request sent by the first server to the second server is transferred to the electronic device, and the second server is configured to determine test data based on a preset calculation strategy according to the data acquisition request.

6. The method according to claim 1, characterized in that The data acquisition request includes a function type identifier of the function to be tested, where the function type identifier is used to indicate whether the function to be tested is a regular function. The acquiring the test data from the electronic device includes: In a case where the function type identifier indicates that the function to be tested is a regular function, determining, in the electronic device, preset data corresponding to the function to be tested as the test data; In the case where the function type identifier indicates that the function to be tested is a non-routine function, the test data is determined based on a preset logic from a plurality of preset data in the electronic device according to the function type identifier.

7. The method according to claim 1, characterized in that After sending the test data to the first server, the method further includes: A data storage instruction is sent to the first server, so that the first server updates the data acquisition record in the database according to the test data, and generates a data acquisition request for sending to other servers according to the data acquisition record.

8. A software testing device, characterized in that: Applied to electronic equipment, the device comprises: A receiving module, configured to receive a data acquisition request sent by a first server, the first server being configured with the software to be tested, the data acquisition request being used to acquire test data, the test data being used to test a function to be tested of the software to be tested; an acquisition module, configured to acquire the test data from the electronic device if the configuration information of the electronic device meets a preset condition, the test data being pre-configured on the electronic device, the configuration information including the configuration of a preset interface switch, the preset interface switch being used to indicate whether the test data is acquired from the electronic device; A sending module is used to send the test data to the first server.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the software testing method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the software testing method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Application test method, device, user terminal and system

    CN107342897A

  • Data processing method and device, electronic equipment and storage medium

    CN112363938A

  • Service test method, device and system, storage medium and electronic device

    CN112732572A