A software function testing method, device, electronic device and storage medium
By building expected result models and test cases for software functions and conducting back-to-back testing, the problems of low testing efficiency and high complexity caused by relying on external hardware in the existing technology are solved, and fast and accurate full coverage testing of software functions are achieved.
Patent Information
- Application Number
- CN202411929054.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-04
AI Technical Summary
The existing software functional testing methods rely on external hardware devices, and the testing environment is complex to build and it is difficult to achieve full coverage testing, resulting in low testing efficiency and high complexity.
By building the expected result model and test cases of the target function, use the test tool to load the use cases into the model and software source code, conduct back-to-back testing, and judge the results to determine whether the function meets the requirements.
It realizes efficient and accurate testing environment construction, does not rely on external hardware, and quickly completes full coverage of software functions, improving testing efficiency and reducing complexity.
Smart Images

Figure CN119759781A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software testing technology, and in particular to a method, device, electronic device and storage medium for testing software functions. Background Art
[0002] Testing of software program algorithms is generally carried out through hardware debugging, logical verification of program source code, and manual selection of key test cases to test and verify the functions of software configuration.
[0003] At present, in the method of debugging the functions of software configuration through hardware debugging and manual selection of key test cases, the process of making a test environment is relatively complicated, and it is overly dependent on external hardware devices. It is relatively complicated to import full coverage test cases into the test environment, which reduces the test efficiency. In addition, it is difficult to obtain the expected results of the test cases. Once the software program algorithm has algorithm iteration, it is difficult to achieve fast full coverage testing, which reduces the efficiency of software functional testing and thus increases the complexity of software functional testing. Summary of the invention
[0004] In view of this, the purpose of the present application is to provide a software function testing method, device, electronic device and storage medium, which constructs an expected result model and test case corresponding to the target function by testing the requirement information of the target function of the software to be tested, and uses a testing tool to load the test case into the expected result model and the target source code of the software to be tested respectively, to obtain the running results of back-to-back tests for the target function, to efficiently and accurately build a test environment without relying on external hardware equipment, and to determine whether the target function meets the functional requirements indicated by the requirement information based on the running results, so as to quickly complete the full coverage test of the software function, improve the efficiency of software function testing, and thereby reduce the complexity of software function testing.
[0005] The present application provides a method for testing software functions, the method comprising:
[0006] In response to receiving requirement information for testing a target function of the software to be tested, constructing an expected result model and at least one test case corresponding to the target function based on the requirement information;
[0007] Using a preset test tool, the test case is loaded into the expected result model and the target source code of the software to be tested, respectively, to obtain the expected result output by the expected result model and the running result output by the target source code, so as to perform back-to-back testing on the target function;
[0008] Determine whether the expected result is consistent with the running result, obtain a determination result, and determine the determination result as the test result corresponding to the target function to determine whether the target function of the software to be tested meets the functional requirements indicated by the demand information.
[0009] Furthermore, the testing method also includes:
[0010] The implementation process information corresponding to the expected result model and the target source code is obtained, and based on the test result, the implementation process information and the test execution time corresponding to the expected result and the running result, a test report corresponding to the back-to-back test for the target function is generated.
[0011] Furthermore, constructing the expected result model corresponding to the target function based on the demand information includes:
[0012] Based on the demand information, determine the limiting conditions of the target function, and based on the limiting conditions, set a limiting module corresponding to the expected result model;
[0013] Based on the preset test data, setting the input module and the output module corresponding to the expected result model for the limited module;
[0014] Based on the input module, the output module and the limiting module, an expected result model corresponding to the target function is constructed.
[0015] Further, at least one test case corresponding to the target function is constructed based on the requirement information through the following steps:
[0016] Based on the limiting condition, determining at least one logical threshold corresponding to the target function;
[0017] Based on the numerical value type corresponding to the input module, determining a plurality of type limit values corresponding to the target function;
[0018] At least one test case corresponding to the target function is constructed based on the logic threshold and the type limit value.
[0019] Further, determining the judgment result as the test result corresponding to the target function to determine whether the target function of the software to be tested meets the functional requirements indicated by the requirement information includes:
[0020] When the judgment result is that the expected result is consistent with the running result, the test result corresponding to the target function is determined to be in accordance with the expectation, so as to determine that the target function of the software to be tested meets the functional requirements indicated by the requirement information;
[0021] When the judgment result is that the expected result is inconsistent with the running result, it is determined that the test result corresponding to the target function does not meet expectations, so as to determine that the target function of the software to be tested does not meet the functional requirements indicated by the demand information.
[0022] The present application also provides a software function testing device, the testing device comprising:
[0023] A model building module, configured to, in response to receiving requirement information for testing a target function of the software to be tested, build an expected result model and at least one test case corresponding to the target function based on the requirement information;
[0024] A use case execution module, used to use a preset test tool to load the test case into the expected result model and the target source code of the software configuration to be tested, respectively, to obtain the expected result output by the expected result model and the running result output by the target source code, so as to perform back-to-back testing on the target function;
[0025] The test judgment module is used to judge whether the expected result is consistent with the running result, obtain a judgment result, and determine the judgment result as the test result corresponding to the target function to determine whether the target function of the software to be tested meets the functional requirements indicated by the demand information.
[0026] Furthermore, the test device further comprises a test result module, and the test result module is used to:
[0027] The implementation process information corresponding to the expected result model and the target source code is obtained, and based on the test result, the implementation process information and the test execution time corresponding to the expected result and the running result, a test report corresponding to the back-to-back test for the target function is generated.
[0028] Furthermore, when the model building module is used to build the expected result model corresponding to the target function based on the demand information, the model building module is used to:
[0029] Based on the demand information, determine the limiting conditions of the target function, and based on the limiting conditions, set a limiting module corresponding to the expected result model;
[0030] Based on the preset test data, setting the input module and the output module corresponding to the expected result model for the limited module;
[0031] Based on the input module, the output module and the limiting module, an expected result model corresponding to the target function is constructed.
[0032] Furthermore, when the model construction module is used to construct at least one test case corresponding to the target function based on the requirement information, the model construction module is used to:
[0033] Based on the limiting condition, determining at least one logical threshold corresponding to the target function;
[0034] Based on the numerical value type corresponding to the input module, determining a plurality of type limit values corresponding to the target function;
[0035] At least one test case corresponding to the target function is constructed based on the logic threshold and the type limit value.
[0036] Further, when the test judgment module is used to determine the judgment result as the test result corresponding to the target function to determine whether the target function of the software to be tested meets the functional requirements indicated by the requirement information, the test judgment module is used to:
[0037] When the judgment result is that the expected result is consistent with the running result, the test result corresponding to the target function is determined to be in accordance with the expectation, so as to determine that the target function of the software to be tested meets the functional requirements indicated by the requirement information;
[0038] When the judgment result is that the expected result is inconsistent with the running result, it is determined that the test result corresponding to the target function does not meet expectations, so as to determine that the target function of the software to be tested does not meet the functional requirements indicated by the demand information.
[0039] An embodiment of the present application also provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the software function testing method as described above are performed.
[0040] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the software function testing method as described above are executed.
[0041] The software function testing method, device, electronic device and storage medium provided in the embodiments of the present application, the testing method includes: in response to receiving requirement information for testing a target function of the software to be tested, based on the requirement information, constructing an expected result model and at least one test case corresponding to the target function; using a preset testing tool to load the test case into the expected result model and the target source code configured for the software to be tested, respectively, to obtain the expected result output by the expected result model and the running result output by the target source code, so as to perform back-to-back testing on the target function; judging whether the expected result is consistent with the running result, obtaining a judgment result, and determining the judgment result as the test result corresponding to the target function, so as to determine whether the target function of the software to be tested meets the functional requirements indicated by the requirement information.
[0042] Compared with the method in the prior art of testing and debugging the functions of software configuration through hardware debugging and manual selection of key test cases, the method uses the requirement information for testing the target function of the software to be tested to build the expected result model and test cases corresponding to the target function, and uses the test tool to load the test cases into the expected result model and the target source code of the software to be tested respectively, to obtain the running results of back-to-back tests for the target function, to efficiently and accurately build the test environment without relying on external hardware devices, and to determine whether the target function meets the functional requirements indicated by the requirement information based on the running results, so as to quickly complete the full coverage test of the software function, thereby improving the efficiency of software function testing and reducing the complexity of software function testing.
[0043] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0045] Figure 1 One of the flowcharts of a method for testing a software function provided in an embodiment of the present application;
[0046] Figure 2 A schematic diagram of the architecture of an expected result model provided in an embodiment of the present application;
[0047] Figure 3 A second flowchart of a method for testing a software function provided in an embodiment of the present application;
[0048] Figure 4 One of the structural schematic diagrams of a software function testing device provided in an embodiment of the present application;
[0049] Figure 5 A second structural diagram of a software function testing device provided in an embodiment of the present application;
[0050] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present application.
[0052] Research has found that, at present, in the method of debugging the functions of software configuration through hardware debugging and manual selection of key test cases, the process of making a test environment is relatively complicated, overly dependent on external hardware equipment, and it is relatively complicated to import full coverage test cases into the test environment, which reduces the test efficiency; in addition, it is difficult to obtain the expected results of the test cases. Once the software program algorithm has algorithm iteration, it is difficult to achieve fast full coverage testing, which reduces the efficiency of software functional testing and thus increases the complexity of software functional testing.
[0053] Based on this, an embodiment of the present application provides a method for testing software functions. By testing the requirement information of the target function of the software to be tested, an expected result model and test cases corresponding to the target function are constructed, and the test tools are used to load the test cases into the expected result model and the target source code of the software to be tested respectively, so as to obtain the running results of back-to-back tests for the target function, efficiently and accurately build a test environment without relying on external hardware devices, and determine whether the target function meets the functional requirements indicated by the requirement information based on the running results, so as to quickly complete the full coverage test of the software function, improve the efficiency of software function testing, and thereby reduce the complexity of software function testing.
[0054] See also Figure 1 , Figure 1 This is one of the flowcharts of a method for testing software functions provided in an embodiment of the present application. Figure 1 As shown in , the software function testing method provided in the embodiment of the present application includes:
[0055] S101 . In response to receiving requirement information for testing a target function of software to be tested, constructing an expected result model and at least one test case corresponding to the target function based on the requirement information.
[0056] In the embodiment of the present application, the demand information includes but is not limited to information such as the implementation object, implementation method and limiting conditions corresponding to the target function.
[0057] Exemplarily, the target function is to limit the input value, for example, to control the numerical value of the input value not to exceed 100. The requirement information of the target function may include controlling the numerical value within a certain range (implementation method), input value (implementation object), and not exceeding 100 (limitation condition).
[0058] In one embodiment of the present application, during specific implementation, the step of constructing the expected result model corresponding to the target function based on the demand information in step S101 may include:
[0059] S1011. Based on the demand information, determine the limiting conditions of the target function, and based on the limiting conditions, set a limiting module corresponding to the expected result model.
[0060] In this step, the limiting conditions of the target function are determined in the requirement information, and based on the limiting conditions, a limiting module corresponding to the expected result model is set.
[0061] Exemplarily, when the requirement information includes that the numerical value of the control input value shall not exceed 100, the limiting condition at this time is that the numerical value shall not exceed 100. Based on this limiting condition, a limiting module corresponding to the expected result model is set.
[0062] S1012. Based on preset test data, set an input module and an output module corresponding to the expected result model for the limited module.
[0063] In this step, based on the preset test data type and data source, as well as the implementation object and implementation method included in the requirement information, the input module and output module corresponding to the expected result model are set for the set limiting module.
[0064] Wherein, the input module includes the numerical type of the input data.
[0065] S1013. Based on the input module, the output module and the limiting module, construct an expected result model corresponding to the target function.
[0066] In the embodiments of this application, please refer to Figure 2 , Figure 2 A schematic diagram of the architecture of an expected result model provided in an embodiment of the present application.
[0067] like Figure 2 As shown in , the expected result model includes a restriction module, an input module and an output module; wherein the restriction module and the output module both correspond to the restriction conditions included in the demand information.
[0068] For example, when the objective function is to control the numerical value of the input value not to exceed 100, the expected result model can achieve that when the input value is greater than 100, the expected result model outputs 100; when the input value is less than or equal to 100, the expected result model outputs the input value.
[0069] In one embodiment of the present application, during specific implementation, the step of constructing at least one test case corresponding to the target function based on the requirement information in step S101 may include:
[0070] S1014. Based on the limiting condition, determine at least one logical threshold corresponding to the target function.
[0071] In this step, at least one logical threshold corresponding to the target function is determined based on the limitation range and limitation method indicated by the limitation condition.
[0072] Exemplarily, when the target function is to control the numerical value of the input value not to exceed 100, at least one logical threshold corresponding to the target function is determined to be 100, 99 and 101 respectively; wherein 99 and 101 are respectively the range values close to the logical threshold corresponding to the limiting condition.
[0073] S1015. Determine a plurality of type limit values corresponding to the target function based on the numerical type corresponding to the input module.
[0074] In this step, based on the numerical range included in the numerical type corresponding to the input module, at least one type minimum value and at least one type maximum value among a plurality of type limit values corresponding to the target function are determined.
[0075] Exemplarily, when the numerical type corresponding to the input module includes a numerical range of [0, 255], the type limit values corresponding to the target function may include 0 and 1 (type minimum values) and 254 and 255 (type maximum values).
[0076] S1016. Construct at least one test case corresponding to the target function based on the logic threshold and the type limit value.
[0077] Exemplarily, an example of at least one test case corresponding to the target function is shown in the following table.
[0078] Time(s) Input Module describe Output Module 0 0 First type minimum 0 2 1 Second type minimum 1 2 99 Second logic threshold 99 4 100 First logic threshold 100 4 101 The third logic threshold 100 6 254 Second type maximum 100 6 255 Type I maximum 100
[0079] S102. Use a preset test tool to load the test case into the expected result model and the target source code of the software to be tested, respectively, to obtain the expected result output by the expected result model and the running result output by the target source code, so as to perform back-to-back testing on the target function.
[0080] Here, back-to-back testing for target functions refers to a software testing method, which is usually used to verify the compatibility and interactivity between two different systems or modules. This testing method involves testing two different implementations or versions of the system under the same input conditions and comparing their output results to ensure consistency.
[0081] In an embodiment of the present application, the preset testing tool may include a TestManager tool based on the MATLAB environment; wherein the TestManager tool is a tool in an integrated development environment (IDE) provided by MathWorks, which is used to manage and execute tests, and can create, organize and run various types of tests to ensure the quality, reliability and performance of program code.
[0082] As an example of a target source code configuration for a software under test whose target function is to implement a control that the numerical value of an input value shall not exceed 100, the target source code may include: "void limtUpFunc100(uint8 Input,uint8*Output){if(Input>100) / / input value exceeds 100{*Output=100; / / output 100}else / / input value is less than 100{*Output=Input; / / output input value}}".
[0083] In this step, at least one test case is loaded and input into the expected result model using a preset test tool, and at least one test case is loaded and input into the target source code configured in the software to be tested. The test cases are executed by the expected result model and the target source code configured in the software to be tested respectively to obtain the expected result output by the expected result model and the running result output by the target source code.
[0084] S103, judging whether the expected result is consistent with the running result, obtaining a judgment result, and determining the judgment result as the test result corresponding to the target function, so as to determine whether the target function of the software to be tested meets the functional requirements indicated by the demand information.
[0085] In this step, the expected result output by the expected result model and the running result output by the target source code are compared to determine whether the expected result is consistent with the running result, and a judgment result is obtained. Furthermore, based on the judgment result, the test result corresponding to the target function is determined to determine whether the target function of the software to be tested meets the functional requirements indicated by the demand information.
[0086] In one embodiment of the present application, in a specific implementation, the step of determining the judgment result as the test result corresponding to the target function in step S103 to determine whether the target function of the software to be tested meets the functional requirements indicated by the requirement information may include:
[0087] S1031. When the judgment result is that the expected result is consistent with the running result, it is determined that the test result corresponding to the target function is in line with expectations, so as to determine that the target function of the software to be tested meets the functional requirements indicated by the demand information.
[0088] S1032. When the judgment result is that the expected result is inconsistent with the running result, it is determined that the test result corresponding to the target function does not meet expectations, so as to determine that the target function of the software to be tested does not meet the functional requirements indicated by the demand information.
[0089] Optional, see Figure 3 , Figure 3 This is a second flow chart of a method for testing software functions provided in an embodiment of the present application. Figure 3 As shown in , in addition to the software function testing method described in steps S101 to S103, the embodiment of the present application also includes step S104. Specifically, step S104 is used to illustrate a method for generating a test report using information corresponding to the test results.
[0090] S104. Obtain the implementation process information corresponding to the expected result model and the target source code respectively, and generate a test report corresponding to the back-to-back test for the target function based on the test result, the implementation process information, and the test execution time corresponding to the expected result and the running result respectively.
[0091] In this step, during the specific implementation, first, obtain the implementation process information corresponding to the expected result model and the target source code respectively; then, determine the test execution time corresponding to the expected result and the running result respectively; finally, based on the test results, implementation process information and test execution time, generate a test report corresponding to the back-to-back test for the target function.
[0092] In the embodiment of the present application, the implementation process information may include but is not limited to implementation process debugging data, time required for the implementation process, and implementation process running prompt information, etc.
[0093] Here, the test report may include but is not limited to test results, implementation process information and test execution time; wherein the test results reflect the comparison between the expected result model and the execution results of the target source code.
[0094] The software function testing method provided in the embodiment of the present application constructs an expected result model and test cases corresponding to the target function by testing the requirement information of the target function of the software to be tested, and uses a testing tool to load the test cases into the expected result model and the target source code of the software to be tested, respectively, to obtain the running results of back-to-back tests for the target function, to efficiently and accurately build a test environment without relying on external hardware devices, and to determine whether the target function meets the functional requirements indicated by the requirement information based on the running results, so as to quickly complete the full coverage test of the software function, thereby improving the efficiency of software function testing and reducing the complexity of software function testing.
[0095] See also Figure 4 , Figure 5 , Figure 4 This is one of the structural schematic diagrams of a software function testing device provided in an embodiment of the present application, Figure 5 This is a second structural diagram of a software function testing device provided in an embodiment of the present application. Figure 4 As shown in , the testing device 400 comprises:
[0096] The model building module 410 is used to, in response to receiving the requirement information for testing the target function of the software to be tested, build an expected result model and at least one test case corresponding to the target function based on the requirement information;
[0097] A use case execution module 420 is used to use a preset test tool to load the test case into the expected result model and the target source code of the software configuration to be tested, respectively, to obtain the expected result output by the expected result model and the running result output by the target source code, so as to perform back-to-back testing on the target function;
[0098] The test judgment module 430 is used to judge whether the expected result is consistent with the running result, obtain a judgment result, and determine the judgment result as the test result corresponding to the target function to determine whether the target function of the software under test meets the functional requirements indicated by the demand information.
[0099] Further, such as Figure 5 As shown in , the test device 400 further includes a test result module 440, and the test result module 440 is used to:
[0100] The implementation process information corresponding to the expected result model and the target source code is obtained, and based on the test result, the implementation process information and the test execution time corresponding to the expected result and the running result, a test report corresponding to the back-to-back test for the target function is generated.
[0101] Furthermore, when the model building module 410 is used to build the expected result model corresponding to the target function based on the demand information, the model building module 410 is used to:
[0102] Based on the demand information, determine the limiting conditions of the target function, and based on the limiting conditions, set a limiting module corresponding to the expected result model;
[0103] Based on the preset test data, setting the input module and the output module corresponding to the expected result model for the limited module;
[0104] Based on the input module, the output module and the limiting module, an expected result model corresponding to the target function is constructed.
[0105] Furthermore, when the model building module 410 is used to build at least one test case corresponding to the target function based on the requirement information, the model building module 410 is used to:
[0106] Based on the limiting condition, determining at least one logical threshold corresponding to the target function;
[0107] Based on the numerical value type corresponding to the input module, determining a plurality of type limit values corresponding to the target function;
[0108] At least one test case corresponding to the target function is constructed based on the logic threshold and the type limit value.
[0109] Further, when the test judgment module 430 is used to determine the judgment result as the test result corresponding to the target function to determine whether the target function of the software to be tested meets the functional requirements indicated by the requirement information, the test judgment module 430 is used to:
[0110] When the judgment result is that the expected result is consistent with the running result, the test result corresponding to the target function is determined to be in accordance with the expectation, so as to determine that the target function of the software to be tested meets the functional requirements indicated by the requirement information;
[0111] When the judgment result is that the expected result is inconsistent with the running result, it is determined that the test result corresponding to the target function does not meet expectations, so as to determine that the target function of the software to be tested does not meet the functional requirements indicated by the demand information.
[0112] The software function testing device provided in the embodiment of the present application constructs an expected result model and test cases corresponding to the target function by testing the requirement information of the target function of the software to be tested, and uses a testing tool to load the test cases into the expected result model and the target source code of the software to be tested, respectively, to obtain the running results of back-to-back tests for the target function, efficiently and accurately build a test environment without relying on external hardware devices, and determine whether the target function meets the functional requirements indicated by the requirement information based on the running results, so as to quickly complete the full coverage test of the software function, improve the efficiency of software function testing, and thereby reduce the complexity of software function testing.
[0113] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 6 As shown in , the electronic device 600 includes a processor 610 , a memory 620 and a bus 630 .
[0114] The memory 620 stores machine-readable instructions executable by the processor 610. When the electronic device 600 is running, the processor 610 communicates with the memory 620 via the bus 630. When the machine-readable instructions are executed by the processor 610, the above-mentioned Figure 1 as well as Figure 3 The steps of the method for testing the software function in the method embodiment shown and the specific implementation thereof can be found in the method embodiment, which will not be described in detail here.
[0115] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 as well as Figure 3 The steps of the method for testing the software function in the method embodiment shown and the specific implementation thereof can be found in the method embodiment, which will not be described in detail here.
[0116] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0117] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0118] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0119] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0120] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0121] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for testing software functions, characterized in that: The test method includes: In response to receiving requirement information for testing a target function of the software to be tested, constructing an expected result model and at least one test case corresponding to the target function based on the requirement information; Using a preset test tool, the test case is loaded into the expected result model and the target source code of the software to be tested, respectively, to obtain the expected result output by the expected result model and the running result output by the target source code, so as to perform back-to-back testing on the target function; Determine whether the expected result is consistent with the running result, obtain a determination result, and determine the determination result as the test result corresponding to the target function to determine whether the target function of the software to be tested meets the functional requirements indicated by the demand information.
2. The method according to claim 1, characterized in that The test method also includes: The implementation process information corresponding to the expected result model and the target source code is obtained, and based on the test result, the implementation process information and the test execution time corresponding to the expected result and the running result, a test report corresponding to the back-to-back test for the target function is generated.
3. The method according to claim 1, characterized in that The step of constructing an expected result model corresponding to the target function based on the demand information includes: Based on the demand information, determine the limiting conditions of the target function, and based on the limiting conditions, set a limiting module corresponding to the expected result model; Based on the preset test data, setting the input module and the output module corresponding to the expected result model for the limited module; Based on the input module, the output module and the limiting module, an expected result model corresponding to the target function is constructed.
4. The method according to claim 3, characterized in that At least one test case corresponding to the target function is constructed based on the requirement information by the following steps: Based on the limiting condition, determining at least one logical threshold corresponding to the target function; Based on the numerical value type corresponding to the input module, determining a plurality of type limit values corresponding to the target function; At least one test case corresponding to the target function is constructed based on the logic threshold and the type limit value.
5. The method according to claim 1, characterized in that Determining the judgment result as the test result corresponding to the target function to determine whether the target function of the software to be tested meets the functional requirements indicated by the requirement information includes: When the judgment result is that the expected result is consistent with the running result, the test result corresponding to the target function is determined to be in accordance with the expectation, so as to determine that the target function of the software to be tested meets the functional requirements indicated by the requirement information; When the judgment result is that the expected result is inconsistent with the running result, it is determined that the test result corresponding to the target function does not meet expectations, so as to determine that the target function of the software to be tested does not meet the functional requirements indicated by the demand information.
6. A software function testing device, characterized in that: The testing device comprises: A model building module, configured to, in response to receiving requirement information for testing a target function of the software to be tested, build an expected result model and at least one test case corresponding to the target function based on the requirement information; A use case execution module, used to use a preset test tool to load the test case into the expected result model and the target source code of the software configuration to be tested, respectively, to obtain the expected result output by the expected result model and the running result output by the target source code, so as to perform back-to-back testing on the target function; The test judgment module is used to judge whether the expected result is consistent with the running result, obtain a judgment result, and determine the judgment result as the test result corresponding to the target function to determine whether the target function of the software to be tested meets the functional requirements indicated by the demand information.
7. The device according to claim 6, characterized in that The testing device further comprises a test result module, wherein the test result module is used to: The implementation process information corresponding to the expected result model and the target source code is obtained, and based on the test result, the implementation process information and the test execution time corresponding to the expected result and the running result, a test report corresponding to the back-to-back test for the target function is generated.
8. The device according to claim 6, characterized in that When the model building module is used to build the expected result model corresponding to the target function based on the demand information, the model building module is used to: Based on the demand information, determine the limiting conditions of the target function, and based on the limiting conditions, set a limiting module corresponding to the expected result model; Based on the preset test data, setting the input module and the output module corresponding to the expected result model for the limited module; Based on the input module, the output module and the limiting module, an expected result model corresponding to the target function is constructed.
9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and the machine-readable instructions are executed by the processor to perform the steps of the software function testing method as described in any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the software function testing method according to any one of claims 1 to 5 are executed.