Software testing method and device

By obtaining input parameters and configuration parameters from the database, generating message templates and performing automated testing tasks, the problem of low software testing efficiency in the existing technology is solved, and efficient and accurate software testing is achieved, which is suitable for multiple business scenarios.

CN118939525APending Publication Date: 2024-11-12CHINA LIFE PROPERTY INSURANCE CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310534688.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-12
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

Existing software testing methods are inefficient and cannot generate enough business data in multiple business scenarios, resulting in low testing efficiency.

Method used

By obtaining the input parameters and configuration parameter information of the test case configuration from the database table, a message template is generated, and automated test tasks are performed based on the template to generate test reports, reducing the workload of manually assembling messages, and improving testing efficiency and accuracy .

Benefits of technology

It has achieved improvements in software testing efficiency and accuracy, reduced the workload of manually constructing test packets, and is suitable for different environments and business scenarios, providing high-efficiency and high-quality software engineering development guarantees.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939525A_ABST
    Figure CN118939525A_ABST
Patent Text Reader

Abstract

The invention discloses a software testing method and device, and relates to the technical field of computers. A specific embodiment of the method comprises the following steps: acquiring input parameters and configuration parameter information configured according to a test case from a database table; acquiring a corresponding message template according to the input parameter and the configuration parameter information; based on the message template, executing an automatic test task; and generating a test report according to a result of executing the automatic test task. According to the embodiment, the technical defect that in the prior art, a large number of test messages need to be manually constructed, and the workload is heavy is overcome, and the technical effects that the software test efficiency and accuracy are improved, and powerful guarantee is provided for high-efficiency and high-quality completion of software engineering development projects are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for software testing. Background Art

[0002] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0003] Software testing is an execution procedure whose purpose is to discover and correct errors in the software as much as possible and improve the quality of the software.

[0004] Currently, the mainstream of software functional testing is still manual functional testing. Its working principle is mainly to manually assemble test messages and send them through interface tools, verify whether the returned information is correct and whether the data is entered into the database correctly, and manually record the test results.

[0005] The existing technology still has the following technical defects:

[0006] 1. The working principle of the existing automated testing is to imitate manual testing and perform interface testing by manually assembling messages. Therefore, the existing technology cannot avoid the problem of generating enough business data in multi-business scenario testing.

[0007] 2. During the testing process, the system functions and impact scope of the test need to be manually confirmed, so the testing efficiency is low. Summary of the invention

[0008] In view of this, the embodiments of the present invention provide a method and apparatus for software testing, which can achieve the technical effect of improving software testing efficiency and accuracy and providing a strong guarantee for the efficient and high-quality completion of software engineering development projects.

[0009] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for software testing is provided, comprising:

[0010] Get the input parameters and configuration parameter information configured according to the test case from the database table;

[0011] According to the input parameters and configuration parameter information, obtain the corresponding message template;

[0012] Based on the message template, execute the automated testing task;

[0013] Generate a test report based on the results of executing the automated test task.

[0014] Optionally, based on the message template, executing an automated test task includes:

[0015] Based on the message template, generate a test case;

[0016] According to the test case, an automatic test task is performed on the software to be tested.

[0017] Optionally, generating a test case based on the message template includes:

[0018] According to the message template, obtain keyword parameters;

[0019] According to the keyword parameters, matching the software to be tested;

[0020] Fill the message according to the software to be tested and the keyword parameters;

[0021] The filled message is used as the test case.

[0022] Optionally, the message template includes parameter default values;

[0023] Based on the message template, a test case is generated, including:

[0024] Fill the parameter default values ​​into the message template to generate the test case.

[0025] Optionally, the keyword parameter package includes at least one of the following: project code, docking plan code, docking number, group order identifier, main terms, and treaty information.

[0026] Optionally, a test report is generated according to the result of executing the automated test task, including:

[0027] Counting the probability of success or failure of executing the automated test task according to different test cases;

[0028] Add the stated probabilities to the test report.

[0029] Optionally, before counting the probability of success or failure of executing the automated test task according to different test cases, the method includes:

[0030] Determining whether the test result is within an expected range;

[0031] If yes, determining the test result as successful;

[0032] If not, the test result is determined to be a failure.

[0033] Optionally, before counting the probability of success or failure of executing the automated test task according to different test cases, the method includes:

[0034] Determining whether the test result matches the expected result;

[0035] If yes, determining the test result as successful;

[0036] If not, the test result is determined to be a failure.

[0037] According to another aspect of an embodiment of the present invention, there is provided a software testing apparatus, comprising:

[0038] An information acquisition module is used to obtain input parameters and configuration parameter information configured according to the test case from a database table;

[0039] A message template acquisition module, used to acquire the corresponding message template according to the input parameters and configuration parameter information;

[0040] A task execution module, used to execute automated test tasks based on the message template;

[0041] The report generation module is used to generate a test report according to the result of executing the automated test task.

[0042] According to another aspect of an embodiment of the present invention, there is provided an electronic device for software testing, comprising:

[0043] one or more processors;

[0044] a storage device for storing one or more programs,

[0045] When the one or more programs are executed by the one or more processors, the one or more processors implement the software testing method provided by the present invention.

[0046] One embodiment of the above invention has the following advantages or beneficial effects:

[0047] The present invention provides a method for software testing, which solves the technical defect of the prior art that a large number of test messages need to be manually constructed, which is a heavy workload, thereby achieving the technical effect of improving software testing efficiency and accuracy and providing a strong guarantee for the efficient and high-quality completion of software engineering development projects.

[0048] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0050] Figure 1 is a schematic diagram of the main process of a software testing method according to an embodiment of the present invention;

[0051] Figure 2is a schematic diagram of a main process of generating a test case according to an embodiment of the present invention;

[0052] Figure 3 is a schematic diagram of main modules of a software testing device according to an embodiment of the present invention;

[0053] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0054] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0055] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0056] Figure 1 is a schematic diagram of the main flow of a software testing method according to an embodiment of the present invention, such as Figure 1 As shown, a software testing method includes:

[0057] Step S101, obtaining input parameters and configuration parameter information configured according to the test case from a database table;

[0058] Step S102: Obtain a corresponding message template according to the input parameters and configuration parameter information;

[0059] Step S103: Execute an automated test task based on the message template;

[0060] Step S104: Generate a test report based on the result of executing the automated test task.

[0061] Data used to input into the software for testing. Configuration parameters refer to the parameters of the software itself, which make the software suitable for different environments through configuration / default values.

[0062] Messages are data modules exchanged and transmitted in the network. For each message, there is a corresponding template, which is the initialization / default message data.

[0063] By completing the configuration of various parameters and messages, the task of automated testing can be achieved.

[0064] In an optional embodiment of the present application, based on the message template, performing an automated test task specifically includes:

[0065] Based on the message template, generate a test case;

[0066] According to the test case, an automatic test task is performed on the software to be tested.

[0067] The number of groups of the test cases includes but is not limited to one, that is, according to different environments to be tested, testing of different environments can be implemented.

[0068] Figure 2 is a schematic diagram of a main process of generating a test case according to an embodiment of the present invention; Figure 2 As shown, based on the message template, a test case is generated, including:

[0069] S201, obtaining keyword parameters according to the message template;

[0070] S202, matching the software to be tested according to the keyword parameters;

[0071] S203, filling the message according to the software to be tested and the keyword parameter;

[0072] S204: Use the filled message as the test case.

[0073] In fact, through the selection of key parameters, the appropriate template can be matched for message assembly, and the fields of the interface message can be automatically filled, thereby achieving the technical effect of rapid filling.

[0074] Optionally, through preset automated execution settings, automated use cases of transaction scenarios are executed to obtain transaction scenario data.

[0075] The present invention reduces the workload of manual assembly of various messages when testers perform interface testing, and also helps the execution of pre-data for various business scenarios. When performing business testing, data preparation can be separated from the scenario testing process, which speeds up the testing process and reduces a lot of repetitive work, and also provides great assistance for business automation testing.

[0076] Optionally, the message template includes parameter default values;

[0077] Based on the message template, a test case is generated, including:

[0078] Fill the parameter default values ​​into the message template to generate the test case.

[0079] In fact, the generation of test cases requires the determination of appropriate test scenarios. In other words, the test process is to adapt different test cases according to different scenarios, and then get different results.

[0080] Optionally, before generating a test case, keyword parameters need to be determined, including at least one of the following: project code, docking solution code, docking number, group order identifier, main clause, and treaty information.

[0081] Optionally, a test report is generated according to the result of executing the automated test task, including:

[0082] Counting the probability of success or failure of executing the automated test task according to different test cases;

[0083] Add the stated probabilities to the test report.

[0084] In fact, the test report can also include other content, such as the reasons for the failure of the analysis results.

[0085] Optionally, before counting the probability of success or failure of executing the automated test task according to different test cases, the method includes:

[0086] Determining whether the test result is within an expected range;

[0087] If yes, determining the test result as successful;

[0088] If not, the test result is determined to be a failure.

[0089] Optionally, before counting the probability of success or failure of executing the automated test task according to different test cases, the following method may be further included:

[0090] Determining whether the test result matches the expected result;

[0091] If yes, determining the test result as successful;

[0092] If not, the test result is determined to be a failure.

[0093] Specifically, the output obtained by sending the interface message is compared with the expected output to obtain the test result, so as to achieve the technical effect of automatically constructing the interface message of the test scenario, greatly improving the test efficiency and responding to rapidly changing functional tests more quickly.

[0094] The above two methods for determining whether the test results are correct can be used separately, or both methods can be used at the same time to determine whether the test is successful by setting weights.

[0095] The test cases generated by this solution can be used for interface automation testing as well as for test data construction in different scenarios. This enables automatic construction of test scenario data, facilitates testing of different business test scenarios, and greatly improves test efficiency.

[0096] The optional embodiment of the present invention can also design corresponding business transaction test cases through actual scenarios of production transactions. Specifically, according to the interface documents and business rules, the interface messages of the transaction scenarios are generated by automatically executing scripts. In the test process, the configurable scripts are used to generate transaction data of different scenarios for data problems in different transaction scenarios. The transaction data is then used to achieve the technical effect of rapid scenario reproduction and problem reproduction. The test efficiency is improved and the rapid function iteration can be better coped with.

[0097] Figure 4 An exemplary system architecture 400 is shown to which the software testing method or software testing apparatus according to the embodiment of the present invention can be applied.

[0098] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0099] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0100] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0101] The server 405 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 401, 402, and 403. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.

[0102] It should be noted that the software testing method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the software testing device is generally disposed in the server 405 .

[0103] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0104] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0105] like Figure 5 As shown, the computer system 500 includes a central processing module (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0106] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.

[0107] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing module (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.

[0108] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0109] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0110] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes a sending module, an acquisition module, a determination module, and a first processing module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the sending module may also be described as a "module for sending a picture acquisition request to the connected server."

[0111] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0112] Get the input parameters and configuration parameter information configured according to the test case from the database table;

[0113] According to the input parameters and configuration parameter information, obtain the corresponding message template;

[0114] Based on the message template, execute the automated testing task;

[0115] Generate a test report based on the results of executing the automated test task.

[0116] According to the technical solution of the embodiment of the present invention, the following technical effects can be achieved:

[0117] The present invention provides a method for software testing, which solves the technical defect of the prior art that a large number of test messages need to be manually constructed, which is a heavy workload, thereby achieving the technical effect of improving software testing efficiency and accuracy and providing a strong guarantee for the efficient and high-quality completion of software engineering development projects.

[0118] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for software testing, characterized in that: include: Get the input parameters and configuration parameter information configured according to the test case from the database table; According to the input parameters and configuration parameter information, obtain the corresponding message template; Based on the message template, execute the automated testing task; Generate a test report based on the results of executing the automated test task.

2. The method according to claim 1, characterized in that Based on the message template, perform automated testing tasks, including: Based on the message template, generate a test case; According to the test case, an automatic test task is performed on the software to be tested.

3. The method according to claim 2, characterized in that Based on the message template, a test case is generated, including: According to the message template, obtain keyword parameters; According to the keyword parameters, matching the software to be tested; Fill the message according to the software to be tested and the keyword parameters; The filled message is used as the test case.

4. The method according to claim 3, characterized in that: The message template includes parameter default values; Based on the message template, a test case is generated, including: Fill the parameter default values ​​into the message template to generate the test case.

5. The method according to claim 3, characterized in that: The keyword parameter package includes at least one of the following: project code, docking plan code, docking number, group order identification, main terms, and treaty information.

6. The method according to claim 1, characterized in that Generate a test report based on the results of executing the automated test task, including: Counting the probability of success or failure of executing the automated test task according to different test cases; Add the stated probabilities to the test report.

7. The method according to claim 6, characterized in that Before calculating the probability of success or failure of executing the automated test task according to different test cases, the following steps are included: Determining whether the test result is within an expected range; If yes, determining the test result as successful; If not, the test result is determined to be a failure.

8. The method according to claim 6, characterized in that Before calculating the probability of success or failure of executing the automated test task according to different test cases, the following steps are included: Determining whether the test result matches the expected result; If yes, determining the test result as successful; If not, the test result is determined to be a failure.

9. A software testing device, characterized in that: include: An information acquisition module is used to obtain input parameters and configuration parameter information configured according to the test case from a database table; A message template acquisition module, used to acquire the corresponding message template according to the input parameters and configuration parameter information; A task execution module, used to execute automated test tasks based on the message template; The report generation module is used to generate a test report according to the result of executing the automated test task.

10. An electronic device for software testing, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.