An automated testing system and testing method based on multi-language K8S
Through the automated testing system based on multilingual K8S, the problem of high learning costs caused by different testers mastering different languages and frameworks is solved, and the unified standards and efficient utilization of resources of automated testing are realized, making it easier for non-script developers to execute automated tests. The elastic expansion of Kubernetes realizes unified scheduling of resources and standardization of automated testing.
Patent Information
- Application Number
- CN202111412898.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-25
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2041-11-25
AI Technical Summary
During the software development process, with the increase of testers, the language and automation frameworks they master are different, resulting in high learning costs, difficult to quickly apply to the project, and it is difficult to choose a suitable automation framework based on the project characteristics and integrate it into the entire automation standard system. .
Provide an automated testing system based on multilingual K8S, including script analysis module, script operation module, test data generation module and script distribution module. Through unified script analysis and execution standards, Kubernetes' elastic expansion mechanism is used to achieve unified resources. By using, each project can choose an automation framework based on its own characteristics, and the automation modules can complete the operation and resource scheduling.
Reduces learning costs and facilitates non-script developers to execute automated test cases. Through a unified execution engine, the Jenkins template executes automated use cases, and realizes efficient utilization of resources and standardization of automated tests. Non-script writers can easily execute automated scripts and view results. .
Smart Images

Figure CN114328177B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an automated test management platform, and in particular to an automated test system based on multi-language K8S and a test method thereof. Background Art
[0002] As customers have higher and higher requirements for software quality, they need to be able to quickly provide feedback on product quality during the R&D process. In order to improve testing efficiency, automated testing has been widely used in the software development process. A set of automated frameworks will be purchased or developed based on a specific language to improve testing efficiency. As the number of testers increases, everyone has mastered different languages and automated frameworks. It is difficult to quickly apply unfamiliar languages or frameworks to projects and work, and it takes a period of learning. How to reduce this learning cost and select an automated framework based on the characteristics of the project and integrate it into the entire automated standard system.
[0003] Jenkins is an open source software project. It is a continuous integration tool developed based on Java. It is used to monitor continuous repetitive work. It aims to provide an open and easy-to-use software platform to make continuous integration of software possible.
[0004] Kubernetes, abbreviated as K8s, is an abbreviation formed by replacing the eight characters "ubernete" with "8". It is an open source platform for managing containerized applications on multiple hosts in a cloud platform. The goal of Kubernetes is to make the deployment of containerized applications simple and powerful. Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance. Summary of the invention
[0005] In view of the problems existing in the prior art, the present invention provides an automated testing system and testing method based on multi-language K8S, which unifies resources and execution standards through unified script parsing, distribution and execution; and utilizes the elastic expansion mechanism of Kubernetes to make full use of resources. Each project can choose an automated framework according to its own characteristics, and the entire operation and resource scheduling and results are completed by the automated module.
[0006] The technical solution of the present invention is: an automated testing system based on multi-language K8S, comprising a script parsing module, a script running module, a test data generating module and a script distributing module;
[0007] The script parsing module is used to precompile automation scripts written in various automation testing frameworks from the code library, parse the relationship between automation scripts and test cases after precompilation, associate a test case with the test script number of an automation script, and save it in the database; so that the test case can be transformed from manual execution to automated execution.
[0008] The script running module is used to find the corresponding test script number through multiple test cases contained in the test plan when the test platform creates the corresponding test plan, find the corresponding automated test framework execution template according to the test script type associated with the test script number, and drive the execution of the automated test framework execution template;
[0009] The test data generation module is used to select the system environment to be tested when creating a test plan, obtain the test data that the tested system environment depends on according to the system environment set in the test plan, initialize the test data that it depends on, and send the generated data to the shared storage OSS (operation support system) for use during test execution;
[0010] The script distribution module fills the configuration data required by the tested system environment through the test data generation module, searches for the automated test framework execution template to be executed through the script running module, and then calls the Jenkins development interface to create multiple tasks one by one according to the generated multiple automated test framework execution templates, and generates the same multiple Kubernetes instances through the pre-implanted yaml files. After the instance is created, the automated script corresponding to the automated test framework execution template is issued to the Kubernetes instance, the test script is executed, and the test results are filled back into the test case through the interface provided by the test platform; the test personnel can see the test execution results on the test platform; and the test result email is sent to the relevant personnel. After the execution is completed, the test resources are automatically released through Kubernetes for use by other instances.
[0011] Furthermore, in the script parsing module, after pre-compiling the automation scripts written in various test frameworks, check whether there are compilation errors in the automation scripts. If the pre-compilation fails, an email is sent to the corresponding tester to modify the script.
[0012] Furthermore, the multiple testing frameworks include Pytest, Junit, TestNG, Rotbot Framework, Cucumber, Cypress, and Jmeter testing frameworks.
[0013] Furthermore, in the test data generation module, the test data on which the tested system environment depends includes basic configuration data, user names, passwords, and menu items of the tested system environment.
[0014] The present invention also provides an automated testing method based on multi-language K8S, and the specific steps are as follows:
[0015] Step 1: Script parsing: Precompile the automation scripts written in various automation test frameworks from the code base. After precompiling, parse the relationship between the automation scripts and test cases, associate a test case with the test script number of an automation script, and save it in the database.
[0016] Step 2: Run the script:
[0017] Step 21: Create a corresponding test plan through the test platform. When creating the test plan, select the system environment to be tested. According to the system environment set in the test plan, obtain the test data that the tested system environment depends on, initialize the test data that it depends on, and send the generated data to the shared storage OSS (shared file data storage server) for use during test execution.
[0018] Step 22: The test plan includes multiple test cases, and the test script numbers corresponding to the multiple test cases are searched. According to the test script type associated with the test script number, the corresponding automated test framework execution template is searched, and the automated test framework execution template is driven to execute;
[0019] Step 23. Call the Jenkins development interface to create multiple tasks according to the generated multiple automated test framework execution templates, and generate the same multiple Kubernetes instances through the pre-implanted yaml files. After the instance is created, the automation script corresponding to the automated test framework execution template is issued to the Kubernetes instance, and the test script is executed. The test results are filled back into the test case through the interface provided by the test platform; the test personnel can see the test execution results on the test platform; and the test results are emailed to the relevant personnel. After the execution is completed, the test resources are automatically released through Kubernetes for use by other instances.
[0020] Furthermore, after the automation scripts written in the various test frameworks are precompiled, it is checked whether there are compilation errors in the automation scripts. If the precompilation fails, an email is sent to the corresponding tester to modify the script.
[0021] Furthermore, the multiple testing frameworks include Pytest, Junit, TestNG, Rotbot Framework, Cucumber, Cypress, and Jmeter testing frameworks.
[0022] Furthermore, the test data on which the tested system environment depends includes basic configuration data, user names, passwords, and menu items of the tested system environment.
[0023] The beneficial effects of the present invention are: providing an automated testing system and testing method based on multi-language K8S, unifying resources and execution standards through unified script parsing, distribution and execution; utilizing the Kubernetes elastic expansion mechanism to make full use of resources. Each project can choose an automation framework according to its own characteristics, and the entire operation and resource scheduling and results are uniformly completed by the automation module.
[0024] This automation system automatically parses test scripts and matches test cases, making it convenient for non-script developers to execute test cases without having to understand the script implementation process. It drives the execution of Jenkins templates through a unified execution engine to execute automated test cases. Through Jenkins' distribution mechanism, it distributes test cases to the Kubernetes cluster and automatically creates instances to complete automated testing.
[0025] In summary, this application can select an automation framework based on the characteristics of the project itself, and is not limited to a specific automation framework. Through the automation module, different automation frameworks are connected, unified specifications and standards are used, and platformization is adopted. Non-script writers can easily execute automation scripts and view results. Automated asset test data is uniformly managed and maintained. Kubernetes is used to achieve unified resource scheduling and automated test machine utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 This is a module diagram of the automated testing system based on multi-language K8S;
[0027] Figure 2 To parse the script diagram;
[0028] Figure 3 To show the use case and script relationship diagram on the test platform;
[0029] Figure 4 To run the script diagram;
[0030] Figure 5 To create a test plan through the test platform, the test plan mainly includes the following plan name and test environment diagram;
[0031] Figure 6 After creating a test plan, select the required test case and click Run to call the automated execution engine to execute the case. The automated engine will call the Jenkins development interface to create a task to run the case diagram.
[0032] Figure 7If test data is needed during the execution of the test case, the test data stored in the object will be called, the test case will be executed, and the test results will be filled back into the test platform. Click the result to view the running details diagram. DETAILED DESCRIPTION
[0033] The present invention will be further described below in conjunction with the accompanying drawings.
[0034] like Figure 1 As shown, the automated testing system based on multi-language K8S includes a script parsing module, a script running module, a test data generation module and a script distribution module.
[0035] Script parsing module: mainly precompiles automation scripts written in frameworks such as Pytest, Junit, TestNG, Rotbot Framework, Cucumber, Cypress, and Jmeter from the code base, checks whether there are compilation errors in the automation scripts, and sends emails to the corresponding testers if the precompilation fails to pass, and modifies the scripts. After the precompilation passes, parse the relationship between the automation script and the test case, and associate a test case with the test script number of an automation script. Transform the test case from manual execution to automated execution.
[0036] Script running module: When the corresponding test plan is created on the test platform, the corresponding test script number is found through the multiple test cases contained in the test plan, and the corresponding automated test framework execution template is found according to the test script type associated with the test script number, and the automated test framework execution template is driven to execute.
[0037] Test data generation module: used to select the system environment to be tested when creating a test plan, obtain the test data that the tested system environment depends on according to the system environment set in the test plan, initialize the test data that it depends on, mainly including the basic configuration data of the tested system, user name, password, menu items, etc., and send the generated data to the shared storage OSS (operation support system) for use during test execution.
[0038] Script distribution module: After filling the configuration data required by the tested system environment through the test data generation module, searching for the automated test framework execution template to be executed through the script running module, calling the Jenkins development interface to create multiple tasks one by one according to the generated multiple automated test framework execution templates, and generating the same multiple Kubernetes instances through the pre-implanted yaml files. After the instance is created, the automated script corresponding to the automated test framework execution template is distributed to the Kubernetes instance, the test script is executed, and the test results are filled back into the test case through the interface provided by the test platform; the test personnel can see the test execution results on the test platform; and send the test result email to the relevant personnel. After the execution is completed, the test resources are automatically released through Kubernetes for use by other instances.
[0039] To achieve the above functions, the platform usage steps and some technical details are as follows:
[0040] 1. Parsing script
[0041] like Figure 2 As shown, the automation scripts written in Pytest, Junit, TestNG, Rotbot Framework, Cucumber, Cypress, and Jmeter automation test frameworks are precompiled from the code base, and the automation scripts are checked for compilation errors. If the precompilation fails, an email is sent to the corresponding tester to modify the script. After the precompilation passes, the relationship between the automation script and the test case is parsed, and a test case is associated with the test script number of an automation script and saved in the database. Specifically, the parsed result establishes a corresponding relationship between the test case and the test script number, displays the relationship between the case and the script on the test platform, and views the details of the script through the test script number. As shown Figure 3 shown.
[0042] 2. Run the script as follows Figure 4 Shown
[0043] Step 1: If Figure 5 As shown, a test plan is created through the test platform. The test plan mainly includes the following plan name and test environment: When creating a test plan, select the system environment to be tested, obtain the test data that the tested system environment depends on according to the system environment set in the test plan, initialize the dependent test data, and send the generated data to the shared storage OSS (operation support system) for use during test execution.
[0044] Step 2: If Figure 6After creating the test plan, select the required test case, click the case run to call the script running module to execute the case. The script running module is used to create a corresponding test plan on the test platform, find the corresponding test script number through the multiple test cases contained in the test plan, find the corresponding automated test framework execution template according to the test script type associated with the test script number, and drive the execution of the automated test framework execution template; call the Jenkins development interface to create multiple tasks one by one according to the generated multiple automated test framework execution templates, and generate the same multiple Kubernetes instances through the pre-implanted yaml files. After the instance is created, the automation script corresponding to the automated test framework execution template is issued to the Kubernetes instance.
[0045] Step 3: If Figure 7 As shown in the figure, during the execution of the use case, test data required will call the test data stored in the object storage, execute the test script, and fill the test results back into the test case through the interface provided by the test platform; the tester can see the test execution results on the test platform; and send the test result email to the relevant personnel. After the execution is completed, the test resources are automatically released through Kubernetes for use by other instances.
[0046] This application unifies resources and execution standards through unified script parsing, distribution and execution; and uses the Kubernetes elastic expansion mechanism to make full use of resources. Each project can choose an automation framework according to its own characteristics, and the entire operation and resource scheduling and results are completed by the automation module.
[0047] This automation system automatically parses test scripts and matches test cases, making it convenient for non-script developers to execute test cases without having to understand the script implementation process. It drives the execution of Jenkins templates through a unified execution engine to execute automated test cases. Through Jenkins' distribution mechanism, it distributes test cases to the Kubernetes cluster and automatically creates instances to complete automated testing.
[0048] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. An automated testing system based on multi-language K8S, characterized by: Including script parsing module, script running module, test data generation module and script distribution module; The script parsing module is used to precompile automation scripts written in various automation test frameworks from the code base, parse the relationship between automation scripts and test cases after precompilation, associate a test case with the test script number of an automation script, and save it in the database; The script running module is used to find the corresponding test script number through multiple test cases contained in the test plan when the test platform creates the corresponding test plan, find the corresponding automated test framework execution template according to the test script type associated with the test script number, and drive the execution of the automated test framework execution template; The test data generation module is used to select the system environment to be tested when creating a test plan, obtain the test data that the tested system environment depends on according to the system environment set in the test plan, initialize the test data that it depends on, and send the generated data to the shared storage OSS for use during test execution; The script distribution module fills the configuration data required by the tested system environment through the test data generation module, searches for the automated test framework execution template to be executed through the script running module, and then calls the Jenkins development interface to create multiple tasks one by one according to the generated multiple automated test framework execution templates, and generates the same multiple Kubernetes instances through the pre-implanted yaml files. After the instance is created, the automated script corresponding to the automated test framework execution template is distributed to the Kubernetes instance, the test script is executed, and the test results are filled back into the test case through the interface provided by the test platform; Testers can view the test execution results on the test platform and send test result emails to relevant personnel. After the execution is completed, Kubernetes will automatically release the test resources for use by other instances.
2. According to claim 1, a multi-language K8S-based automated testing system is characterized in that: In the script parsing module, after pre-compiling the automation scripts written in various test frameworks, check whether there are compilation errors in the automation scripts. If the pre-compilation fails, an email is sent to the corresponding tester to modify the script.
3. According to claim 1, a multi-language K8S-based automated testing system is characterized in that: The multiple automated testing frameworks include Pytest, Junit, TestNG, Rotbot Framework, Cucumber, Cypress, and Jmeter testing frameworks.
4. According to claim 1, a multi-language K8S-based automated testing system is characterized in that: In the test data generation module, the test data that the tested system environment depends on includes basic configuration data, user names, passwords, and menu items of the tested system environment.
5. An automated testing method based on multi-language K8S, characterized by: The specific steps are as follows: Step 1: Script parsing: Precompile the automation scripts written in various automation test frameworks from the code base. After precompiling, parse the relationship between the automation scripts and test cases, and associate a test case with the test script number of an automation script. Step 2: Run the script: Step 21: Create a corresponding test plan through the test platform. When creating the test plan, select the system environment to be tested. According to the system environment set in the test plan, obtain the test data that the tested system environment depends on, initialize the test data that it depends on, and send the generated data to the shared storage OSS for use during test execution. Step 22: The test plan includes multiple test cases, and the test script numbers corresponding to the multiple test cases are searched. According to the test script type associated with the test script number, the corresponding automated test framework execution template is searched, and the automated test framework execution template is driven to execute; Step 23: Call the Jenkins development interface to create multiple tasks one by one according to the generated multiple automated test framework execution templates, and generate the same multiple Kubernetes instances through the pre-implanted yaml files. After the instance is created, distribute the automation script corresponding to the automated test framework execution template to the Kubernetes instance, execute the test script, and fill the test results back into the test case through the interface provided by the test platform; Testers can view the test execution results on the test platform and send test result emails to relevant personnel. After the execution is completed, Kubernetes will automatically release the test resources for use by other instances.
6. According to claim 5, a multi-language K8S-based automated testing method is characterized in that: After pre-compiling the automation scripts written in various test frameworks, check whether there are compilation errors in the automation scripts. If the pre-compilation fails, send an email to the corresponding tester to modify the script.
7. According to claim 5, an automated testing method based on multi-language K8S is characterized in that: The multiple automated testing frameworks include Pytest, Junit, TestNG, Rotbot Framework, Cucumber, Cypress, and Jmeter testing frameworks.
8. According to claim 5, a multi-language K8S-based automated testing method is characterized in that: The test data that the tested system environment depends on includes basic configuration data, user names, passwords, and menu items of the tested system environment.
