A low-code interface automation system, electronic device and storage medium
By using a low-code interface automation system, the complexity of testing caused by software program changes is solved, and efficient process management and code coverage analysis of automated testing are achieved, thereby improving testing efficiency and feedback speed.
Patent Information
- Application Number
- CN202211083201.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-06
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2042-09-06
AI Technical Summary
In existing technologies, the analysis and testing of the functional impact caused by software program changes is complex and time-consuming. The automated testing technology stack is not standardized, maintenance is difficult, and code coverage is hard to measure, resulting in low testing efficiency.
Design a low-code interface automation system, including a test case conversion module, a process test case writing module, a test metadata module, a product environment configuration module, an interface request module, an auxiliary function module, pre- and post-processing modules, an asynchronous verification event module, a traffic analysis module, a coverage analysis module, a task module, a front-end code analysis module, a reporting module, and a Kanban module, to achieve low-code automation of the testing process and data management.
It simplifies the test case writing process, automates the process from execution to report generation, reduces the difficulty of human intervention, reduces repetitive work, and improves testing efficiency and feedback speed.
Smart Images

Figure CN115422063B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of computers, and particularly relates to a low-code interface automation system, an electronic device and a storage medium. BACKGROUND
[0002] With the expansion of business scale, software programs become complex and changeable, and a slight code change may affect many functions, so a large amount of manpower is needed for analysis and testing work to verify the impact points after program changes. In order to alleviate this problem, software testing work needs to introduce automated testing to quickly regress various functional modules, but different personnel use different automated testing technology stacks, and the technical level is uneven, the service agreement is variable, and the written things are difficult to maintain, and the code coverage cannot be measured. SUMMARY
[0003] To solve the above technical problems, the present application provides a technical scheme of low-code interface automation, an electronic device and a storage medium to solve the above technical problems.
[0004] The first aspect of the present application discloses a low-code interface automation system, which comprises:
[0005] A use case conversion module, a process use case writing module, a test metadata module, a product environment configuration module, an interface request module, an auxiliary function module, a pre-post module, an asynchronous verification event module, a traffic analysis module, a coverage analysis module, a task module, a front-end code analysis module, a report module and a board module;
[0006] The use case conversion module parses the three-party request message of swagger and curl into a use case in the system;
[0007] The process use case writing module splices, drags and combines a plurality of controllers, interfaces and use cases into a process use case, and the controller includes if, while and for basic functions;
[0008] The test metadata module manages the basic test data of each environment, generates the basic test data of each environment through a metadata template, and thereby manages and maintains the test data;
[0009] The product environment configuration module manages product and environment information, including environment level request header injection, environment variable definition, route matching and environment assertion;
[0010] The interface request module calls a plurality of types of interfaces;
[0011] The auxiliary function module encapsulates the preset logic in a function, submits the saved reload to the current web service memory, and simultaneously saves to the MySQL;
[0012] The pre-post module processes the non-preset logic in the flow case by writing a script.
[0013] The asynchronous verification event module uses a built-in method to submit the verification of the intermediate process of the asynchronous or queue processing of the code under test to RabbitMq, and uses Work to listen to the queue to obtain execution.
[0014] The traffic analysis module parses the online Nginx log and the code of the request, parses and denoises the information of the request, and after storing in the database, an asynchronous task is started to make a coverage comparison. When the export traffic exists in the online traffic or request, the coverage number is increased by one. Finally, the request coverage rate and the online traffic coverage rate are calculated as auxiliary judgment conditions for the online coverage rate of the interface test.
[0015] The coverage analysis module analyzes the coverage of the code under test in real time, and serves as a measure of the code coverage of the test case.
[0016] The front-end code analysis module manages and parses the front-end code. The back-end obtains the front-end code and parses the request method and request path of the denoised front-end code, which is used for code explanation of traffic and statistics of the coverage rate of the front-end request.
[0017] The task module dynamically adds and edits test tasks.
[0018] The report module saves the report of each test case execution and the test task execution of the code under test.
[0019] The board displays the test data in the system.
[0020] According to the system of the first aspect of the application, the use case conversion module obtains all interface information in the current Swagger, including the request method, request description and request parameter, by parsing the Swagger API DocsJSON. The interface information is stored in a temporary table. The interfaces to be imported are checked, and the interfaces in the Swagger are imported into the interface library of the system in batches, and a correlation relationship is established for obtaining the interface request body definition and change. In another way, the curl of the current request is copied out after recording the request through a browser or a third-party packet capture software, and is pasted into the system. The system automatically analyzes the dependency relationship of the request, and records the request order in the system.
[0021] According to the system of the first aspect of the present application, the front end of the process case writing module uses the draggable module for drag assembly behavior interaction, and the request is dragged into the case, the draggable module will copy its own data separately, change the own data in the case, and realize that a single interface exists in different cases with different input parameter logic; the back end of the process case writing module recursively changes each step in the case, dynamically creates a test class inheriting unittest.TestCase through a type method, reflects each step to the test class through setattr, finally forms a corresponding request object by instantiating each step, pushes the data information in the case to the interface information through a data pushing function, and pushes the interface information to the corresponding case step.
[0022] According to the system of the first aspect of the present application, the interface request module matches the corresponding request type, and loads the corresponding request data according to different request types; before the interface is executed, different levels of variable pools are initialized for variable replacement of different priorities, after initialization, all $xx, ${xx} and ${func($x, a=$y)} variables in the request parameters are replaced by using the initialized variable pool through recursion and regular methods, at the same time, the environment request header and the environment check are automatically injected into the request, then the code of the request is executed by using exec after the runtime object and the context variable are automatically injected if the request contains a preprocessor, the code output is redirected to the corresponding buffer pool, and finally the output is reflected in the report.
[0023] According to the system of the first aspect of the present application, the auxiliary function module, after the auxiliary method is written, the execution result of a single auxiliary method is viewed, the diff operation of the version of the auxiliary method is triggered after the auxiliary method is saved, the diff current version is given a modified change value, after the auxiliary method is confirmed to be successful, the auxiliary method is loaded into the memory of the test service in real time through the reload method, and is also persisted to the database.
[0024] According to the system of the first aspect of the present application, the front and rear modules execute a Python3 code block, before executing the code block, different levels of variable pools are injected into the execution scope of the code block, and a built-in object ARun is injected into the scope, so that the runtime variable is obtained and modified.
[0025] According to the system of the first aspect of the present application, the backend of the task module uses APScheduler to support task execution, different types of tasks are added on the front page of the task module, the front page will show the corresponding list page by selecting different types of tasks, the front page will load the required use case after filtering by conditional query, and then call the update method to dynamically update the task information, and when executing, the use case in the task is parsed and thrown into ThreadPoolExecutor for concurrent execution.
[0026] According to the system of the first aspect of the present application, the coverage analysis module puts JaCoCo Agent into the service image, starts JaCoCo Agent by adding a service start command, and opens TcpServer mode to expose the corresponding port, and the test service generates the coverage exec file to the server to which the system belongs according to the fixed time wheel sequence or manual triggering, pulls the measured code to the local according to the configuration git repository and branch information, generates the corresponding coverage report after mvn clean compile using jaocococli command, and uses anywhere as the coverage report display management service, and uses iframe to embed into the front page in the system.
[0027] The second aspect of the present application provides an electronic device, the device comprising a memory and a processor, the memory storing a computer program, the computer program being executed by the processor to perform the method in the low-code interface automation system according to the first aspect of the present application.
[0028] The third aspect of the present application provides a storage medium, the storage medium storing a computer program, the computer program being executed by one or more processors, and being used to implement the method in the low-code interface automation system according to the first aspect of the present application.
[0029] The scheme provided by the present application achieves simple use case writing, and the entire execution process from use case execution to test report generation and test notification is automatically completed, greatly reducing the difficulty of personnel automation intervention, greatly reducing the repeated labor of test personnel, and making the feedback of regression test problems more timely, improving the overall efficiency of test work. BRIEF DESCRIPTION OF DRAWINGS
[0030] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the drawings needed in the specific embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0031] Figure 1 A structural diagram of a low-code interface automation system according to an embodiment of the present application;
[0032] Figure 2 A task execution flowchart of a system according to an embodiment of the present application;
[0033] Figure 3 A structural diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0034] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0035] The first aspect of the present application discloses a low-code interface automation system, Figure 1 A structural diagram of a low-code interface automation system according to an embodiment of the present application, specifically as Figure 1 shown, the system comprises a use case conversion module, a process use case writing module, a test metadata module, a product environment configuration module, an interface request module, an auxiliary function module, a pre-post module, an asynchronous verification event module, a traffic analysis module, a coverage analysis module, a task module, a front-end code analysis module, a report module and a board module;
[0036] As Figure 1 shown, the use case conversion module is connected with the process use case writing module, the product environment configuration module, the interface request module and the task module in sequence;
[0037] The test metadata module is connected with the product environment configuration module;
[0038] The auxiliary function module, the pre-post module and the asynchronous verification event module are connected with the interface request module respectively;
[0039] Among them, the traffic analysis module, the coverage analysis module and the front-end code analysis module jointly constitute a first module, and the first module is connected with the interface request module and the task module respectively;
[0040] The first module, the interface request module and the task module jointly constitute a second module;
[0041] The second module is connected with the report module and the board module respectively.
[0042] The use case conversion module parses swagger and curl three-party request messages into system use cases, including message headers, message body format content, and request methods, etc.
[0043] The flow use case writing module combines multiple controllers, interfaces, and use cases into flow use cases through splicing and dragging. The controllers include if, while, and for basic functions and support infinite nesting. Use cases can be directly imported and called.
[0044] The test metadata module manages the basic test data of each environment. It generates the basic test data of each environment through a metadata template, thereby managing and maintaining the test data. As long as the environment contains the basic test data, the use case can run in different environments.
[0045] The product environment configuration module manages product and environment information, including environment-level request header injection (for global login), environment variable definition, route matching (for splicing different domain names according to different paths, suitable for a use case containing multiple system interfaces in series), and environment assertion (for global assertion at the environment level).
[0046] The interface request module calls multiple types of interfaces, such as HTTP(s) and Dubbo. Interface calls only need to select the request type in the drop-down box and complete the required data, such as request headers, request bodies, pre- and post-sets, and validators, to complete different types of protocol calls through low code.
[0047] The auxiliary function module encapsulates the preset logic in a function, submits it to the current web service memory, and simultaneously persists it to MySQL. The function can be called anywhere in the request using the ${func($var} method.
[0048] The pre- and post-set module processes non-preset logic in flow use cases by writing scripts. For example, complex operations such as MySQL, Redis, and MQ can be completed by writing corresponding scripts in pre- and post-sets. The script is Python3 and can complete runtime variable reference and modification through built-in objects.
[0049] The asynchronous verification event module uses built-in methods to submit the verification of the intermediate process of asynchronous or queue processing of the code under test to RabbitMq and uses a Worker to listen to the queue to obtain execution. The task method supports user customization, and the reload module loads the user-defined events into memory, allowing the system to complete custom method mounting without stopping.
[0050] The traffic analysis module will parse the online Nginx log and request code, parse the request information, and after noise reduction and database storage, start an asynchronous task to do a coverage comparison. When the export traffic exists in the online traffic or request, the coverage number is increased by 1. Finally, the request coverage rate and online traffic coverage rate are calculated as the auxiliary judgment condition of the interface test online coverage rate.
[0051] The coverage analysis module analyzes the coverage of the code under test in real time, which is used to measure the code coverage of the test case, including line level, method level, and class level.
[0052] The front-end code analysis module manages the parsed front-end code. The back-end will get the front-end code and parse the request method and request path of the noise-reduced front-end code, which is used for traffic code explanation and statistics of front-end request coverage. Here, the back-end refers to the back-end of the low-code interface automation system. The back-end can be understood as interacting with the database and processing the corresponding business logic.
[0053] The task module dynamically adds and edits test tasks, and provides Webhook for three-party calling and integration of CICD.
[0054] The report module saves the report of each test case execution and the test task execution of the code under test. The report contains the request, response, and log output of each time, which can be used for later analysis.
[0055] The board displays the test data in the system, including but not limited to the number of test cases, task execution status, and platform usage frequency information, visualizing the test capability and range management.
[0056] In some embodiments, the case conversion module obtains all interface information in the current Swagger by parsing the Swagger API Docs JSON, including request method, request description, and request parameters. The interface information is stored in a temporary table. Check the interfaces that need to be imported, and import the interfaces in Swagger to the interface library of the system in batches, and establish a correlation relationship for obtaining interface request body definition and changes. The correlation relationship refers to: the interface in Swagger is a main body, and becomes another main body after being imported into the system. The correlation relationship here refers to that the main body in the system can track the changes of the main body in Swagger. In summary, it is the correlation relationship between the interface in Swagger and the interface in the system. Another way is to use a browser or a three-party packet capture software such as Fiddler to record the request and copy the current request curl into the system. The system will automatically analyze the dependency of the request and record the request order in the system as an interface repository for subsequent case writing, saving the time-consuming of finding multiple interfaces.
[0057] In some embodiments, the front end of the process use case writing module uses the draggable module for drag-and-drop assembly of behavioral interactions, and the request dragged into the use case, the draggable module will copy its own data separately, change the own data in the use case, and realize a single interface existing in different use cases with different input parameter logic; the back end of the process use case writing module recursively processes each step in the use case, dynamically creates a test class inheriting unittest.TestCase through the type method, reflects the steps to the test class through setattr, and finally instantiates each step into a corresponding request object, pushes the data information in the use case back to the interface information through the data pushing function, and pushes the interface information to the corresponding use case step.
[0058] In some embodiments, the interface request module matches the corresponding request type, such as Dubbo or HTTP(s), and loads the corresponding request data according to different types; before interface execution, different levels of variable pools are initialized for variable replacement of different priorities; after initialization, all $xx, ${xx}, and ${func($x, a=$y)} variables in the request parameters are replaced by using the initialized variable pool through recursion and regular methods, at the same time, environment request headers and environment verification are also injected into the request by default, then the request code is executed by the preprocessor, if the request contains a preprocessor script, the runtime object and context variables are automatically injected, the code output is redirected to the corresponding buffer pool, and finally it is reflected in the report;
[0059] At the same time, the system detects whether SSL detection is enabled, if enabled, it accesses the url through curl, and then obtains the expiration time in the response through regular expression; if JSON Schema reset or verification is enabled, the response is generated through traversal to generate the corresponding JSON Schema for the next execution of the response verification, and the final execution result is persisted to the database.
[0060] In some embodiments, the auxiliary function module, after writing the auxiliary method, debugs the execution result of a single auxiliary method, triggers the diff operation of the version of the auxiliary method after saving the auxiliary method, compares the current version with the modified change value, confirms the success of the auxiliary method, and loads the auxiliary method into the memory of the test service in real time through the reload method, and also persists it to the database, so as to realize the modification or increase of the built-in method without restarting the service.
[0061] In some embodiments, the pre-post module executes a Python3 code block, injects different levels of variable pools into the execution scope of the code block before executing the code block, and injects the built-in object ARun into the execution scope to obtain and modify runtime variables, and supports calling the defined function in the auxiliary function, such as the test function defined in common_utils, which can be directly called in the form of common_utils.test().
[0062] In some embodiments, the backend of the task module uses APScheduler to support task execution, and different types of tasks such as interface testing, UI testing, and Python scripts are added on the front-end page of the task module. The front-end page will display the corresponding list page by selecting different types of tasks. After the required use cases are filtered out by conditional query, the update method is called to dynamically update the task information, and when executed, the use cases in the task are parsed and thrown into ThreadPoolExecutor for concurrent execution.
[0063] In some embodiments, the coverage analysis module injects JaCoCo Agent into the service image, starts JaCoCo Agent by adding a service start command, and starts TcpServer mode to expose the corresponding port. The test service generates the coverage exec file to the system server according to the fixed time wheel sequence or manual triggering, pulls the tested code to the local according to the configuration git repository and branch information, and generates the corresponding coverage report using jaocococli command after mvn clean compile. Anywhere is used as the coverage report display management service, which is embedded in the front-end page using iframe. The coverage result is a direct manifestation of the application code coverage, and the uncovered points can be used to supplement the use cases to make the application coverage wider and the test effect more intuitive.
[0064] In some embodiments, the front-end code analysis module includes an application repository management configuration center for maintaining the address and branch information of associated repositories, which is used to pull the front-end code according to the corresponding information in the later stage. After pulling the front-end code, the backend will analyze and denoise the request method and request path according to different types of files, and store the data in the database. The system will compare the egress traffic from the platform with the parsed front-end requests to obtain a front-end request coverage, and provide a corresponding coverage list as a basis for subsequent supplementary use cases.
[0065] In some embodiments, asFigure 2 As shown, the task execution flow of the system includes the following steps:
[0066] Step S1, a user will define information of a specific system to be tested in the system, such as product name, product description, etc.; the tester will define basic data of the environment according to the corresponding environment, such as variable pool of the entire environment, request header of the environment level, and global verification, etc. configuration; then the tester will select the just established environment, run the corresponding environment initialization use case script, which will generate all the basic test data required for environment running.
[0067] Step S2, the user can convert and write the corresponding test case according to the required request type, for example, the user can open the browser F12, select the request you want in the Network Tab, right-click to copy the curl information, and paste it into the system, which will parse the content into the form including the required basic parameters such as request address, request header, request method, request body, etc. The user can select different controllers in the drop-down box, such as loop controller (for), flow controller (if), and polling controller (while) to control the execution action of the request, or can determine the execution order of the steps by dragging the steps up and down, and can also reference other use cases as the pre-reference use cases of the use case.
[0068] Step S3, the timing task will call the test case according to date / interval / cron, etc. The system will pull the latest use case information as the execution parameter when executing.
[0069] Step S4, the end of the task execution will send the corresponding message to the group, including test basic information such as the number of successes, the number of failures, the detailed address of the report, etc. The test report will also be synchronized and persisted to the database for later analysis of exceptions.
[0070] Step S5, in the task execution process, the system will capture the export traffic information, and finally the noise is reduced and stored in the database, for example, Method: GET http: / / 127.0.0.1 / test?a=1&b=2 will be converted into Method: GET http: / / 127.0.0.1 / test?a=${noise}&b=${noise}, at the same time, the traffic analysis module will analyze the online Nginx log and the front-end request code, and the request information will be parsed according to the above steps, after noise reduction and storage, an asynchronous task will be started to make a coverage comparison, when the export traffic exists in the online traffic or the front-end request, the coverage number is added by 1, and finally the front-end request coverage rate and the online traffic coverage rate are counted as the auxiliary judgment condition of the interface test online coverage rate. The coverage rate analysis module is that when the application is packaged into an image, the JaCoCo Agent is also packaged into the image, and the Agent is started through the tcpserver in the web service start command to expose the corresponding external port to have the ability to pull data from the outside, in the interface test execution process, the Agent will collect the execution coverage of the application code, and can manually or task trigger to get the exec file of the application code through the tcpserver exposed by JaCoCo, and get the warehouse address and the corresponding branch of the currently deployed application from the warehouse configuration center, then pull the code through the warehouse information, compile the application code through the mvn compile command, and finally generate the corresponding coverage report through the jacococli command and display it in the system, the coverage result will be a direct manifestation of the application code coverage, and the uncovered points can be supplemented with specific use cases to make the coverage of the application wider.
[0071] In summary, the technical solutions of the various aspects of the application have the following advantages compared with the prior art: the use case is simple to write, the entire execution process from use case execution to test report generation and test notification is automatically completed, the difficulty of personnel automation intervention is greatly reduced, the repetitive labor of test personnel is greatly reduced, the feedback of regression test problems becomes more timely, and the overall efficiency of the test work is improved.
[0072] The second aspect of the application discloses an electronic device, comprising a memory and a processor, the memory stores a computer program, and the processor executes the computer program to realize the steps in the low-code interface automatic method of any one of the first aspect disclosed by the application.
[0073] Figure 3 The structure diagram of the electronic device according to the embodiment of the application is as follows, Figure 3As shown, the electronic device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the electronic device is used for wired or wireless communication with external terminals. Wireless communication can be achieved through WIFI, operator network, near field communication (NFC) or other technologies. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen. The input device of the electronic device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad provided on the shell of the electronic device, or an external keyboard, touchpad or mouse, etc.
[0074] Those skilled in the art can understand that, Figure 3 The structure shown in the figure is only a structure diagram of part of the technical solution of the present application, and does not constitute a limitation on the electronic device to which the technical solution of the present application is applied. The specific electronic device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0075] The third aspect of the present application discloses a storage medium, specifically a computer readable storage medium, and the computer readable storage medium stores a computer program. When the computer program is executed by a processor, the steps in the steps of the low-code interface automation method of any one of the first aspect of the present application are implemented.
[0076] Please note that the technical features of the above embodiments can be combined in any way. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application. The above embodiments only express several embodiments of the present application, and the description is more specific and detailed, but it should not be interpreted as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of the patent of the present application should be subject to the appended claims.
Claims
1. A low-code interface automation system, characterized by, The system comprises a use case conversion module, a process use case writing module, a test metadata module, a product environment configuration module, an interface request module, an auxiliary function module, a pre-post module, an asynchronous verification event module, a traffic analysis module, a coverage analysis module, a task module, a front-end code analysis module, a report module and a board module; The use case conversion module parses the three-party request message of swagger and curl into a use case in the system; The process use case writing module combines a plurality of controllers, interfaces and use cases into a process use case by splicing and dragging, wherein the controllers include if, while and for basic functions; The test metadata module manages the basic test data of each environment, generates the basic test data of each environment through a metadata template, and thereby manages and maintains the test data; The product environment configuration module manages product and environment information, including environment level request header injection, environment variable definition, route matching and environment assertion; The interface request module calls a plurality of types of interfaces to complete protocol calling of different types by low code; The auxiliary function module encapsulates preset logic in a function, submits and saves the function in the reload of the current web service memory, and simultaneously persists the function to MySQL; The pre-post module processes non-preset logic in the process use case by writing scripts, and realizes low code completion of interface automation of complex logic; The asynchronous verification event module uses built-in methods to submit the verification of the intermediate process of asynchronous or queue processing of the code under test to RabbitMq, uses Work to listen to the queue to obtain execution, the task method supports user customization, and the reload module is used to load the custom event of the user into the memory, so that the system completes the mounting of the custom method without stopping; The traffic analysis module analyzes the online Nginx log and the code of the request, parses the information of the request, and after noise reduction and database storage, an asynchronous task is started to make a coverage comparison, when the export traffic exists in the online traffic or the request, the coverage number is increased by one, and finally the request coverage rate and the online traffic coverage rate are counted, which are used as auxiliary judgment conditions of the online coverage rate of the interface test; The coverage analysis module analyzes the coverage of the code under test in real time, and is used as a code coverage degree of the test case; The front-end code analysis module manages the analysis of the front-end code, the back-end obtains the front-end code and analyzes the request mode and request path of the noise-reduced front-end code, which is used for traffic code explanation and statistics of the front-end request coverage rate; The task module dynamically adds and edits test tasks; The report module saves the report of each use case execution and the test task execution of the code under test; The board displays the test data in the system. The use case conversion module obtains all interface information in the current Swagger, including request method, request description and request parameter, by analyzing Swagger API Docs JSON, and the interface information is stored in a temporary table; the interfaces to be imported are checked, the interfaces in the Swagger are imported into the interface library of the system in batches, and a correlation relationship is established for obtaining interface request body definition and change; the curl of the current request is copied out after recording the request through a browser or a third-party packet capture software, and is pasted into the system, and the system automatically analyzes the dependency relationship of the request and records the request order in the system; the correlation relationship is that the interface in the Swagger is a main body, which becomes another main body after being imported into the system, and the main body in the system can track the change of the main body in the Swagger; The front end of the process use case writing module uses the draggable module for drag-and-drop assembly behavior interaction, and the request dragged into the use case, the draggable module will separately copy its own data, change the own data in the use case, and realize that a single interface exists in different use cases with different input parameter logic; the back end of the process use case writing module recursively processes each step in the use case, dynamically creates a test class inheriting unittest.TestCase through the type method, reflects each step to the test class through setattr, and finally forms a corresponding request object by instantiating each step, pushes the data information in the use case back to the interface information through the data pushing function, and pushes the interface information to the corresponding use case step.
2. The low-code interface automation system of claim 1, wherein, The interface request module matches the corresponding request type, and loads the corresponding request data according to different request types; before the interface is executed, different levels of variable pools are initialized for variable replacement of different priorities, after initialization, all $xx, ${xx} and ${func($x, a=$y)} variables in the request parameter are replaced by using the initialized variable pool through recursion and regular methods, at the same time, the environment request header and the environment check are automatically injected into the request, then the request code is executed by using exec after the preprocessor and the runtime object and context variables are automatically injected if the request contains a preprocessor script, the code output is redirected to the corresponding buffer pool, and finally the result is reflected in the report.
3. The low-code interface automation system of claim 1, wherein, The auxiliary function module, after writing and debugging the auxiliary method, views the execution result of a single auxiliary method, triggers the diff operation of the version of the auxiliary method after saving the auxiliary method, gives the modified change value to the diff current version, confirms the success of the auxiliary method, reloads the auxiliary method into the memory of the test service in real time through the reload method, and also persists the auxiliary method in the database.
4. The low-code interface automation system of claim 1, wherein, The front and rear modules execute Python3 code blocks, inject variable pools of different levels into the execution scope of the code blocks before executing the code blocks, and inject a built-in object ARun into the scope, thereby obtaining and modifying runtime variables.
5. The low-code interface automation system of claim 1, wherein, The backend of the task module uses APScheduler to support task execution, different types of tasks are added on the front page of the task module, the front page will show the corresponding list page by selecting different types of tasks, the front page will load the required use case after filtering by conditional query, and then call the update method to dynamically update the task information, and when executing, the use case in the task is parsed and thrown into ThreadPoolExecutor for concurrent execution.
6. A low-code interface automation system according to any of claims 1-5, characterized in that, The coverage analysis module inserts JaCoCo Agent into the service image, starts JaCoCoAgent by adding a service start command, and opens TcpServer mode to expose the corresponding port. The test service generates the coverage exec file to the system server according to the fixed time wheel sequence or manual triggering, pulls the measured code to the local according to the configuration git repository and branch information, and generates the corresponding coverage report after mvn clean compile using jaocococli command. Anywhere is used as the coverage report display management service, which is embedded into the front-end page using iframe in the system.
7. An electronic device, comprising: The memory and the processor, the memory stores a computer program, the computer program is executed by the processor, and the method in the low-code interface automation system in any one of claims 1 to 6 is executed.
8. A storage medium, characterized by The computer program stored in the storage medium can be executed by one or more processors, and can be used to implement the method in the low-code interface automation system in any one of claims 1 to 6.
Citation Information
Patent Citations
Test system and test method based on microkernel
CN114090459A
Code test coverage rate statistics and analysis method and system based on Jacocos
CN114936147A