Interface testing method and device and electronic equipment

By dynamically compiling and registering in the test interface system, the modified source code is directly passed to the system for testing, which solves the problem that the system needs to be restarted in the existing technology to test the modified source code, and improves the development efficiency and system flexibility.

CN119003367APending Publication Date: 2024-11-22YUNLI ZHIHUI TECH CLOUD WISDOM TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411213320.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

In the prior art, the system needs to be restarted before the modified source code is tested, resulting in inefficient development.

Method used

By dynamically compiling and registering in the test interface system, obtaining functional interfaces, and directly passing the modified source code to the system for testing when the test results do not meet the preset standards, avoiding restarting the system.

Benefits of technology

Improve development efficiency, reduce waiting time and error risks during compilation and testing, and enhance system flexibility and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003367A_ABST
    Figure CN119003367A_ABST
Patent Text Reader

Abstract

The invention provides an interface testing method and device and electronic equipment, and relates to the technical field of software development. The interface testing method is applied to the interface testing system and comprises the steps that source codes are obtained, and the source codes are dynamically compiled to obtain classes; performing dynamic registration on the class to obtain a function interface; receiving a test command of a user, and testing the functional interface based on the test command to obtain a test result; and under the condition that the test result does not meet the preset standard, obtaining the modified source code, and repeating the previous steps until the test result meets the preset standard, so that the modified source code can be tested without restarting the system, and the development efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to a test interface method, device and electronic equipment. Background Art

[0002] When testing the functions of the source code corresponding to the application, after obtaining the source code, the source code is generally compiled to obtain the corresponding JAR file, the JAR file is transferred to the system, and the business logic and other functions of the JAR file are tested through the interface provided by the system. However, after modifying the source code based on the test results, the system needs to be restarted and the above process needs to be repeated before the modified source code can be tested in the system. Summary of the invention

[0003] The present invention provides a test interface method, device and electronic equipment, which are used to solve the defect in the prior art that the modified source code can only be tested after the system is restarted, thereby improving development efficiency.

[0004] The present invention provides a test interface method, which is applied to a test interface system. The method comprises: obtaining source code, dynamically compiling the source code to obtain a class; dynamically registering the class to obtain a functional interface; receiving a test command from a user, testing the functional interface based on the test command to obtain a test result; and when it is determined that the test result does not meet a preset standard, obtaining a modified source code, and repeating the above steps until the test result meets the preset standard.

[0005] According to a test interface method provided by the present invention, the test interface system includes a sandbox and a low-code platform; obtaining source code includes: obtaining the source code submitted by the low-code platform through the source code registration interface of the sandbox; wherein the source code is a passing parameter of the source code registration interface.

[0006] According to a method for testing an interface provided by the present invention, the source code is dynamically compiled to obtain a class, including: dynamically compiling the source code to obtain a Controller class, a Service interface class and a ServiceImpl implementation class; and dynamically registering the class, including: dynamically registering the Controller class, the Service interface class and the ServiceImpl implementation class.

[0007] According to a test interface method provided by the present invention, the Controller class, the Service interface class and the ServiceImpl implementation class are dynamically registered, including: when it is determined that the Controller class has been registered, the registered Controller class is deregistered; when it is determined that the Service interface class and the ServiceImpl implementation class have been registered, the registered Service interface class and the ServiceImpl implementation class are deregistered, and the Service interface class and the ServiceImpl implementation class obtained by dynamic compilation are re-registered; the Controller class obtained by dynamic compilation is re-registered.

[0008] According to a test interface method provided by the present invention, obtaining the modified source code includes: receiving an adjustment command sent by the user to the low-code platform based on the test results and the preset standard; modifying the low-code model in the low-code platform based on the adjustment command, and parsing the modified low-code model to obtain parsed data of the modified low-code model; generating the modified source code based on the parsed data and a preset code template; and obtaining the modified source code submitted by the low-code platform through the source code registration interface of the sandbox.

[0009] The present invention also provides a test interface device, which is applied to a test interface system, and the device includes: a class acquisition module, which is used to acquire source code and dynamically compile the source code to acquire a class; a functional interface acquisition module, which is used to dynamically register the class to obtain a functional interface; a test result acquisition module, which is used to receive a user's test command and test the functional interface based on the test command to acquire a test result; and a result judgment module, which is used to determine that the test result does not meet the preset standard, acquire the modified source code, and repeat the above steps until the test result meets the preset standard.

[0010] According to a test interface device provided by the present invention, the test interface system includes a sandbox and a low-code platform; the class acquisition module is specifically used to obtain the source code submitted by the low-code platform through the source code registration interface of the sandbox; wherein the source code is a transfer parameter of the source code registration interface.

[0011] According to a test interface device provided by the present invention, the class acquisition module is also used to: dynamically compile the source code to obtain the Controller class, Service interface class and ServiceImpl implementation class; the test result acquisition module is also used to dynamically register the Controller class, the Service interface class and the ServiceImpl implementation class.

[0012] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned test interface methods when executing the computer program.

[0013] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the test interface method described in any one of the above is implemented.

[0014] Compared with the prior art of compiling source code to obtain the corresponding JAR file and passing it to the system, the test interface method, device and electronic device provided by the embodiments of the present invention pass the source code to the test interface system, dynamically compile the source code in the test interface system to obtain the class, dynamically register the class to obtain the functional interface, and test the functional interface. When the test result does not meet the preset standard and the source code needs to be modified to continue the test, there is no need to restart the test interface system. The modified source code can be directly passed to the test interface system and tested, which can improve development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0016] Figure 1 It is a flow chart of the test interface method provided by the present invention.

[0017] Figure 2 It is a structural schematic diagram of the test interface device provided by the present invention.

[0018] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0020] Combine the following Figure 1-Figure 3The test interface method, device and electronic device of the present invention are described.

[0021] Figure 1 is a flow chart of a test interface method provided by the present invention, which is applied to a test interface system, such as Figure 1 As shown, the method includes the following steps 110 to 140.

[0022] Step 110: Obtain source code, and dynamically compile the source code to obtain a class.

[0023] Source code is an uncompiled text file written in accordance with certain programming language specifications. For example, the source code can be Java source code or PHP source code. Dynamic compilation refers to the process of compiling the source code to generate bytecode and loading and executing the bytecode when the application is running. A class is a template for creating objects in object-oriented programming, which contains common properties and behavior rules of the objects. For example, the source code can be passed to a compiler, where the source code is dynamically compiled to generate bytecode, and the compiled bytecode is loaded into the runtime environment to obtain the class when the application is running.

[0024] Step 120: Dynamically register the class to obtain a functional interface.

[0025] Dynamic registration refers to the process of registering a class into the system when the application is running. Functional interfaces are interfaces that implement business logic and other functions, and can be used to verify and check interfaces for business logic and other functions. For example, the obtained class can be dynamically registered into a registration center or service container to obtain a functional interface that can be called externally.

[0026] Step 130: Receive a test command from the user, and test the functional interface based on the test command to obtain a test result.

[0027] The test result is the feedback or output provided to the user after the test command executes the corresponding operation. For example, the test result may include query results, calculation results, business logic processing results, operation status information, or error information corresponding to operation failure.

[0028] The functional interface can be tested by starting a preset automated test based on a test command and testing the functional interface through the automated test, or the test command can include input parameters of the functional interface and the functional interface can be tested through the input parameters.

[0029] Step 140: When it is determined that the test result does not meet the preset standard, obtain the modified source code and repeat the above steps until the test result meets the preset standard.

[0030] The preset standard may be a preset output parameter, which may correspond to an input parameter passed to the functional interface based on a test command. The input parameter passed to the functional interface based on a test command and the corresponding preset output parameter may be regarded as a set of test cases. Among them, the indicators and indicator ranges in the preset standard may be determined based on specific business needs and are not further limited here.

[0031] If the test results do not meet the preset standards, it indicates that the functional interface obtained based on the source code cannot meet the design requirements, and the source code needs to be modified so that the test results meet the preset standards to meet the design requirements.

[0032] Compared with the prior art of compiling source code to obtain the corresponding JAR file and passing it to the system, the test interface method provided by the embodiment of the present invention passes the source code to the test interface system, dynamically compiles the source code in the test interface system to obtain the class, dynamically registers the class to obtain the functional interface, and tests the functional interface. When the test result does not meet the preset standard and the source code needs to be modified to continue the test, there is no need to restart the test interface system. The modified source code can be directly passed to the test interface system, and the modified source code can be tested, which can improve development efficiency.

[0033] Based on the above embodiments, the test interface system includes a sandbox and a low-code platform.

[0034] Among them, the sandbox can provide a safe and isolated online operating environment. The sandbox can include standard development kits corresponding to the source code, such as the Java Development Kit (JDK).

[0035] In the context of a unified technology stack, a low-code platform is an online application development platform launched to improve development efficiency. A low-code platform can provide a drag-and-drop graphical interface, predefined modules, and automation functions to facilitate selection, configuration, and other operations to obtain a low-code model corresponding to the application. The low-code model may include information such as the data structure and business logic of the application.

[0036] The test interface system in this embodiment combines the low-code platform and the sandbox. It can utilize the efficient development capabilities of the low-code platform while utilizing the isolated testing environment of the sandbox to reduce the risk of the source code provided by the low-code platform in an automated manner affecting the normal operation of the system, thereby enhancing the flexibility and security of the system.

[0037] Obtaining source code, including: obtaining the source code submitted by the low-code platform through the source code registration interface of the sandbox; wherein the source code is a passing parameter of the source code registration interface.

[0038] It is understandable that the source code submitted by the low-code platform is the source code obtained by the low-code platform based on the low-code model. Compared with users directly writing or modifying source code, obtaining or modifying source code through the low-code platform in this embodiment can improve development efficiency. On the other hand, the low-code platform passes the source code to the sandbox, which is an operating environment. That is, in this embodiment, there is no need to pass the source code to the local for testing, thereby avoiding the waiting time required for the source code transfer process and possible source code damage, which can improve development efficiency and user experience.

[0039] Exemplarily, after obtaining the source code, the low-code platform can automatically submit the source code as a passing parameter to the source code registration interface of the sandbox environment, or it can submit the source code as a passing parameter to the source code registration interface of the sandbox environment after receiving the user's operation instructions.

[0040] In this embodiment, the source code registration interface is fixed. For example, in the process of obtaining source code and modified source code, the request method, path, parameter format, etc. of the source code registration interface are fixed. In this way, users can focus on the implementation of the business logic of the source code, thereby improving development efficiency.

[0041] The low-code platform can encapsulate the source code into the transfer parameters of the source code registration interface, and pass the transfer parameters to the source code registration interface. The sandbox can obtain the source code passed by the low-code platform by parsing the transfer parameters of the source code registration interface, so that the source code provided by the low-code platform can be tested in the sandbox without affecting the system. Moreover, in this embodiment, there is no need to compile and package the source code obtained from the low-code platform, and the source code is directly passed to the sandbox for testing, which can avoid the compilation time and possible compilation errors in the subsequent multiple modifications, improve development efficiency, and improve user experience.

[0042] Based on any of the above embodiments, dynamically compiling the source code to obtain classes includes: dynamically compiling the source code to obtain the Controller class, the Service interface class and the ServiceImpl implementation class; dynamically registering the classes includes: dynamically registering the Controller class, the Service interface class and the ServiceImpl implementation class.

[0043] The Controller class is a class that receives user input, which can be clicking a button, submitting a form, etc. The Service interface class is a class that defines a set of business logic. The ServiceImpl implementation class is a class that implements the business logic of the Service interface class. For example, the ServiceImpl implementation class can interact with the persistent storage volume and perform data addition, reading, updating, and deletion operations on the persistent storage volume. The persistent storage volume can include a database, etc.

[0044] Dynamic compilation of the source code can also obtain the Request entity and the Result entity. The Request entity can encapsulate the business data submitted by the user to obtain the input parameters of the Controller class. For example, the business data submitted by the user can be a test command, and the test command is encapsulated to obtain the input parameters of the Controller class, and the functional interface can be tested to obtain the test results. The Result entity can encapsulate the return result corresponding to the business data submitted by the user to obtain the output parameter of the Controller class. For example, the return result can be a test result.

[0045] In this embodiment, by dynamically registering the Controller class, Service interface class, and ServiceImpl implementation class, the newly compiled class is loaded without restarting the system, thereby improving the iteration speed of development and testing. Exemplarily, in the process of dynamic compilation and dynamic registration, only the modified source code part can be compiled and registered, which can optimize the use of system resources and facilitate the functional expansion and adjustment of the application corresponding to the source code. In addition, by obtaining the Controller class, Service interface class, and ServiceImpl implementation class corresponding to the source code, the independence of source code updates and tests is strengthened. In addition, the dynamic compilation and dynamic registration mechanism can allow multiple users to adjust and test different module parts of the source code.

[0046] Based on any of the above embodiments, the Controller class, the Service interface class and the ServiceImpl implementation class are dynamically registered, including: when it is determined that the Controller class has been registered, canceling the registered Controller class; when it is determined that the Service interface class and the ServiceImpl implementation class have been registered, canceling the registered Service interface class and the ServiceImpl implementation class, and re-registering the Service interface class and the ServiceImpl implementation class obtained by dynamic compilation; re-registering the Controller class obtained by dynamic compilation.

[0047] It is understandable that if the Controller class does not exist, it can be directly determined whether the Service interface class and the ServiceImpl implementation class have been registered. If the Service interface class and the ServiceImpl implementation class do not exist, for example, when the source code is obtained for the first time, the source code is dynamically compiled to obtain the class, and the class is dynamically registered, the Service interface class and the ServiceImpl implementation class obtained by dynamic compilation can be directly registered, and then the Controller class obtained by dynamic compilation can be directly registered.

[0048] The class name of the Controller class can be matched with the registered class name to simply and quickly determine whether there is a registered Controller class. For example, if the match is successful, it is determined that there is a registered Controller class, otherwise there is no registered Controller class. Exemplarily, the Controller class can be registered as a Bean in the Spring container. On this basis, the class name of the Controller class can be matched with the class name of the registered Bean to determine whether there is a registered Controller class. The working principle and technical effect of determining whether there is a registered Service interface class and ServiceImpl implementation class are basically the same as the working principle and technical effect of determining whether there is a registered Controller class, and will not be repeated here.

[0049] The deregistration of the registered Controller class, Service interface class and ServiceImpl implementation class may be performed based on a specific registration mechanism, which is not further limited herein.

[0050] In this embodiment, when it is determined that there is a registered Controller class, the registered Controller class is deregistered, and then when it is determined that there is a registered Service interface class and ServiceImpl implementation class, the registered Service interface class and ServiceImpl implementation class are deregistered, which can avoid the Controller class receiving user input and causing the Service interface class and ServiceImpl implementation class to fail to deregister. After re-registering the Service interface class and ServiceImpl implementation class, re-registering the Controller class can avoid the test results not meeting the preset standards after the Controller class receives user input because the Service interface class and ServiceImpl implementation class have not been registered, so as to improve development efficiency. In addition, compared with directly deregistering the Controller class, Service interface class and ServiceImpl implementation class at one time, in this embodiment, the registered Controller class, Service interface class and ServiceImpl implementation class are gradually deregistered, which can reduce the risk of errors.

[0051] To facilitate obtaining the source code of the modified low-code model, based on any of the above embodiments, obtaining the modified source code includes: receiving an adjustment command sent by the user to the low-code platform based on the test results and the preset standard; modifying the low-code model in the low-code platform based on the adjustment command, and parsing the modified low-code model to obtain parsed data of the modified low-code model; generating the modified source code based on the parsed data and a preset code template; and obtaining the modified source code submitted by the low-code platform through the source code registration interface of the sandbox.

[0052] Adjustment commands can be constructed based on the difference between the test results and the preset standards, for example, adjustment commands can be constructed based on the difference between the data-type test results and the preset standards, or adjustment commands can be constructed based on the difference between the operation status information-type test results and the preset standards, etc. Exemplarily, the adjustment command can be a command generated by dragging the interface, or a command generated by changing the configuration, etc. The low-code platform can automatically modify the low-code model based on the adjustment command, so that the user can simply and quickly modify the low-code model to obtain the modified source code.

[0053] A parsing module can be set up in the low-code platform. The parsing module can understand the data structure and business logic of the application corresponding to the low-code model and obtain the parsing data corresponding to the low-code model. The preset code template can define the structure and style of the source code. After obtaining the parsing data of the low-code model, the parsing data can be used to replace the placeholders or variables in the preset code template, and the source code corresponding to the low-code model can be generated simply and quickly.

[0054] Compared with directly modifying the source code, in this embodiment, after receiving the user's adjustment command, the low-code model is automatically modified through the low-code platform, and the corresponding modified source code is obtained based on the parsed data of the low-code model and the preset code template. The modified source code can be obtained simply and quickly, thereby shortening the source code adjustment cycle and improving development efficiency.

[0055] In order to specifically illustrate the function of the test interface method provided by this embodiment, a specific example is provided below.

[0056] Start the test interface system and the sandbox in the test interface system, where the test interface system is an online system and the sandbox is an online Java runtime environment containing only JDK.

[0057] The test interface system also includes a low-code platform. The low-code platform can receive interactive instructions input by the user based on the provided user interface through interactive operations such as dragging, clicking, and inputting by the user in the user interface, and generate a low-code model based on the interactive instructions input by the user. After obtaining the low-code model, the low-code platform can also parse the low-code model to obtain the parsed data of the low-code model. Code templates can be preset in the low-code platform, so that the Java source code corresponding to the low-code model can be generated based on the parsed data of the low-code model and the preset code template.

[0058] The low-code platform can submit Java source code to the sandbox through the sandbox's Java source code registration interface. After obtaining the Java source code submitted by the low-code platform, the sandbox can dynamically compile the Java source code in the sandbox to obtain the Controller class, Service interface class, and ServiceImpl implementation class; and dynamically register the obtained Controller class, Service interface class, and ServiceImpl implementation class to obtain the functional interface. After obtaining the functional interface, the user's test command can be received, and the functional interface can be tested based on the test command to obtain the test result.

[0059] When it is determined that the test results do not meet the preset standards, an adjustment command is sent by the user to the low-code platform based on the test results and the preset standards; the low-code model is modified in the low-code platform based on the adjustment command, and the modified low-code model is parsed to obtain parsed data of the modified low-code model; and the modified Java source code is generated based on the parsed data and the preset code template.

[0060] Obtain the modified Java source code submitted by the low-code platform through the Java source code registration interface of the sandbox, dynamically compile the modified Java source code in the sandbox to obtain the Controller class, Service interface class, and ServiceImpl implementation class, and if it is determined that there is a registered Controller class, cancel the registered Controller class; if it is determined that there is a registered Service interface class and ServiceImpl implementation class, cancel the registered Service interface class and ServiceImpl implementation class, and re-register the Service interface class and ServiceImpl implementation class obtained by dynamic compilation; re-register the Controller class obtained by dynamic compilation to obtain the functional interface.

[0061] Receive the user's test command, test the functional interface based on the test command to obtain the test result; determine whether the test result meets the preset standard, if not, repeat the above modification process until the test result meets the preset standard. If it is determined that the test result meets the preset standard, close the sandbox.

[0062] The test interface device provided by the present invention is described below. The test interface device described below and the test interface method described above can be referenced to each other.

[0063] Figure 2 Schematic diagram of the structure of the test interface device provided by the present invention, the device is applied to the test interface system, such as Figure 2 As shown, the device includes a class acquisition module 210 , a functional interface acquisition module 220 , a test result acquisition module 230 and a result judgment module 240 .

[0064] The class acquisition module 210 is used to acquire source code and dynamically compile the source code to acquire classes.

[0065] The functional interface acquisition module 220 is used to dynamically register the class to obtain the functional interface.

[0066] The test result acquisition module 230 is used to receive a test command from a user, and test the functional interface based on the test command to obtain a test result.

[0067] The result judgment module 240 is used to obtain the modified source code and repeat the above steps when determining that the test result does not meet the preset standard, until the test result meets the preset standard.

[0068] Compared with the prior art of compiling source code to obtain the corresponding JAR file and passing it to the system, the test interface device provided by the embodiment of the present invention passes the source code to the test interface system, dynamically compiles the source code in the test interface system to obtain the class, dynamically registers the class to obtain the functional interface, and tests the functional interface. When the test result does not meet the preset standard and the source code needs to be modified to continue the test, there is no need to restart the test interface system. The modified source code can be directly passed to the test interface system and tested, which can improve development efficiency.

[0069] Based on any of the above embodiments, the test interface system includes a sandbox and a low-code platform; the class acquisition module 210 is specifically used to obtain the source code submitted by the low-code platform through the source code registration interface of the sandbox; wherein the source code is a passing parameter of the source code registration interface.

[0070] Based on any of the above embodiments, the class acquisition module 210 is also used to: dynamically compile the source code to obtain the Controller class, Service interface class and ServiceImpl implementation class; the test result acquisition module 230 is also used to dynamically register the Controller class, the Service interface class and the ServiceImpl implementation class.

[0071] Based on any of the above embodiments, the class acquisition module 210 is specifically used to dynamically register the Controller class, the Service interface class and the ServiceImpl implementation class, including: when it is determined that the Controller class has been registered, canceling the registered Controller class; when it is determined that the Service interface class and the ServiceImpl implementation class have been registered, canceling the registered Service interface class and the ServiceImpl implementation class, and re-registering the Service interface class and the ServiceImpl implementation class obtained by dynamic compilation; re-registering the Controller class obtained by dynamic compilation.

[0072] Based on any of the above embodiments, the result judgment module 240 is specifically used to receive an adjustment command sent by the user to the low-code platform based on the test results and the preset standard; modify the low-code model in the low-code platform based on the adjustment command, and parse the modified low-code model to obtain the parsed data of the modified low-code model; generate the modified source code based on the parsed data and the preset code template; and obtain the modified source code submitted by the low-code platform through the source code registration interface of the sandbox.

[0073] Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3 As shown, the electronic device may include: a processor 310, a communications interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communications interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the test interface method, which includes: obtaining source code, dynamically compiling the source code to obtain a class; dynamically registering the class to obtain a functional interface; receiving a user's test command, testing the functional interface based on the test command to obtain a test result; and when it is determined that the test result does not meet the preset standard, obtaining the modified source code, and repeating the above steps until the test result meets the preset standard.

[0074] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of 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 invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0075] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the test interface method provided by the above methods, which method includes: obtaining source code, dynamically compiling the source code to obtain a class; dynamically registering the class to obtain a functional interface; receiving a user's test command, and testing the functional interface based on the test command to obtain a test result; when it is determined that the test result does not meet the preset standard, obtaining the modified source code, and repeating the above steps until the test result meets the preset standard.

[0076] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the test interface method provided by the above-mentioned methods. The method includes: obtaining source code, dynamically compiling the source code to obtain a class; dynamically registering the class to obtain a functional interface; receiving a user's test command, and testing the functional interface based on the test command to obtain a test result; when it is determined that the test result does not meet the preset standard, obtaining a modified source code, and repeating the above steps until the test result meets the preset standard.

[0077] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0078] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0079] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A test interface method, characterized in that: Applied to a test interface system, the method comprises: Obtain source code, and dynamically compile the source code to obtain a class; Dynamically register the class to obtain a functional interface; Receive a test command from a user, and test the functional interface based on the test command to obtain a test result; When it is determined that the test result does not meet the preset standard, the modified source code is obtained, and the above steps are repeated until the test result meets the preset standard.

2. The test interface method according to claim 1, characterized in that: The test interface system includes a sandbox and a low-code platform; Get the source code, including: The source code submitted by the low-code platform is obtained through the source code registration interface of the sandbox; wherein the source code is a passing parameter of the source code registration interface.

3. The test interface method according to claim 1, characterized in that: Dynamically compile the source code to obtain a class, including: Dynamically compile the source code to obtain the Controller class, Service interface class and ServiceImpl implementation class; Dynamically register the class, including: The Controller class, the Service interface class and the ServiceImpl implementation class are dynamically registered.

4. The test interface method according to claim 3, characterized in that: Dynamically registering the Controller class, the Service interface class, and the ServiceImpl implementation class includes: If it is determined that the Controller class has been registered, deregister the Controller class; If it is determined that the Service interface class and the ServiceImpl implementation class have been registered, the registered Service interface class and the ServiceImpl implementation class are cancelled, and the Service interface class and the ServiceImpl implementation class obtained by dynamic compilation are re-registered; Re-register the Controller class obtained by dynamic compilation.

5. The test interface method according to claim 2, characterized in that: Get the modified source code, including: Receiving an adjustment command sent by a user to the low-code platform based on the test result and the preset standard; Modifying the low-code model in the low-code platform based on the adjustment command, and parsing the modified low-code model to obtain parsed data of the modified low-code model; generating a modified source code based on the parsed data and a preset code template; The modified source code submitted by the low-code platform is obtained through the source code registration interface of the sandbox.

6. A test interface device, characterized in that: Applied to a test interface system, the device comprises: A class acquisition module is used to acquire source code and dynamically compile the source code to acquire classes; A functional interface acquisition module is used to dynamically register the class to obtain a functional interface; A test result acquisition module, used for receiving a test command from a user, and testing the functional interface based on the test command to acquire a test result; The result judgment module is used to obtain the modified source code and repeat the above steps when determining that the test result does not meet the preset standard, until the test result meets the preset standard.

7. The test interface device according to claim 6, characterized in that: The test interface system includes a sandbox and a low-code platform; the class acquisition module is specifically used to obtain the source code submitted by the low-code platform through the source code registration interface of the sandbox; wherein the source code is a transfer parameter of the source code registration interface.

8. The test interface device according to claim 6, characterized in that: The class acquisition module is also used to: dynamically compile the source code to obtain the Controller class, Service interface class and ServiceImpl implementation class; The test result acquisition module is also used to dynamically register the Controller class, the Service interface class and the ServiceImpl implementation class.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the test interface method according to any one of claims 1 to 5 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the test interface method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Dynamic expansion method and device based on Java language, electronic equipment and storage medium

    CN111736916A

  • Software online development method and device

    CN113342323A

  • Method and system for realizing dynamic simulation of service operation and data based on JVM sandbox

    CN114706662A