Automatic testing method and device based on Grouping

By storing automated test cases with the Groovy script, and finding and running the Groovy script based on the basic information of the use case, the problem of difficulty to achieve simple and highly capable of automatic testing in existing technologies, and realized high -efficiency automation in complex business scenarios in the complex business scenarios test.

CN119357049APending Publication Date: 2025-01-24BEIJING SHANGYIN MICRO CORE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411396813.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

Existing automated testing technologies have difficulties in achieving simplicity and high compatibility, especially in complex business scenarios.

Method used

Realize the execution of automated testing by using the automated test case with the Groovy script, and finding and running the associated associated by the basic information of the target automation test case.

Benefits of technology

No need to build and maintain code projects, realize the simple and high compatibility of automation testing, and can adapt to various complex business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357049A_ABST
    Figure CN119357049A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic testing method and an automatic testing device based on Grouping. The method comprises the following steps: firstly, carrying out associated storage on an automatic test case and a Graody script used for executing the automatic test case; and each automatic test case corresponds to one independent file, so that the problem of difficulty in code maintenance is avoided. And the Grouping is high in flexibility, supports introduction of various software development environments, and solves the compatibility problem when an automatic test faces a complex service scene. And according to the basic information of the target automatic test case, searching a target Grouping script associated with the target automatic test case. And running the target Grouping script to execute the target automated test case. According to the method provided by the embodiment of the invention, a project for building and maintaining codes is not needed, and various business scenes can be compatible while platform visual management is adopted, so that automatic testing is simply and highly compatible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of automated testing technology, and in particular to a method and device for automated testing based on Groovy. Background Art

[0002] Automated testing is the use of tools or scripts to achieve the purpose of testing, with no or very little human involvement in software testing activities. The mainstream automated testing methods are basically implemented through pure code, pure platform, or a combination of code and platform.

[0003] In the existing technology, the pure code method requires the construction of a code project. The development cost will increase with the increase of test cases, and the maintenance difficulty will also increase. The pure platform method requires customized development, has a high construction threshold, and is difficult to be compatible in complex business scenarios. The code and platform hybrid method requires both the construction of a code project and the development of a platform. As the number of test scenarios increases, the code will become more redundant and the platform will become more complicated. Therefore, how to implement automated testing simply and with high compatibility has become an urgent problem to be solved. Summary of the invention

[0004] Based on the above problems, the present application provides a method and device for automated testing based on Groovy to implement automated testing in a simple and highly compatible manner.

[0005] The present application discloses a method for automated testing based on Groovy, the method comprising:

[0006] Storing the automated test case and the Groovy script in association; the Groovy script is used to execute the automated test case;

[0007] According to the basic information of the target automated test case, searching for the target Groovy script associated with the target automated test case; the basic information includes the case number, the case name, the associated folder number and the associated Groovy script file number;

[0008] Run the target Groovy script to execute the target automated test case.

[0009] Optionally, the storing the automated test cases and Groovy scripts in association with each other includes:

[0010] In response to the automated test case created by the user on the client, a folder associated with the automated test case is generated; the folder contains the Groovy script and files that the Groovy script depends on;

[0011] Write the number of the folder, the number of the Groovy script, and the number and name of the automated test case into the basic information table;

[0012] The folder and the basic information table are stored on the server.

[0013] Optionally, the automated test case created by the client includes:

[0014] The user inputs a use case number, a use case name and a use case template on the client; the use case template is related to a business attribute;

[0015] The user edits the use case template in the Groovy script editor of the client to obtain the Groovy script;

[0016] The files imported into the Groovy script are uploaded to a folder as files that the Groovy script depends on.

[0017] Optionally, searching for a target Groovy script associated with the target automated test case according to basic information of the target automated test case includes:

[0018] In response to the target automated test case selected by the user for execution on the client, basic information of the target automated test case is acquired;

[0019] The target folder associated with the target automated test case and the target Groovy script in the target folder are searched for according to the basic information table through the Groovy script executor of the server.

[0020] Optionally, the running of the target Groovy script to execute the target automated test case includes:

[0021] The target Groovy script imports the files that the Groovy script depends on through the configuration file POM, and executes the target automated test case.

[0022] Based on the above-mentioned Groovy-based automated testing method, the present application also discloses a Groovy-based automated testing device, including: a storage unit, a search unit and a running unit;

[0023] The storage unit is used to associate and store the automated test cases and the Groovy scripts; the Groovy scripts are used to execute the automated test cases;

[0024] The search unit is used to search for a target Groovy script associated with a target automated test case according to basic information of the target automated test case; the basic information includes a case number, a case name, an associated folder number, and an associated Groovy script file number;

[0025] The running unit is used to run the target Groovy script to execute the target automated test case.

[0026] Optionally, the storage unit includes:

[0027] A generating subunit, which is used to generate a folder associated with the automated test case in response to the automated test case created by the user on the client; the folder contains the Groovy script and files that the Groovy script depends on;

[0028] A writing subunit, used for writing the number of the folder, the number of the Groovy script, and the number and name of the automated test case into a basic information table;

[0029] The storage subunit is used to store the folder and the basic information table on the server side.

[0030] Optionally, the generating subunit includes:

[0031] An input subunit, used for the user to input a use case number, a use case name and a use case template on the client; the use case template is related to a business attribute;

[0032] An editing subunit, used for the user to edit the use case template in the Groovy script editor of the client to obtain the Groovy script;

[0033] The upload subunit is used to upload the files imported into the Groovy script to a folder as files dependent on the Groovy script.

[0034] Optionally, the searching unit includes:

[0035] An acquisition subunit, configured to acquire basic information of the target automated test case in response to the target automated test case selected by the user for execution on the client;

[0036] The search subunit is used to search, through the Groovy script executor of the server, the target folder associated with the target automated test case and the target Groovy script in the target folder according to the basic information table.

[0037] Optionally, the operating unit is used to:

[0038] The target Groovy script imports the files that the Groovy script depends on through the configuration file POM, and executes the target automated test case.

[0039] The present application discloses a method and device for automated testing based on Groovy. First, the automated test cases and the Groovy scripts used to execute the automated test cases are associated and stored. Each automated test case corresponds to an independent file to avoid the problem of difficult code maintenance. Groovy is highly flexible and supports the introduction of various software development environments, which solves the compatibility problem of automated testing in the face of complex business scenarios. According to the basic information of the target automated test case, the target Groovy script associated with the target automated test case is found. Run the target Groovy script to execute the target automated test case. The method described in this embodiment does not require the construction and maintenance of code projects. While adopting platform visual management, it is compatible with various business scenarios, thereby realizing automated testing simply and with high compatibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0041] Figure 1a A flowchart of a Groovy-based automated testing method disclosed in an embodiment of the present application;

[0042] Figure 1b A schematic diagram of a platform architecture of a Groovy-based automated testing method disclosed in an embodiment of the present application;

[0043] Figure 1c A schematic diagram of a folder disclosed in an embodiment of the present application;

[0044] Figure 2 A flowchart of another Groovy-based automated testing method disclosed in an embodiment of the present application;

[0045] Figure 3 A schematic diagram of the structure of a Groovy-based automated testing device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0047] Embodiment 1: This application discloses a method of automated testing based on Groovy.

[0048] For details, please refer to Figure 1a The present embodiment discloses a Groovy-based automated testing method, which includes the following steps:

[0049] Step 101: Store the automated test cases and Groovy scripts in association.

[0050] In the method described in this embodiment, the Groovy script is used to execute the automated test case.

[0051] As an optional method, the method described in this embodiment can be implemented in the form of a platform, such as Figure 1b As shown in the figure, the platform consists of a client and a server. The client includes a test case management module and a Groovy script editor, and the server includes a Groovy script executor and a test report generation module, as well as a data storage module for storing Groovy scripts, basic information of automated test cases, etc.

[0052] In the method described in this embodiment, the client supports users to create automated test cases. As an optional method, the user can enter the use case number, use case name, and use case template in the test case management module to create an automated test case. Among them, the use case template is related to the user's target business attributes. The user can select it by himself in the template library, or customize the template to improve the compatibility of the method described in this embodiment in different business scenarios.

[0053] In the method described in this embodiment, after creating an automated test case, the server will automatically generate a folder that is one-to-one related to the automated test case. Figure 1c As shown, the name of the folder can be the use case name entered by the user, which includes the files that the Groovy script depends on, that is, the lib folder, and the Groovy script, that is, the caseName.groovy file.

[0054] In the method described in this embodiment, the name of the folder can also be a name that can identify the automated test case, such as a use case number, a Groovy script name, etc. The specific content of the name is not limited here, and it only needs to be able to identify that the folder is associated with the automated test case.

[0055] Subsequently, users can edit the use case template in the Groovy script editor to obtain the final Groovy script. As an optional method, the lib folder is empty by default. Users can upload the third-party software development environment JDK (Java Development Kit) and business-customized JDK that the Groovy script depends on to the folder and use the import statement to import it in the Groovy script.

[0056] In the method described in this embodiment, the folder number, Groovy script number, creation user information, automated test case number and name and other information are written into the basic information table, and the folder and the basic information table are stored in the data storage module of the server. The automated test case itself can be stored locally by the user.

[0057] Step 102: According to the basic information of the target automated test case, find the target Groovy script associated with the target automated test case.

[0058] In the method described in this embodiment, the client can respond to the target automated test case selected by the user to be executed, and notify the server to obtain the basic information of the target automated test case from the data storage module. Among them, the way for the user to choose to execute the target automated test case can be a simple click, or it can be to enter any basic information of the target automated test case in the test case management module for search. In a feasible scenario, the user enters the creation user information in the test case management module and finds multiple results, then these multiple results can be displayed to the user in a list form, so that the user can select or further filter. Correspondingly, if the corresponding automated test case is not found through the basic information entered by the user, the client can return "no results" and other feedback information that can indicate that the target automated test case cannot be found. Here, the way in which the user chooses to execute the target automated test case is not specifically limited, and it is sufficient to be able to achieve the selection.

[0059] In the method described in this embodiment, the Groovy script executor on the server side can find the target folder associated with the target automated test case according to the basic information table, and find the target Groovy script under the target folder.

[0060] Step 103: Run the target Groovy script to execute the target automated test case.

[0061] In the method described in this embodiment, the target Groovy script can import the files that the Groovy script depends on through the configuration file POM (Project Object Model 1) to execute the target automated test case.

[0062] As an optional method, the test report generation module of the server also supports automatic generation of test reports according to the execution results of the target automated test cases. The test report generation module can generate test reports according to preset templates, and can also support user-defined generation templates.

[0063] As an optional method, the Groovy script executor sends the execution result to the test report generation module. The test report generation module can send the test report to the client for display, or store the test report in a target folder in the data storage module. Here, the generation process and processing method of the test report are not further limited, and users can obtain it.

[0064] In the method described in this embodiment, the test case management module of the client also supports the user to add, delete, modify and check the basic information of the automated test case. The user can find the created automated test case in the test case management module, delete it, or modify it through the Groovy script editor. Among them, the Groovy script editor supports the user to directly edit the Groovy script content on the platform, and supports trial running and printing of running results.

[0065] The method described in this embodiment is implemented through a unified and visual platform, without the need to build and maintain code engineering. Based on high flexibility, it supports the introduction of the Groovy language in various software development environments, allowing users to write or upload Groovy scripts for each automated test case. The Groovy script template can also be customized to solve the compatibility problem of automated testing in the face of complex business scenarios. In addition, the automated test cases and the Groovy scripts used to execute the automated test cases are stored in a one-to-one association. So that each automated test case corresponds to an independent file, avoiding the problem of difficult code maintenance. The platform also supports finding and running the associated Groovy script according to the basic information of the automated test case to execute the automated test case, and generating a test report for display, which realizes automated testing in a simple and highly compatible manner.

[0066] Example 2: This application discloses another method of automated testing based on Groovy, please refer to Figure 2The method described in this embodiment introduces the whole process of realizing automated testing based on Groovy.

[0067] Step 201: The test case management module of the client receives the name of the test case a input by the user and sends it to the server.

[0068] Step 202: The Groovy script executor of the server obtains the name from the client, and obtains the basic relationship table from the data storage module.

[0069] Step 203: The Groovy script executor finds the use case a and the folder associated with the use case according to the basic relationship table.

[0070] Step 204: The Groovy script executor executes the Groovy script in the folder and sends the execution result to the test report generation module of the server.

[0071] Step 205: The test report generation module generates a corresponding test report according to the execution result and sends it to the client.

[0072] Step 206: The test case management module of the client displays the test report to the user.

[0073] Based on the above embodiment disclosed a method for automated testing based on Groovy, this embodiment correspondingly discloses a device for automated testing based on Groovy. Figure 3 , the apparatus for automated testing based on Groovy comprises: a storage unit 301, a search unit 302 and an operation unit 303;

[0074] The storage unit 301 is used to associate and store the automated test cases with the Groovy scripts; the Groovy scripts are used to execute the automated test cases;

[0075] The search unit 302 is used to search for a target Groovy script associated with a target automated test case according to basic information of the target automated test case; the basic information includes a case number, a case name, an associated folder number, and an associated Groovy script file number;

[0076] The running unit 303 is used to run the target Groovy script to execute the target automated test case.

[0077] Optionally, the storage unit 301 includes:

[0078] A generating subunit, which is used to generate a folder associated with the automated test case in response to the automated test case created by the user on the client; the folder contains the Groovy script and files that the Groovy script depends on;

[0079] A writing subunit, used for writing the number of the folder, the number of the Groovy script, and the number and name of the automated test case into a basic information table;

[0080] The storage subunit is used to store the folder and the basic information table on the server side.

[0081] Optionally, the generating subunit includes:

[0082] An input subunit, used for the user to input a use case number, a use case name and a use case template on the client; the use case template is related to a business attribute;

[0083] An editing subunit, used for the user to edit the use case template in the Groovy script editor of the client to obtain the Groovy script;

[0084] The upload subunit is used to upload the files imported into the Groovy script to a folder as files dependent on the Groovy script.

[0085] Optionally, the searching unit 302 includes:

[0086] An acquisition subunit, configured to acquire basic information of the target automated test case in response to the target automated test case selected by the user for execution on the client;

[0087] The search subunit is used to search, through the Groovy script executor of the server, the target folder associated with the target automated test case and the target Groovy script in the target folder according to the basic information table.

[0088] Optionally, the operation unit 303 is used to:

[0089] The target Groovy script imports the files that the Groovy script depends on through the configuration file POM, and executes the target automated test case.

[0090] The embodiments in this specification are described in a progressive manner. As for the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the methods.

[0091] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0092] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0093] The features described in the embodiments of this specification can be replaced or combined with each other, so that professional and technical personnel in this field can implement or use the present application.

[0094] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for automated testing based on Groovy, characterized in that: include: Associate and store automated test cases and Groovy scripts; The Groovy script is used to execute the automated test case; According to the basic information of the target automated test case, searching for the target Groovy script associated with the target automated test case; the basic information includes the case number, the case name, the associated folder number and the associated Groovy script file number; Run the target Groovy script to execute the target automated test case.

2. The method according to claim 1, characterized in that: The storing of the automated test cases and Groovy scripts in association includes: In response to the automated test case created by the user on the client, a folder associated with the automated test case is generated; the folder contains the Groovy script and files that the Groovy script depends on; Write the number of the folder, the number of the Groovy script, and the number and name of the automated test case into the basic information table; The folder and the basic information table are stored on the server.

3. The method according to claim 2, characterized in that The automated test case created by the client includes: The user inputs a use case number, a use case name and a use case template on the client; the use case template is related to a business attribute; The user edits the use case template in the Groovy script editor of the client to obtain the Groovy script; The files imported into the Groovy script are uploaded to a folder as files that the Groovy script depends on.

4. The method according to claim 2, characterized in that: The step of searching for a target Groovy script associated with the target automated test case according to the basic information of the target automated test case includes: In response to the target automated test case selected by the user for execution on the client, basic information of the target automated test case is acquired; The target folder associated with the target automated test case and the target Groovy script in the target folder are searched for according to the basic information table through the Groovy script executor of the server.

5. The method according to claim 2, characterized in that: The running of the target Groovy script to execute the target automated test case includes: The target Groovy script imports the files that the Groovy script depends on through the configuration file POM, and executes the target automated test case.

6. A device for automated testing based on Groovy, characterized in that: include: storage unit, search unit and operation unit; The storage unit is used to associate and store the automated test cases with the Groovy scripts; The Groovy script is used to execute the automated test case; The search unit is used to search for a target Groovy script associated with a target automated test case according to basic information of the target automated test case; the basic information includes a case number, a case name, an associated folder number, and an associated Groovy script file number; The running unit is used to run the target Groovy script to execute the target automated test case.

7. The device according to claim 6, characterized in that The storage unit comprises: A generating subunit, which is used to generate a folder associated with the automated test case in response to the automated test case created by the user on the client; the folder contains the Groovy script and files that the Groovy script depends on; A writing subunit, used for writing the number of the folder, the number of the Groovy script, and the number and name of the automated test case into a basic information table; The storage subunit is used to store the folder and the basic information table on the server side.

8. The device according to claim 7, characterized in that The generating subunit comprises: An input subunit, used for the user to input a use case number, a use case name and a use case template on the client; the use case template is related to a business attribute; An editing subunit, used for the user to edit the use case template in the Groovy script editor of the client to obtain the Groovy script; The upload subunit is used to upload the files imported into the Groovy script to a folder as files dependent on the Groovy script.

9. The device according to claim 7, characterized in that The searching unit comprises: An acquisition subunit, configured to acquire basic information of the target automated test case in response to the target automated test case selected by the user for execution on the client; The search subunit is used to search, through the Groovy script executor of the server, the target folder associated with the target automated test case and the target Groovy script in the target folder according to the basic information table.

10. The device according to claim 7, characterized in that The operating unit is used for: The target Groovy script imports the files that the Groovy script depends on through the configuration file POM, and executes the target automated test case.