Software system testing method, device, computer equipment and readable storage medium
By identifying the dependencies of software units and building a mock data sample library, locking the software units to be tested and generating return data using the dependency software, the problems of long test cycles and complex operations in the existing technology are solved, and an efficient and accurate software system is realized test.
Patent Information
- Application Number
- CN202111526587.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-14
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-12-14
AI Technical Summary
Existing software testing methods require enabling all software units in the software system to test a certain software unit, resulting in long test cycles and complex operations.
By identifying the software units and their dependencies in the software system, building a mock data sample library, locking the software units to be tested and generating return data using the dependent software, directly enter the software to be tested for testing, avoiding starting all software units.
It shortens the test cycle and operation complexity, improves the testing efficiency, ensures the comprehensiveness and accuracy of the test, and reduces the link length and time consumption of obtaining input data.
Smart Images

Figure CN114218098B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of functional testing technology for cloud testing, and in particular to a software system testing method, device, computer equipment and readable storage medium. Background Art
[0002] The purpose of software testing is to find errors in software programs, verify whether the software meets the design requirements, and whether it meets the technical requirements to be achieved in the contract, and evaluate the quality of the software. The basic methods of software testing are functional testing, performance testing, black box testing, and white box testing. Current software testing usually starts all software units in the software system through preset test scripts to operate on the test scripts and finally obtain test results.
[0003] However, the inventors realize that once a software unit in a software system needs to be tested, it is still necessary to enable all software units in the software system and obtain the overall test results of the software system, which leads to a long test cycle and complicated operations. Summary of the invention
[0004] The purpose of the present invention is to provide a software system testing method, device, computer equipment and readable storage medium, which are used to solve the problem in the prior art that when testing a software unit in a software system, it is necessary to enable all software units in the software system and obtain the overall test results of the software system, resulting in a long test cycle and complicated operations.
[0005] To achieve the above object, the present invention provides a software system testing method, comprising:
[0006] Obtain a software system, identify software units in the software system and dependencies between the software units, and build a sample library storing mock data corresponding to the software units in the software system, wherein the mock data is used to simulate return data output by the software units;
[0007] receiving a request for an input file, identifying the software to be tested in the software system and the software units on which the software to be tested depends according to the request for an input file, and setting the software units as dependent software;
[0008] Call the dependent software according to the input request to obtain return data, or set the mock data corresponding to the dependent software as return data;
[0009] The returned data is entered into the software to be tested, and the software to be tested is run to obtain feedback data.
[0010] In the above solution, the step of identifying the software units in the software system and the dependencies between the software units includes:
[0011] Obtaining a software flow chart in the software system, identifying a software unit corresponding to any flow node in the software flow chart, and setting the flow node as a target node;
[0012] Extracting attribute information of the software unit corresponding to the target node, wherein the attribute information includes number information and method information, the number information is a unique identifier of the software unit, and the method records the input and output parameters of the software unit, as well as the calculation logic of the software unit;
[0013] Setting the process node in the software flow graph that depends on the target node as a dependent node of the target node, extracting the number information of the software unit corresponding to the dependent node and setting it as the dependent information, wherein the dependent information represents the dependency relationship between the software unit corresponding to the target node and the software unit corresponding to the dependent node;
[0014] The attribute information and the numbering information are aggregated to form unit information of the software unit corresponding to the target node.
[0015] In the above solution, the building of a sample library storing mock data corresponding to software units in the software system includes:
[0016] Sending the unit information to a development end, receiving mock data constructed by the development end according to the unit information, wherein the mock data is constructed according to the method information and is used to simulate return data of a software unit corresponding to the unit information;
[0017] The mock data and the unit information are saved in a preset database, and the unit information is associated with the mock data, so that the database is converted into the sample library.
[0018] In the above solution, after constructing a sample library storing mock data corresponding to the software unit in the software system, the method further includes:
[0019] The format of the mock data and the unit information associated with it in the sample library is changed to json format.
[0020] In the above scheme, the step of identifying the software to be tested in the software system and the software units on which the software to be tested depends according to the application request, and setting the software units as dependent software, includes:
[0021] Extracting the test number in the submission request;
[0022] Identify unit information in the sample library whose number information is consistent with the test number, and set the software unit corresponding to the unit information as the software to be tested;
[0023] Dependency information in the unit information is extracted, unit information in the sample library whose numbering information is consistent with the dependency information is identified, and the software unit corresponding to the unit information is set as dependent software.
[0024] In the above scheme, the step of calling the dependent software according to the incoming request to obtain the returned data, or setting the mock data corresponding to the dependent software as the returned data, includes:
[0025] Extracting the debugging value in the input request;
[0026] If the debugging value is the first value, extracting the input data corresponding to the debugging value in the input request, calling the dependent software to calculate the input data to obtain the return data;
[0027] If the debugging value is the second value, the mock data corresponding to the dependent software is obtained from the sample library, and the mock data is set as the return data.
[0028] In the above solution, after the software to be tested is run to obtain feedback data, the method further includes:
[0029] Acquire process information reflecting the process of the software under test generating the feedback data, and generate a test report according to the process information;
[0030] The test report is uploaded to a preset blockchain.
[0031] To achieve the above object, the present invention further provides a software system testing device, comprising:
[0032] A sample construction module is used to obtain a software system, identify software units in the software system and dependencies between the software units, and construct a sample library storing mock data corresponding to the software units in the software system, wherein the mock data is used to simulate return data output by the software units;
[0033] A dependency identification module for testing, used for receiving a request for submission, identifying the software to be tested in the software system and the software units on which the software to be tested depends according to the request for submission, and setting the software units as dependent software;
[0034] A return data generation module, used to call the dependent software according to the input request to obtain return data, or set the mock data corresponding to the dependent software as return data;
[0035] The software testing module is used to input the returned data into the software to be tested and run the software to be tested to obtain feedback data.
[0036] To achieve the above objectives, the present invention also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor of the computer device implements the steps of the above software system testing method when executing the computer program.
[0037] To achieve the above objectives, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program stored in the computer-readable storage medium is executed by a processor, the steps of the above software system testing method are implemented.
[0038] The software system testing method, apparatus, computer equipment and readable storage medium provided by the present invention can perform targeted testing on the software to be tested without starting all software units in the software system by locking the software unit to be tested and setting it as the software to be tested, and identifying the dependent software on which the software to be tested depends. This greatly shortens the testing cycle and operation complexity and improves the testing efficiency.
[0039] By calling the dependent software according to the input request to obtain return data, the test scenario of the software to be tested is expanded to test the software to be tested from multiple angles, thereby ensuring the comprehensiveness and accuracy of the test; and by setting the mock data corresponding to the dependent software as the return data, there is no need to call the dependent software to calculate the input data in the input request, and the mock data corresponding to the dependent software can be directly called to obtain the input data of the software to be tested, which greatly reduces the link length and time consumption for obtaining the input data, improves the test efficiency, and reduces the complexity of the test operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 This is a flowchart of Embodiment 1 of the software system testing method of the present invention;
[0041] Figure 2 This is a schematic diagram of an environment application of a software system testing method in Embodiment 2 of the software system testing method of the present invention;
[0042] Figure 3 is a specific method flow chart of the software system testing method in Embodiment 2 of the software system testing method of the present invention;
[0043] Figure 4 This is a schematic diagram of program modules of Embodiment 3 of the software system testing device of the present invention;
[0044] Figure 5Schematic diagram of the hardware structure of the computer device in the fourth embodiment of the computer device of the present invention. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention 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 invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0046] The software system testing method, device, computer equipment and readable storage medium provided by the present invention are applicable to the functional testing technology field of cloud testing, and provide a software system testing method based on a sample construction module, a test dependency identification module, a return data generation module and a software testing module. The present invention obtains a software system, identifies the software units in the software system and the dependency relationships between the software units, and constructs a sample library storing mock data corresponding to the software units in the software system; receives an input request, identifies the software to be tested in the software system and the software units that the software to be tested depends on according to the input request, and sets the software units as dependent software; calls the dependent software according to the input request to obtain return data, or sets the mock data corresponding to the dependent software as return data; enters the return data into the software to be tested, and runs the software to be tested to obtain feedback data.
[0047] Embodiment 1:
[0048] See also Figure 1 , a software system testing method of this embodiment includes:
[0049] S101: obtaining a software system, identifying software units in the software system and dependencies between the software units, and constructing a sample library storing mock data corresponding to the software units in the software system, wherein the mock data is used to simulate return data output by the software units;
[0050] S103: receiving a request for submitting a test, identifying the software to be tested in the software system and the software units on which the software to be tested depends according to the request for submitting a test, and setting the software units as dependent software;
[0051] S104: calling the dependent software according to the input request to obtain return data, or setting the mock data corresponding to the dependent software as return data;
[0052] S105: Enter the returned data into the software to be tested, and run the software to be tested to obtain feedback data.
[0053] In an exemplary embodiment, the software system is a computer system having at least one software unit, wherein the software units have a dependency relationship, and any software unit calculates the return data output by the software unit it depends on to obtain the output data of the any software unit.
[0054] By identifying the software to be tested in the software system and the software units that the software to be tested depends on according to the application request, and setting the software units as dependent software, the software units to be tested are quickly locked and set as the software to be tested, and the dependent software that the software to be tested depends on is identified, so that the return data is generated by running the dependent software in the future, and the return data is used as the input data of the software to be tested, which greatly shortens the link length of generating the input data of the software to be tested, and then the software to be tested can be tested in a targeted manner without starting all the software units in the software system, which greatly shortens the test cycle and operation complexity, and improves the test efficiency. By calling the dependent software to obtain the return data according to the application request, the effect of calling the dependent interface to calculate the application data in the application request and obtaining the return data is achieved. This scenario ensures that the input data obtained by the software to be tested is the return data calculated and generated by the regular dependent software. Therefore, the test purpose of this scenario is to determine whether the software to be tested can generate normal feedback data when receiving normal data, and the test scenario of the software to be tested is expanded to test the software to be tested from multiple angles, thereby ensuring the comprehensiveness and accuracy of the test. At the same time, by setting the mock data corresponding to the dependent software as the return data, the input data of the software to be tested can be obtained by directly calling the mock data corresponding to the dependent software without calling the dependent software to calculate the input data in the input request, which greatly reduces the link length and time consumption for obtaining the input data, improves the test efficiency, and reduces the complexity of the test operation. Since the content of the mock data can be set according to the needs, the input data of various situations can be simulated for the software to be tested, thereby achieving the technical effect of expanding the test scenario of the software to be tested.
[0055] Embodiment 2:
[0056] This embodiment is a specific application scenario of the above-mentioned embodiment 1. Through this embodiment, the method provided by the present invention can be explained more clearly and specifically.
[0057] In the following, the method provided in this embodiment is specifically described by taking the example of calling the dependent software to obtain return data, or setting the mock data corresponding to the dependent software as return data in a server running the software system testing method; and testing the software to be tested by using the return data. It should be noted that this embodiment is only exemplary and does not limit the scope of protection of the embodiment of the present invention.
[0058] Figure 2 The following is a schematic diagram showing an environment application of the software system testing method according to the second embodiment of the present application.
[0059] In an exemplary embodiment, the server 2 where the software system testing method is located is connected to the client 4 through the network 3; the server 2 can provide services through one or more networks 3, and the network 3 can include various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices and / or the like. The network 3 can include physical links, such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof and / or the like. The network 3 can include wireless links, such as cellular links, satellite links, Wi-Fi links and / or the like; the client 4 can be a computer device such as a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.
[0060] Figure 3 It is a specific method flow chart of a software system testing method provided by an embodiment of the present invention, and the method specifically includes steps S201 to S206.
[0061] S201: Obtain a software system, identify software units in the software system and dependencies between the software units, and construct a sample library storing mock data corresponding to the software units in the software system, wherein the mock data is used to simulate return data output by the software units.
[0062] In this step, the software system is a computer system having at least one software unit, wherein the software units have a dependency relationship, and any software unit calculates the return data output by the software unit it depends on to obtain the output data of any software unit.
[0063] In a preferred embodiment, the identifying software units in the software system and the dependencies between the software units includes:
[0064] S11: Acquire a software flow chart in the software system, identify a software unit corresponding to any flow node in the software flow chart, and set the flow node as a target node;
[0065] S12: extracting attribute information of the software unit corresponding to the target node, wherein the attribute information includes number information and method information, the number information is a unique identifier of the software unit, and the method records input parameters and output parameters of the software unit, as well as the calculation logic of the software unit;
[0066] S13: setting the process node in the software flow graph that depends on the target node as a dependent node of the target node, extracting the number information of the software unit corresponding to the dependent node and setting it as the dependency information, wherein the dependency information represents the dependency relationship between the software unit corresponding to the target node and the software unit corresponding to the dependent node;
[0067] S14: Summarize the attribute information and the numbering information to form unit information of the software unit corresponding to the target node.
[0068] Exemplarily, the software system includes software unit A, software unit B and software unit C, wherein software unit A depends on software unit B, and software unit B depends on software unit C; assuming that the target node is node A, and its corresponding software unit is software unit A; then its numbering information is obtained: unit A0001, method information: input parameter "num1", output parameter "num2", calculation logic: sum (sum); the dependent node of the target node is node B, and its corresponding software unit is software unit B, and the numbering information of software unit B obtained is: unit B0001, and finally, the unit information obtained is: {numbering information: unit A0001; method information: input parameter "num1", output parameter "num2", calculation logic: sum (sum); dependency information: unit B0001}.
[0069] In a preferred embodiment, the building of a sample library storing mock data corresponding to software units in the software system includes:
[0070] S15: sending the unit information to the development end, and receiving the mock data constructed by the development end according to the unit information, wherein the mock data is constructed according to the method information and is used to simulate the return data of the software unit corresponding to the unit information;
[0071] S16: Save the mock data and the unit information into a preset database, and associate the unit information with the mock data, so that the database is converted into the sample library.
[0072] Exemplarily, based on the above example, the unit information is sent to the development end so that the development end can construct mock data according to the input parameters, output parameters and calculation logic: total amount of each account: 10,000 yuan; the mock data: total amount of each account: 10,000 yuan is saved in the database, and associated with the unit information: {number information: unit A0001; method information: input parameter "num1", output parameter "num2", calculation logic: sum (total); dependency information: unit B0001}.
[0073] In this embodiment, the association relationship between the mock data and the unit information can be realized by storing the mock data and the unit information in the same row of the database, or by constructing a mapping / hyperlink relationship between the mock data and the unit information.
[0074] Furthermore, the mock data has at least one, and by setting a mock tag in the mock data, the mock data corresponding to the dependent software can be distinguished.
[0075] S202: Modify the format of the mock data and the unit information associated therewith in the sample library into a json format.
[0076] In this step, the mock data and unit information in the sample library are converted into data in json format. Since the json format is relatively simple, easy to read and write, and the format is compressed, it occupies less bandwidth; at the same time, the json format is easy to parse, and the reading and searching of JSON data can be performed through eval(), which improves the efficiency of retrieval and acquisition of mock data; and the mock data in json format can support multiple languages, expanding the scope of application of the sample library.
[0077] S203: receiving a request for submitting a file, identifying the software to be tested in the software system and the software units on which the software to be tested depends according to the request for submitting a file, and setting the software units as dependent software.
[0078] In order to achieve targeted testing of each software unit in the software system, it is necessary to enable all software units in the software system and obtain overall feedback data of the software system to avoid the current problem of long testing cycle and complex operation.
[0079] This step identifies the software to be tested in the software system and the software units that the software to be tested depends on according to the application request, and sets the software units as dependent software, thereby quickly locking the software units that need to be tested and setting them as the software to be tested, and identifying the dependent software that the software to be tested depends on, so that the return data can be generated by running the dependent software in the future, and the return data can be used as the input data of the software to be tested, which greatly shortens the link length for generating the input data of the software to be tested, and thus, the software to be tested can be tested in a targeted manner without starting all the software units in the software system, which greatly shortens the test cycle and operation complexity, and improves the test efficiency. Among them, the link refers to the number of software units required to call to generate the input data. Due to the great shortening of the link, the operation complexity is greatly reduced.
[0080] In a preferred embodiment, identifying the software to be tested in the software system and the software units on which the software to be tested depends according to the application request, and setting the software units as dependent software, includes:
[0081] S31: extracting the test number in the submission request.
[0082] In this step, the test number is a unique number of the software unit that the tester needs to test, for example: A0001.
[0083] S32: Identify unit information in the sample library whose number information is consistent with the test number, and set the software unit corresponding to the unit information as the software to be tested.
[0084] Exemplarily, if the test number is A0001, the software unit A is set as the software to be tested.
[0085] S33: extracting dependency information from the unit information, identifying unit information in the sample library whose numbering information is consistent with the dependency information, and setting the software unit corresponding to the unit information as dependent software.
[0086] Exemplarily, the unit information obtained is: {number information: unit A0001; method information: input parameter "num1", output parameter "num2", calculation logic: sum (total); dependency information: unit B0001}, then the dependency information is: unit B0001, then, set the software unit B as the dependent software.
[0087] S204: Call the dependent software according to the input request to obtain return data, or set the mock data corresponding to the dependent software as return data.
[0088] In order to expand the test scenarios of the software under test, so as to test the software under test from multiple angles and ensure the comprehensiveness and accuracy of the test, this step realizes the effect of calling the dependent interface to calculate the input data in the input request and obtaining the return data by calling the dependent software according to the input request. This scenario ensures that the input data obtained by the software under test is the return data calculated and generated by the regular dependent software. Therefore, the test purpose of this scenario is to determine whether the software under test can generate normal feedback data when receiving normal data.
[0089] At the same time, this step also sets the mock data corresponding to the dependent software as the return data, without calling the dependent software to calculate the input data in the input request, and directly calls the mock data corresponding to the dependent software to obtain the input data of the software under test, which greatly reduces the link length and time consumption for obtaining the input data, improves the test efficiency, and reduces the complexity of the test operation. Since the content of the mock data can be set according to the needs, the input data of various situations can be simulated for the software under test, thereby achieving the technical effect of expanding the test scenario of the software under test.
[0090] Furthermore, the mock data can also be abnormal data. By setting the abnormal data as the input data, it is possible to determine whether the software under test can detect the abnormal data and generate feedback data with abnormal results, or whether it can automatically process the abnormal data and generate feedback data with normal results; so as to realize feedback data for the software under test in scenarios of normal input data and abnormal input data, further expanding the test scenarios of the software under test.
[0091] In a preferred embodiment, the step of calling the dependent software according to the input request to obtain the return data, or setting the mock data corresponding to the dependent software as the return data, includes:
[0092] S41: extracting the debugging value in the input request;
[0093] S42: if the debugging value is the first value, extracting the input data corresponding to the debugging value in the input request, calling the dependent software to calculate the input data to obtain the return data;
[0094] S43: If the debugging value is the second value, obtaining mock data corresponding to the dependent software from the sample library, and setting the mock data as the return data.
[0095] Specifically, the input request contains at least one debugging value. If the debugging value is the first value, it means that this test needs to call the dependent software and generate corresponding return data as the input data of the software to be tested. Therefore, when the debugging value is the first value, the input request contains input data corresponding to the debugging value, and the input data is the input data of the dependent software.
[0096] When the debugging value is the second value, the mock data corresponding to the software to be tested is directly obtained from the sample library as input data of the software to be tested.
[0097] In this embodiment, a debug command is written in the input request to modify the input data of the software to be tested into mock data, so as to achieve the technical effect of testing the software to be tested in a targeted manner; and a debug value is used as the debugging value.
[0098] If the debug value is the first value, for example, 0, it indicates that there is no need to execute the debug command, and only the dependent software needs to be called to calculate the input data and obtain its return data, and the return data is used as the input data of the software under test;
[0099] If the debug value is the second value, for example: 1, it indicates that the debug command needs to be executed, and the dependency address in the software under test needs to be modified to the address of the mock data corresponding to the software under test in the sample library, so as to interrupt the dependency between the software under test and the dependent software, and modify the input data of the software under test to the mock data, thereby achieving the technical effect of targeted testing of the software under test according to the preset scenario.
[0100] It should be noted that debug is a DOS utility program, a program debugging tool for programmers, which can be used to check bytes anywhere in the memory and modify bytes anywhere. It can be used to execute a program instruction by instruction to verify the correctness of the program operation, and can also track the execution process, compare the values before and after the execution of an instruction, and compare and move the range of data in the memory, read and write files and disk sectors.
[0101] Further, setting the mock data as the returned data includes:
[0102] S431: extracting the mock tag in the submission request;
[0103] S432: setting the mock data corresponding to the mock tag in the mock data corresponding to the dependent software as the return data.
[0104] Since there is at least one mock data constructed for the software to be tested, which is used to implement multiple scenario tests, the corresponding mock data is obtained through the mock tag to test the software to be tested, so as to implement multiple scenario tests for the software to be tested.
[0105] S205: Enter the returned data into the software to be tested, and run the software to be tested to obtain feedback data.
[0106] In this step, the returned data is used as input data of the software to be tested to test whether the software to be tested can generate the feedback data required by the tester.
[0107] Exemplarily, assuming that the software to be tested is an indicator processor and the dependent software is a data generator, then the indicator processor is tested by the return data generated by the data generator, or by using the mock data corresponding to the indicator processor in the sample library as the return data, so that the indicator processor generates indicator information according to the return data, and uses it as feedback data, thereby achieving the technical effect of multi-scenario and targeted testing of the data to be tested, without running all software units in the software system, greatly shortening the link length of the input data generation link of the software to be tested, improving the test efficiency, and reducing the test complexity and test cycle.
[0108] S206: Acquire process information reflecting the process of the software under test generating the feedback data, and generate a test report according to the process information.
[0109] In order to further locate the method where the anomaly occurs in the software under test and to improve the test and repair efficiency, this step obtains process information reflecting the process of the software under test generating the feedback data, and generates a test report based on the process information, so that the tester can obtain the method where the anomaly occurs in the software under test through the test report and modify it in time.
[0110] In a preferred embodiment, obtaining process information reflecting the process of the software under test generating the feedback data, and generating a test report according to the process information includes:
[0111] S61: Obtain the system log of the software system, identify the location of the return data in the system log, and set the log information after the return data as process information, wherein the process information records the complete process of the software under test generating the feedback data based on the return data.
[0112] In this step, since when the debugging value is 0, the input data is the input data of the dependent software, and the output data of the dependent software is unknown, the return data received by the software under test is obtained from the system log to determine the input information of the software under test.
[0113] At the same time, if the debug value is 1, then the return data is the mock data, so it is only necessary to identify the location of the mock data in the system log; if the debug value is 1 and the mock data is not identified in the system log, it means that the return data is inconsistent with the mock data, so it means that an abnormality has occurred in the sample library. At this time, the tester can repair the sample library according to the situation of the return data that is different from the mock data in the test report.
[0114] S62: Obtain the method to be tested in the process information and the running time of the method to be tested; obtain the stage feedback data generated by the software to be tested by calling the method to be tested; wherein the stage feedback data is a component of the feedback data generated by the software to be tested.
[0115] In this step, the method name in the process information is identified, and the method name is set as the method to be tested, the running time of the method to be tested is obtained, and the stage feedback data generated by calling the method to be tested according to the return data is obtained, wherein the stage feedback data is a component of the feedback data generated by the software to be tested. In this embodiment, if the software to be tested is an indicator processor, the background log is the indicator processor as an indicator ledger page.
[0116] S63: Summarize the returned data, the method to be tested, the running time and the stage feedback data to form the test report.
[0117] In this step, the returned data is set as report input information, the method to be tested and its running time and stage feedback data are summarized to form test items, and the report input information and at least one test item of the method to be tested are summarized to form the test report, so that the tester can regularly display the test process of the software to be tested.
[0118] Preferably, the test report is uploaded to a preset blockchain.
[0119] It should be noted that the corresponding summary information is obtained based on the test report. Specifically, the summary information is obtained by hashing the test report, such as using the sha256s algorithm. Uploading the summary information to the blockchain can ensure its security and fairness and transparency to users. The user device can download the summary information from the blockchain to verify whether the test report has been tampered with. The blockchain referred to in this example is a new application model of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.
[0120] Embodiment three:
[0121] See also Figure 4 , a software system testing device 1 of this embodiment includes:
[0122] The sample construction module 11 is used to obtain a software system, identify software units in the software system and dependencies between the software units, and construct a sample library storing mock data corresponding to the software units in the software system, wherein the mock data is used to simulate return data output by the software units;
[0123] The dependency identification module 13 is used to receive a request for submission, identify the software to be tested in the software system and the software units that the software to be tested depends on according to the request for submission, and set the software units as dependent software;
[0124] A return data generating module 14 is used to call the dependent software according to the input request to obtain return data, or to set the mock data corresponding to the dependent software as return data;
[0125] The software testing module 15 is used to input the returned data into the software to be tested, and run the software to be tested to obtain feedback data.
[0126] Optionally, the software system testing device 1 further includes:
[0127] The format adjustment module 12 is used to modify the format of the mock data and the unit information associated therewith in the sample library into a json format.
[0128] Optionally, the software system testing device 1 further includes:
[0129] The report generating module 16 is used to obtain process information reflecting the process of the software under test generating the feedback data, and generate a test report according to the process information.
[0130] Optionally, the sample construction module 11 further includes:
[0131] A node identification unit 111 is used to obtain a software flow chart in the software system, identify a software unit corresponding to any flow node in the software flow chart, and set the flow node as a target node;
[0132] The attribute extraction unit 112 is used to extract the attribute information of the software unit corresponding to the target node, wherein the attribute information includes number information and method information, the number information is the unique identifier of the software unit, and the method records the input and output parameters of the software unit, as well as the calculation logic of the software unit;
[0133] The dependency identification unit 113 is used to set the process node that depends on the target node in the software flow graph as the dependent node of the target node, extract the number information of the software unit corresponding to the dependent node and set it as the dependency information, wherein the dependency information represents the dependency relationship between the software unit corresponding to the target node and the software unit corresponding to the dependent node;
[0134] The information aggregation unit 114 is used to aggregate the attribute information and the numbering information to form unit information of the software unit corresponding to the target node.
[0135] A data construction unit 115 is used to send the unit information to the development end, and receive the mock data constructed by the development end according to the unit information, wherein the mock data is constructed according to the method information and is used to simulate the return data of the software unit corresponding to the unit information;
[0136] The sample construction unit 116 is used to save the mock data and the unit information into a preset database, and associate the unit information with the mock data to convert the database into the sample library.
[0137] Optionally, the dependency identification module 13 may further include:
[0138] A number extraction unit 131, used to extract the test number in the submission request;
[0139] The test identification unit 132 is used to identify unit information in the sample library whose number information is consistent with the test number, and set the software unit corresponding to the unit information as the software to be tested.
[0140] The dependency identification unit 133 is used to extract the dependency information in the unit information, identify the unit information in the sample library whose numbering information is consistent with the dependency information, and set the software unit corresponding to the unit information as dependent software.
[0141] Optionally, the return data generating module 14 further includes:
[0142] A value extraction unit 141, used to extract the debugging value in the input request;
[0143] A dependent calling unit 142, configured to extract the input data corresponding to the debugging value in the input request when the debugging value is the first value, and call the dependent software to calculate the input data to obtain the return data;
[0144] The virtual calling unit 143 is used to obtain the mock data corresponding to the dependent software from the sample library when the debugging value is the second value, and set the mock data as the return data.
[0145] Optionally, the report generating module 16 further includes:
[0146] The process identification unit 161 is used to obtain the system log of the software system, identify the position of the return data in the system log, and set the log information after the return data as process information, wherein the process information records the complete process of the software under test generating the feedback data based on the return data.
[0147] The data extraction unit 162 is used to obtain the method to be tested in the process information and the running time of the method to be tested; obtain the stage feedback data generated by the software to be tested by calling the method to be tested; wherein the stage feedback data is a component of the feedback data generated by the software to be tested.
[0148] The report generating unit 163 is used to summarize the returned data, the method to be tested, the running time and the stage feedback data to form the test report.
[0149] The technical solution is applied to the technical field of functional testing of cloud testing. The software to be tested in the software system and the software units on which the software to be tested depends are identified according to the input request, and the software units are set as dependent software; the dependent software is called according to the input request to obtain return data, or the mock data corresponding to the dependent software is set as return data; the return data is entered into the software to be tested, and the software to be tested is run to obtain feedback data; therefore, the technical effect of targeted unit module testing of each functional unit in the cloud system is achieved.
[0150] Furthermore, 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.
[0151] 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.
[0152] Embodiment 4:
[0153] To achieve the above purpose, the present invention also provides a computer device 5. The components of the software system testing device of the third embodiment can be dispersed in different computer devices. The computer device 5 can be a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including independent server, or server cluster composed of multiple application servers) that executes the program. The computer device of this embodiment includes at least but is not limited to: a memory 51 and a processor 52 that can be connected to each other through a system bus, such as Figure 5 It should be pointed out that Figure 5 Only a computer device with components is shown, but it should be understood that implementing all of the components shown is not a requirement and more or fewer components may alternatively be implemented.
[0154] In this embodiment, the memory 51 (i.e., readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 51 can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the memory 51 can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 51 can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 51 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the software system testing device of the third embodiment. In addition, the memory 51 can also be used to temporarily store various data that have been output or are to be output.
[0155] The processor 52 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 52 is generally used to control the overall operation of the computer device. In this embodiment, the processor 52 is used to run the program code stored in the memory 51 or process data, such as running the software system testing device to implement the software system testing method of the first embodiment and the second embodiment.
[0156] Embodiment five:
[0157] To achieve the above purpose, the present invention also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, and the program implements the corresponding function when executed by the processor 52. The computer-readable storage medium of this embodiment is used to store a computer program for implementing the software system testing method, and when executed by the processor 52, the software system testing methods of Embodiments 1 and 2 are implemented.
[0158] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0159] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0160] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A software system testing method, characterized in that: include: Obtain a software system, identify software units in the software system and dependencies between the software units, and construct a sample library storing mock data corresponding to the software units in the software system, wherein the mock data is used to simulate return data output by the software units, and the mock data is abnormal data; receiving a request for an input file, identifying the software to be tested in the software system and the software unit on which the software to be tested depends according to the request for an input file, and setting the software unit as the dependent software; According to the input request, the dependent software is called to obtain return data, or the mock data corresponding to the dependent software is set as the return data; wherein a debug command is written in the input request, which is used to modify the input data of the software to be tested into mock data, and the debug value is used as the debug value; the debug value in the input request is extracted; if the debug value is a first value, the debug command is not executed, only the input data corresponding to the debug value in the input request is extracted, and the dependent software is called to calculate the input data to obtain the return data; if the debug value is a second value, the debug command is executed, the dependency address in the software to be tested is modified to the address of the mock data corresponding to the software to be tested in the sample library, the dependency between the software to be tested and the dependent software is interrupted, the mock data corresponding to the dependent software is obtained from the sample library, and the mock data is set as the return data; setting the mock data as the return data includes: extracting the mock tag in the input request; setting the mock data corresponding to the mock tag in the mock data corresponding to the dependent software as the return data; The returned data is entered into the software to be tested, and the software to be tested is run to obtain feedback data.
2. The software system testing method according to claim 1, characterized in that: The identifying software units in the software system and dependencies between the software units includes: Obtaining a software flow chart in the software system, identifying a software unit corresponding to any flow node in the software flow chart, and setting the flow node as a target node; Extracting attribute information of the software unit corresponding to the target node, wherein the attribute information includes number information and method information, the number information is a unique identifier of the software unit, and the method information records the input and output parameters of the software unit and the calculation logic of the software unit; Setting the process node in the software flow graph that depends on the target node as a dependent node of the target node, extracting the number information of the software unit corresponding to the dependent node and setting it as the dependent information, wherein the dependent information represents the dependency relationship between the software unit corresponding to the target node and the software unit corresponding to the dependent node; The attribute information and the dependency information are aggregated to form unit information of the software unit corresponding to the target node.
3. The software system testing method according to claim 2, characterized in that: The building of a sample library storing mock data corresponding to software units in the software system includes: Sending the unit information to a development end, receiving mock data constructed by the development end according to the unit information, wherein the mock data is constructed according to the method information and is used to simulate return data of a software unit corresponding to the unit information; The mock data and the unit information are saved in a preset database, and the unit information is associated with the mock data, so that the database is converted into the sample library.
4. The software system testing method according to claim 3, characterized in that: After building a sample library storing mock data corresponding to software units in the software system, the method further includes: The format of the mock data and the unit information associated with it in the sample library is changed to json format.
5. The software system testing method according to claim 3, characterized in that: The step of identifying the software to be tested in the software system and the software unit on which the software to be tested depends according to the application request, and setting the software unit as the dependent software, includes: Extracting the test number in the submission request; Identify unit information in the sample library whose number information is consistent with the test number, and set the software unit corresponding to the unit information as the software to be tested; Dependency information in the unit information is extracted, unit information in the sample library whose numbering information is consistent with the dependency information is identified, and the software unit corresponding to the unit information is set as dependent software.
6. The software system testing method according to claim 1, characterized in that: After the software to be tested is run to obtain feedback data, the method further includes: Acquire process information reflecting the process of the software under test generating the feedback data, and generate a test report according to the process information; The test report is uploaded to a preset blockchain.
7. A software system testing device, characterized in that: include: A sample construction module is used to obtain a software system, identify software units in the software system and dependencies between the software units, and construct a sample library storing mock data corresponding to the software units in the software system, wherein the mock data is used to simulate return data output by the software units, and the mock data is abnormal data; A dependency identification module for testing, used for receiving a request for submission, identifying the software to be tested in the software system and the software units on which the software to be tested depends according to the request for submission, and setting the software units as dependent software; a return data generating module, configured to call the dependent software according to the input request to obtain return data, or set the mock data corresponding to the dependent software as the return data; wherein a debug command is written in the input request, which is used to modify the input data of the software to be tested into mock data, and adopt the debug value as the debug value; extract the debug value in the input request; if the debug value is a first value, do not execute the debug command, only extract the input data corresponding to the debug value in the input request, and call the dependent software to calculate the input data to obtain the return data; if the debug value is a second value, execute the debug command, modify the dependency address in the software to be tested into the address of the mock data corresponding to the software to be tested in the sample library, interrupt the dependency between the software to be tested and the dependent software, obtain the mock data corresponding to the dependent software from the sample library, and set the mock data as the return data; setting the mock data as the return data includes: extracting the mock tag in the input request; setting the mock data corresponding to the mock tag in the mock data corresponding to the dependent software as the return data; The software testing module is used to input the returned data into the software to be tested and run the software to be tested to obtain feedback data.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor of the computer device executes the computer program, the steps of the software system testing method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer program stored in the computer-readable storage medium implements the steps of the software system testing method according to any one of claims 1 to 6 when executed by a processor.
Citation Information
Patent Citations
Project testing method, apparatus and device for software unit and data processing system
CN109284222A