Test method, device, storage medium and computer equipment of software code
By setting interface identifiers and automated test target interfaces in the system engineering code, the problem of low efficiency in functional testing of system engineering code is solved, achieving efficient automated testing and reducing labor costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PINGAN YIQIANBAO E COMMERCE CO LTD
- Filing Date
- 2022-11-15
- Publication Date
- 2026-07-03
Smart Images

Figure CN115904966B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, storage medium, and computer device for testing software code. Background Technology
[0002] During software development, vulnerabilities in the system code often prevent applications from implementing certain interface functionalities. After developers fix the vulnerabilities, they still need to deploy the modified code. However, modifying the application code may cause previously working interface functionalities to malfunction due to the code changes.
[0003] Faced with the above situation, after the code is deployed and it is confirmed that the abnormal interface function has been fixed, developers often manually judge whether each previously normal interface function can perform its corresponding function in order to determine whether the problem of the previously normal interface function being unable to be implemented has occurred due to the error in the system engineering code modification.
[0004] However, the above method requires a lot of work to verify the interface functions of the deployed system engineering code, resulting in low efficiency in the functional testing of the system engineering code. Summary of the Invention
[0005] In view of this, this application provides a method, apparatus, storage medium and computer equipment for testing software code, the main purpose of which is to solve the technical problem of low efficiency in functional testing of system engineering code.
[0006] According to a first aspect of the present invention, a method for testing software code is provided, the method comprising:
[0007] Obtain the system engineering code that performs the deployment operation;
[0008] Based on the system engineering code, an interface identifier pre-set on the application programming interface of the system engineering code is identified, wherein the interface identifier includes a code calling rule identifier;
[0009] Identify the modified code segment in the system engineering code, and based on the modified code segment, determine the application interface corresponding to the modified code segment as the target interface;
[0010] In response to the software deployment instruction, based on the interface identifier of the target interface, interface testing is performed on the target interface to obtain the test results of the system engineering code, wherein the software deployment instruction is the instruction generated when the system engineering code is deployed.
[0011] According to a second aspect of the present invention, a software code testing apparatus is provided, the apparatus comprising:
[0012] The code acquisition module is used to acquire the system engineering code that performs deployment operations.
[0013] The identifier generation module is used to identify, based on the system engineering code, a pre-set interface identifier on the application programming interface of the system engineering code, wherein the interface identifier includes a code calling rule identifier;
[0014] The interface determination module is used to identify modified code segments in the system engineering code, and based on the modified code segments, determine the application interface corresponding to the modified code segments as the target interface;
[0015] The test execution module is used to respond to the software deployment instruction, perform interface testing on the target interface based on the interface identifier of the target interface, and obtain the test results of the system engineering code, wherein the software deployment instruction is the instruction generated when the system engineering code is deployed.
[0016] According to a third aspect of the present invention, a storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the test method of the software code described above.
[0017] According to a fourth aspect of the present invention, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a testing method for the software code described above.
[0018] The present invention provides a software code testing method, apparatus, storage medium, and computer equipment that can automatically test the interface functions of the modified parts of the code after the system engineering code is deployed, so as to determine whether the application has interface function abnormalities due to code modification errors. The above method can effectively avoid the test failure caused by manual testing of the modified parts of the code, thereby effectively reducing the labor cost of functional testing and improving the efficiency of functional testing of system engineering code.
[0019] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0020] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0021] Figure 1 This illustration shows a scenario of deploying system engineering code in a conventional software development process, as provided by an embodiment of the present invention.
[0022] Figure 2 A flowchart illustrating a software code testing method provided by an embodiment of the present invention is shown.
[0023] Figure 3 A schematic diagram of the structure of a software code testing device provided in an embodiment of the present invention is shown;
[0024] Figure 4 A schematic diagram of another software code testing device provided in an embodiment of the present invention is shown. Detailed Implementation
[0025] The present invention will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the present application can be combined with each other.
[0026] In software development, after developers fix vulnerabilities in an application, the modified code still needs to be deployed. However, modifications to the application code may cause previously working interface functions to malfunction. In such cases, even after confirming the malfunctioning interface has been fixed, manual verification of each previously working interface function is still necessary to determine if the issue stems from errors in the system engineering code, causing previously functional interface malfunctions. Interface functions are those that can be implemented by calling the interface, specifically through the application programming interface (API) of the system engineering code calling methods contained within the system engineering code. However, this approach requires a significant amount of work to verify the interface functions of the deployed system engineering code, resulting in low efficiency in functional testing of the system engineering code.
[0027] Please see Figure 1 , Figure 1 The document provides a schematic diagram illustrating scenarios for deploying system engineering code in existing software development processes, such as... Figure 1As shown, after developers fix a vulnerability that prevents the application from implementing a certain interface function, they store the fixed project code in the project object model repository 1 (Maven), and then commit the project code to the Git code repository 2. When they receive a project code packaging instruction, they send the project code to the Jenkins packaging platform 3 for packaging. When they receive a deployment instruction for the system project code, they send the packaged project code to the deployment platform 4 for deployment. At this point, developers test whether each interface function of the project code can implement the corresponding function and obtain the test results. However, this testing method requires a lot of work to verify the interface functions of the deployed system project code, resulting in low efficiency in functional testing of the system project code.
[0028] To address the above problems, in one embodiment, such as Figure 2 As shown, a method for testing software code is provided. Taking the application of this method to a computer device as an example, the method includes the following steps:
[0029] 101. Obtain the system engineering code for executing deployment operations.
[0030] The system engineering code that performs the deployment operation is the engineering code modified by the developers from the code of the application with vulnerabilities.
[0031] Specifically, the modified project code can be retrieved from the project object model repository that stores the project code, based on a preset code retrieval plugin.
[0032] 102. Based on the system engineering code, identify the interface identifier that is pre-set on the application programming interface of the system engineering code.
[0033] The interface identifier is a pre-written identifier by developers used to determine the interface call rules for the application interface, whether it is an interface that needs to be exposed, and whether the batch processing method for that interface is for exception cases or normal cases. It can exist as code within the system project code. Developers can set interface identifiers for the application interfaces corresponding to the modified code when modifying the system project code, thereby enabling testing of the system project code.
[0034] In this embodiment, the application programming interface (API) of the system engineering code can be determined by identifying the code information corresponding to the interface identifier in the system engineering code. Furthermore, the interface identifier can also include a normal case identifier or an exception case identifier. For example, the normal case identifier can be in the form of @NormalCase(author = "interface author name", title = "test software code test"), while the exception case identifier can be in the form of @ExceptionCase(author = "interface author name", title = "test software code test"), where author identifies the engineer who modified the code corresponding to the application API, and title identifies the name of the application API and indicates its function, such as "query order list normal case query". Further, @NormalCase indicates that the application API needs to be run in a normal case batch, and @ExceptionCase indicates that the application API needs to be run in an exception case batch. A normal case batch run indicates that the application API's test result is normal when the test module's test result for the application API's function is normal; an exception case batch run indicates that the application API's test result is normal when the test module's test result for the application API's function is abnormal. By setting up exception cases for batch testing, you can simulate whether abnormal test results can be obtained when there are human error parameters in the code corresponding to the application interface function, in order to test the application interface function.
[0035] Furthermore, the interface identifier can also include an exposed interface identifier, which is used to mark the application interface as an application interface that needs to be exposed to the outside world when performing interface testing. As an example, the exposed interface identifier can be @PAFDoc(author="interface author name", title="test software code test software code test"), where author is used to identify the engineer who made the modification to the code corresponding to the application interface, and title is used to identify the name of the application interface and mark the function of the application interface.
[0036] Furthermore, the interface identifier includes a code invocation rule identifier, used to indicate the rules to be used when calling the application interface. In other words, if an external test module needs to access the application interface, it must follow the application interface's invocation rules to call the application interface and test the system project code. As an example, the code invocation rule identifier can be: `@CaseNormalData(value = "SF[0-9]{10}");` and
[0037] @CaseNormalData(value="SUB[0-9]{18}");
[0038] In this context, the value of @CaseNormalData, SF[0-9]{10}, represents the need to automatically generate order numbers starting with SF, followed by numbers, serving as the order identifier for this application interface. The value of @CaseNormalData, SUB[0-9]{18}, represents the need to automatically generate order numbers starting with SUB, followed by numbers, serving as the sub-order identifier for this application interface.
[0039] Furthermore, based on the order identifier and sub-order identifier, the calling rules for the application interface can be generated. External testing modules can identify the code calling rule identifier of the application interface and generate the calling rules for that application interface, thus enabling the calling of the application interface. Furthermore, the code calling rule identifier can also include normal case code calling rule identifiers and abnormal case code calling rule identifiers. The normal case code calling rule identifier can include a correct value to generate the correct order identifier and sub-order identifier, allowing the testing module to obtain the correct calling rule. Conversely, the abnormal case code calling rule identifier can include an incorrect value to generate an incorrect order identifier and sub-order identifier, causing the testing module to obtain an incorrect calling rule. When the testing module calls the application interface using an incorrect calling rule, it indicates a problem with the application interface's calling method, requiring modification. Specifically, the abnormal case code calling rule identifier can take the form of `@CaseExceptionData(value = "[100-9]{29}")`, where the value is an incorrect value, generating an incorrect calling rule. Furthermore, the normal case code call rule identifier can take the form of @CaseNormalData(value="SF[0-9]{10}"); and
[0040] @CaseNormalData(value="SUB[0-9]{18}").
[0041] Specifically, the code retrieval plugin set in the project object model repository can retrieve normal case identifiers, abnormal case identifiers, exposed interface identifiers, and code call rule identifiers, and send them to the test module. Furthermore, the test module can be a dedicated case batch server.
[0042] 103. Identify the modified code segment in the system engineering code, and based on the modified code segment, determine the application interface corresponding to the modified code segment as the target interface.
[0043] Specifically, the Jenkins packaging platform can compare the modified project code with the original project code to identify the changed code snippets. Based on the modified code snippets, the method to which they belong can be determined. Further, the application programming interface (API) corresponding to the code snippets for those methods can be identified, and this API can be designated as the target API.
[0044] 104. In response to the software deployment command, based on the interface identifier of the target interface, perform interface testing on the target interface to obtain the test results of the system engineering code.
[0045] The software deployment instruction is the instruction generated when the system engineering code is deployed.
[0046] Specifically, based on a pre-set test server, normal test case identifiers, abnormal test case identifiers, exposed interface identifiers, and code calling rule identifiers can be received to determine the target interfaces of the system engineering code to be tested and the calling rules of the target interfaces. Furthermore, when a software deployment instruction is received, the target interfaces are called, and the interface functions of the target interfaces are tested to determine whether each interface function has lost its corresponding functionality due to code modification.
[0047] The software code testing method provided in this embodiment first obtains the system engineering code to be deployed, identifies the interfaces that need to be exposed in the system engineering code, and obtains the calling rules for each interface. The functionality of the interface is determined by judging whether it can be called based on the calling rules. Then, the modified parts of the system engineering code are identified, and the interfaces corresponding to these modifications are determined. Finally, when the system engineering code is deployed, it is determined whether the interfaces corresponding to the modified parts can be called based on the calling rules, thus determining whether each interface in the modified parts can implement its corresponding interface function, and consequently, the test results of the system engineering code are determined. This application can automatically test the interface functions of the modified parts after the system engineering code is deployed to determine whether the application has interface function abnormalities due to code modification errors. The above method can effectively avoid test failures caused by manual testing of modified parts, thereby effectively reducing the labor cost of functional testing and improving the efficiency of functional testing of system engineering code.
[0048] In the embodiments of this application, step 103 can be implemented as follows: First, obtain the modified code segment in the system engineering code. The modified code segment is the code fragment changed by the developer to fix vulnerabilities. Specifically, the modified system engineering code can be compared with the original system engineering code on the Jenkins packaging platform to identify the changed code and determine the method corresponding to the changed code. Then, determine all methods contained in the system engineering code and the code segment method of the modified code segment. Specifically, the method corresponding to the changed code can be identified as the code segment method. Simultaneously, the name of the method to which the code segment belongs can be determined based on the code identifier or annotation information of the code segment. Finally, determine the application programming interface (API) in the system engineering code segment corresponding to the code segment method as the target interface. Not every method in the system engineering code has an API that can be directly called externally. For some core methods in the system engineering code, they are called externally through APIs on other methods by establishing a calling relationship with them. Furthermore, the application programming interface (API) in the system engineering code segment corresponding to the code segment method can be an API that the code segment method itself directly calls from the outside, or it can be an API that is indirectly called from the outside through other methods via the aforementioned calling relationship. This API is then identified as the target interface, allowing the determination of whether the function to be implemented by the code segment method is normal by judging whether the interface function of this API is normal. In the embodiments of this application, by determining the API that can call the code segment method, subsequent testing of the function to be implemented by the code segment method can be performed using the API.
[0049] In embodiments of this application, the method for determining the application programming interface (API) in the system engineering code segment corresponding to the code segment method as the target interface includes: First, determining all APIs contained in the system engineering code, locating the method corresponding to each API, and determining the method as the API method. Specifically, by identifying the code information corresponding to the interface identifier in the system engineering code, all APIs in the system engineering code are determined, and methods that can be directly called through the APIs are determined, and the methods that can be directly called through the APIs are determined as API methods. Then, the method path relationship between the methods with calling relationships contained in the system engineering code is determined. Specifically, among the methods contained in the system engineering code, API methods with interfaces that can be directly called from the outside are determined. Further, based on the calling relationship between methods, all methods that directly or indirectly call the API method are determined level by level, and the complete hierarchical calling relationship corresponding to the API method is obtained. Subsequently, the method path relationship between the API method and the methods that directly or indirectly call it can be determined based on the hierarchical calling relationship. Specifically, if a method in the system project code calls another method, the code corresponding to that method will contain a field containing the code that calls the other method. The name of the called method can be determined from this field. For example, if the code corresponding to a certain method is:
[0050]
[0051] Here, "AAA" represents the names of other methods called by this method. This confirms the existence of a calling relationship between the two methods. Furthermore, by determining the calling relationship between methods level by level, the method path relationship between methods with direct or indirect calling relationships within the system engineering code can be obtained. Finally, based on the method path relationship between the methods with calling relationships, the application programming interface (API) method corresponding to the code segment method is determined, and the API corresponding to the API method is identified as the target interface. In the embodiments of this application, the API method corresponding to the code segment method can be quickly identified as the target interface, increasing the efficiency of software code testing.
[0052] In one embodiment, the method described in step 104, which responds to a software deployment instruction and performs interface testing on the target interface based on its interface identifier to obtain the test results of the system engineering code, includes: First, receiving a software deployment instruction and determining whether the system engineering code has been successfully deployed based on the instruction. The software deployment instruction is generated when the system engineering code is successfully deployed. Specifically, the software deployment instruction can be sent by the deployment platform to the test case server after deploying the system engineering code, indicating that the modified system engineering code has been deployed. The test case server can then begin interface testing of the system engineering code's interface functionality. Then, if the system engineering code is successfully deployed, interface testing is performed on the target interface to obtain the test results. The test results of the system engineering code include the test results of the target interface. Specifically, the functional testing of the system engineering code is achieved by testing the interface functionality of the application programming interface (API) of the system engineering code. The application programming interface (API) allows testing of modified code segments that have call relationships with API methods, thereby enabling functionality testing of these code segments and determining whether application interface malfunctions are caused by code modification errors. Furthermore, after the deployment platform successfully deploys the system project code to the server, it obtains the server's Internet Protocol (IP) address and the branch path deployed within the server. Further, by parsing the software deployment instruction, it can be determined whether the instruction includes the network identifier of the server deploying the system project code and the deployment path of the system project code within the server, thus confirming successful deployment. Specifically, the deployment result of the system project code can be determined based on a batch processing plugin set within the deployment platform, and a software deployment instruction can be issued to the test batch processing server. Further, if the software deployment instruction includes the network identifier and the deployment path, the system project code is considered successfully deployed. In the embodiments of this application, interface testing of the target interface can be performed after it is determined that the system engineering code has been successfully deployed, and the test results of the interface test can be obtained, thus avoiding invalid tests caused by performing interface testing before the system engineering code is successfully deployed.
[0053] In one embodiment, the test result includes test success and test failure. After step 104, the method further includes: determining whether the test result is a test failure. Specifically, when the interface identifier of the target interface includes a normal case identifier, if the interface function can be implemented based on the target interface, the test result is determined to be a test success; if the interface function cannot be implemented based on the target interface, the test result is determined to be a test failure. When the interface identifier of the target interface includes an abnormal case identifier, if the interface function can be implemented based on the target interface, the test result is determined to be a test failure; if the interface function cannot be implemented based on the target interface, the test result is determined to be a test success. Further, if the test result is a test failure, an alarm notification is issued. Specifically, the test failure information can be sent to relevant personnel by sending an alarm email or an audio-visual message. In the embodiments of this application, an alarm notification can be sent to relevant personnel in a timely manner in the event of a test failure, so that relevant personnel can investigate the cause of the test failure and take further action.
[0054] In one embodiment, after step 104, the method further includes: first, if the test result is a test failure, obtaining the target interface that failed the test and the modified code segment corresponding to the target interface. Then, storing the target interface and the modified code segment for retrieval by a host computer. The host computer can be a computer terminal that manages the deployment of system engineering code. Specifically, the target interface and the modified code segment can be stored in a test batch server or a storage server connected to the test batch server. In the embodiments of this application, the modified code segment and the target interface can be stored for retrieval by relevant personnel when judging the cause of the test failure, improving the efficiency of judging the cause of the test failure.
[0055] The software code testing method provided in this embodiment can automatically identify modified code segments and their corresponding methods after the system engineering code is deployed. It then determines the application interface that can call these methods, enabling testing of the interface functionality of the modified code. This allows for the determination of whether the application is experiencing interface functionality issues due to code modification errors, and timely notifications are issued when tests fail. This method effectively avoids test failures caused by manual testing of modified code, thereby significantly reducing the labor costs of functional testing and improving the efficiency of functional testing of system engineering code.
[0056] Furthermore, as Figure 3 The specific implementation of the method shown in this embodiment provides a software code testing device, such as... Figure 3 As shown, the device includes: a code acquisition module 21, an identifier generation module 22, an interface determination module 23, and a test execution module 24.
[0057] Code acquisition module 21 can be used to acquire the system engineering code that performs deployment operations;
[0058] The identifier generation module 22 can be used to identify pre-set interface identifiers on the application programming interface of the system engineering code based on the system engineering code, wherein the interface identifiers include code calling rule identifiers;
[0059] The interface determination module 23 can be used to identify modified code segments in the system engineering code, and based on the modified code segments, determine the application interface corresponding to the modified code segments as the target interface;
[0060] The test execution module 24 can be used to perform interface testing on the target interface based on the interface identifier of the target interface in response to the software deployment instruction, and obtain the test results of the system engineering code, wherein the software deployment instruction is the instruction generated when the system engineering code is deployed.
[0061] In specific application scenarios, the interface determination module 23 can be used to obtain the modified code segment in the system engineering code; determine all methods contained in the system engineering code and the code segment method of the modified code segment; and determine the application interface in the system engineering code fragment corresponding to the code segment method as the target interface.
[0062] In specific application scenarios, the interface determination module 23 can also be used to determine all application programming interfaces (APIs) contained in the system engineering code, locate the method corresponding to each API, and determine the method as the API method; determine the method path relationship between the methods with calling relationships contained in the system engineering code; determine the API method corresponding to the code segment method based on the method path relationship between the methods with calling relationships, and determine the API corresponding to the API method as the target interface.
[0063] In a specific application scenario, the test execution module 24 can be used to receive software deployment instructions and determine whether the system engineering code has been successfully deployed based on the software deployment instructions; if the system engineering code is successfully deployed, then interface testing is performed on the target interface to obtain the test results of the interface test, wherein the test results of the system engineering code include the test results of the target interface.
[0064] In specific application scenarios, the test execution module 24 can also be used to parse the software deployment instruction and determine whether the software deployment instruction includes the network identifier of the server that deploys the system engineering code and the deployment path of the system engineering code deployed on the server; if the software deployment instruction includes the network identifier and the deployment path, then the system engineering code is determined to have been successfully deployed.
[0065] In specific application scenarios, such as Figure 4 As shown, this device also includes an alarm notification module 35, which is specifically used to determine whether the test result is a test failure; if the test result is a test failure, an alarm notification message is issued.
[0066] In specific application scenarios, such as Figure 4 As shown, the device also includes a data storage module 36, which is specifically used to obtain the target interface that failed the test and the modified code segment corresponding to the target interface when the test result is a test failure; and to store the target interface and the modified code segment for retrieval by the host computer.
[0067] It should be noted that other corresponding descriptions of the functional units involved in the software code testing device provided in this embodiment can be found in [reference needed]. Figure 2 The corresponding description in [the document] will not be repeated here.
[0068] Based on the above, Figure 2 Accordingly, this embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements the above-described method. Figure 2 The software code shown illustrates the testing method.
[0069] Based on this understanding, the technical solution of this application can be embodied in the form of a software product. The software product to be identified can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, or portable hard drive), including several instructions to cause a computer device (such as a personal computer, server, or network device) to execute the methods described in the various implementation scenarios of this application.
[0070] Based on the above, Figure 2 The method shown, and Figure 3 and Figure 4The illustrated embodiment of the software code testing apparatus, in order to achieve the above objectives, also provides a physical device for testing software code. Specifically, this device can be a personal computer, server, smartphone, tablet computer, smartwatch, or other network device, etc. The physical device includes a storage medium and a processor; the storage medium is used to store computer programs; the processor is used to execute the computer programs to achieve the above-described... Figure 2 The method shown.
[0071] Optionally, the physical device may also include a user interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB interfaces, card reader interfaces, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Wi-Fi interfaces), etc.
[0072] Those skilled in the art will understand that the physical device structure for testing software code provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or combine certain components, or have different component arrangements.
[0073] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the aforementioned physical device, supporting the operation of information processing programs and other software and / or programs to be identified. The network communication module is used to enable communication between the various components within the storage medium, as well as communication with other hardware and software in the information processing physical device.
[0074] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms, or it can be implemented by hardware. By applying the technical solution of this application, firstly, the system engineering code for performing deployment operations is obtained; then, based on the system engineering code, an interface identifier pre-set on the application programming interface of the system engineering code is identified, wherein the interface identifier includes a code calling rule identifier; next, the modified code segment in the system engineering code is identified, and based on the modified code segment, the application programming interface corresponding to the modified code segment is determined as the target interface; finally, in response to the software deployment instruction, based on the interface identifier of the target interface, interface testing is performed on the target interface to obtain the test result of the system engineering code, wherein the software deployment instruction is the instruction generated when the system engineering code is deployed. Compared with the prior art, it can effectively avoid the problem of test failure caused by manual testing of modified parts of the code, thereby effectively reducing the labor cost of functional testing and improving the efficiency of functional testing of system engineering code.
[0075] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application. Those skilled in the art will understand that the modules in the apparatus of the embodiment can be distributed within the apparatus of the embodiment as described, or can be modified to be located in one or more apparatuses different from this embodiment. The modules of the above-described embodiment can be combined into one module, or further divided into multiple sub-modules.
[0076] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of any particular implementation scenario. The above disclosures are merely a few specific implementation scenarios of this application; however, this application is not limited thereto, and any variations conceived by those skilled in the art should fall within the protection scope of this application.
Claims
1. A method for testing software code, characterized in that, The method includes: Obtain the system engineering code that performs the deployment operation; Based on the system engineering code, an interface identifier pre-set on the application programming interface of the system engineering code is identified, wherein the interface identifier includes a code calling rule identifier; Obtain the modified code segment in the system project code; determine all methods contained in the system project code and the code segment method of the modified code segment; determine all application programming interfaces (APIs) contained in the system project code, locate the method corresponding to each API, and determine the method corresponding to the API as the API method; determine the method path relationship between methods with calling relationships in the system project code; based on the method path relationship, determine the API method corresponding to the code segment method, and determine the API corresponding to the API method as the target interface; The system receives a software deployment instruction and parses it. It then determines whether the instruction includes the network identifier of the server deploying the system engineering code and the deployment path of the system engineering code within that server. If the instruction includes the network identifier and the deployment path, the system engineering code is considered successfully deployed. If the system engineering code is successfully deployed, an interface test is performed on the target interface to obtain the test results. The test results for the system engineering code include the test results for the target interface. The software deployment instruction is the instruction generated when the system engineering code completes deployment.
2. The method according to claim 1, characterized in that, The test results include test success and test failure; the method also includes: Determine whether the test result is a test failure; If the test result is a test failure, an alarm message will be issued.
3. The method according to claim 2, characterized in that, The method further includes: If the test result is a test failure, obtain the target interface that failed the test and the corresponding modified code segment; The target interface and the modified code segment are stored for retrieval by the host computer.
4. A software code testing device, characterized in that, The device includes: The code acquisition module is used to acquire the system engineering code that performs deployment operations. The identifier generation module is used to identify, based on the system engineering code, a pre-set interface identifier on the application programming interface of the system engineering code, wherein the interface identifier includes a code calling rule identifier; An interface determination module is used to: acquire modified code segments in the system engineering code; determine all methods contained in the system engineering code and the code segment methods of the modified code segments; determine all application programming interfaces (APIs) contained in the system engineering code, locate the method corresponding to each API, and determine the method corresponding to the API as the API method; determine the method path relationship between methods with calling relationships in the system engineering code; and determine the API method corresponding to the code segment method based on the method path relationship, and determine the API corresponding to the API method as the target interface. The test execution module is used to receive software deployment instructions, parse the software deployment instructions, and determine whether the software deployment instructions include the network identifier of the server deploying the system engineering code and the deployment path of the system engineering code within the server; if the software deployment instructions include the network identifier and the deployment path, the system engineering code is determined to have been successfully deployed; if the system engineering code is successfully deployed, interface testing is performed on the target interface to obtain the interface test results, wherein the test results of the system engineering code include the test results of the target interface, and the software deployment instructions are the instructions generated when the system engineering code is deployed.
5. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.
6. 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 computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.