Multi-framework compatible test methods, devices, and electronic equipment

By parsing test case packages and annotations and dynamically determining the test framework, the problem of high test case migration costs is solved, efficient cross-framework testing is achieved, and test efficiency and stability are improved.

CN114996121BActive Publication Date: 2025-09-09BEIJING SANKUAI ONLINE TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210437392.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-21
Publication Date
2025-09-09
Estimated Expiration
2042-04-21

AI Technical Summary

Technical Problem

In the prior art, when migrating test cases to other test frameworks, the test configuration files and test cases need to be modified, resulting in high migration costs and low testing efficiency.

Method used

By parsing the test case package, determining the annotations of the object to be tested, dynamically judging the test framework, and executing the test case according to the matching test framework, cross-framework testing tasks can be achieved.

Benefits of technology

The test case migration cost is reduced, the test efficiency is improved, and the test cases and test data are loosely coupled, which improves the stability of the test project.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114996121B_ABST
    Figure CN114996121B_ABST
Patent Text Reader

Abstract

The present application discloses a multi-framework compatible testing method, which belongs to the field of computer technology and helps to improve testing efficiency. The method includes: in response to a test task being triggered, obtaining a test case package corresponding to the test task; determining the object to be tested corresponding to the test task by parsing the test case package; parsing the annotations of the object to be tested, determining the test framework matched by the test task and the test cases of each object to be tested; executing the test cases of each object to be tested according to the test framework to complete the test task. This method marks the class or method to be executed in the form of annotations in the test case, and configures the test framework in the form of annotations, so that the test case package can be executed on the test platform according to the user's test requirements, with low test case migration cost and high test efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a testing method, device, electronic device, and computer-readable storage medium compatible with multiple frameworks. Background Art

[0002] With the widespread adoption of automated testing technology, more and more open source testing frameworks are being made available to developers, allowing them to quickly implement automated testing. During automated testing, developers often select a suitable testing framework based on the test program's requirements and build test projects. Migrating test cases to another testing framework requires modifying the test configuration files to adapt to the new framework, and even modifying the test cases, resulting in high test environment migration costs.

[0003] It can be seen that the testing method in the prior art still needs to be improved. Summary of the Invention

[0004] The embodiments of the present application provide a multi-framework compatible testing method, which helps to reduce the cost of test case migration and improve testing efficiency.

[0005] In a first aspect, an embodiment of the present application provides a multi-framework compatible testing method, including:

[0006] In response to a test task being triggered, obtaining a test case package corresponding to the test task;

[0007] Determine the object to be tested corresponding to the test task by parsing the test case package;

[0008] Parsing the annotations of the object to be tested, and determining the test framework and test cases of each object to be tested that match the test task;

[0009] The test cases of each of the objects to be tested are executed according to the test framework to complete the test task.

[0010] In a second aspect, an embodiment of the present application provides a multi-frame compatible testing device, comprising:

[0011] A test case package acquisition module, configured to acquire a test case package corresponding to a test task in response to a test task being triggered;

[0012] A test object determination module, configured to determine the test object corresponding to the test task by parsing the test case package;

[0013] A test case determination module, configured to parse the annotations of the object to be tested, and determine the test framework that matches the test task and the test cases of each of the objects to be tested;

[0014] The test case execution module is used to execute the test case of each of the objects to be tested according to the test framework to complete the test task.

[0015] In a third aspect, an embodiment of the present application provides a test platform, including: a client, a background test server, and a data management server, wherein:

[0016] The data management server is used to store test case packages;

[0017] The client is configured to display the test case packages matched by the current user and, in response to a test task for the test case package selected by the user being triggered, send a test task execution request to the background test server, wherein the test task execution request carries information about the test case package to be executed;

[0018] The backend test server is configured to obtain a test case package to be executed for the test task in response to receiving the test task execution request;

[0019] The backend test server is further configured to determine the object to be tested corresponding to the test task by parsing the test case package;

[0020] The backend test server is further configured to parse the annotations of the object to be tested, and determine the test framework that matches the test task and the test cases of each object to be tested;

[0021] The background test server is further configured to execute the test cases of each of the objects to be tested according to the test framework to complete the test task.

[0022] In a fourth aspect, an embodiment of the present application further discloses an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the multi-framework compatible testing method described in the embodiment of the present application when executing the computer program.

[0023] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the multi-framework compatible testing method disclosed in the embodiment of the present application are performed.

[0024] The multi-framework compatible testing method disclosed in the embodiment of the present application obtains a test case package corresponding to the test task in response to the test task being triggered; determines the object to be tested corresponding to the test task by parsing the test case package; parses the annotations of the object to be tested to determine the test framework matching the test task and the test cases of each object to be tested; executes the test cases of each object to be tested according to the test framework to complete the test task, which helps to improve testing efficiency.

[0025] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0027] Figure 1 This is a flow chart of the multi-frame compatible testing method of Example 1 of the present application;

[0028] Figure 2 This is a schematic diagram of the structure of the test platform compatible with multiple frameworks in Example 1;

[0029] Figure 3 This is another flow chart of the multi-frame compatible testing method of the first embodiment of the present application;

[0030] Figure 4 This is one of the structural diagrams of the multi-frame compatible testing device of the second embodiment of the present application;

[0031] Figure 5 This is the second structural diagram of the multi-frame compatible testing device of the second embodiment of the present application;

[0032] Figure 6 A block diagram schematically shows an electronic device for executing the method according to the present application; and

[0033] Figure 7 The figure schematically shows a storage unit for storing or carrying a program code for implementing the method according to the present application. DETAILED DESCRIPTION

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

[0035] Example 1

[0036] The embodiment of the present application discloses a test method compatible with multiple frameworks, such as Figure 1 As shown, the method includes: steps 110 to 140.

[0037] Step 110: In response to a test task being triggered, obtain a test case package corresponding to the test task.

[0038] In some embodiments of the present application, the test cases first need to be packaged according to preset rules and uploaded to the test platform, and then the test platform executes the test cases in the test case package.

[0039] In the prior art, test case developers usually develop test cases through project management tools, and package the test cases through a packaging function or an export function provided by the project management tools.

[0040] In some embodiments of the present application, the test case package is packaged by a preset Maven plug-in. For example, the Maven plug-in compiles the files of the project to be packaged by running a preset Maven script and creates a JAR file corresponding to the project.

[0041] In some embodiments of the present application, the test case package first needs to be uploaded to the test platform. After that, the user selects the test case package through the test platform and triggers the test task corresponding to the test case package.

[0042] In some embodiments of the present application, a user may trigger a test task through a client page of the test platform.

[0043] Below, the test method compatible with multiple frameworks is used in Figure 2 The test platform shown in the figure is used as an example to illustrate the running process of the test task.

[0044] like Figure 2 As shown, the test platform includes: a client 210, a background test server 220, and a data management server 230. The functions and specific implementation plans of each component of the test platform are described below.

[0045] The data management server 230 is used to store test case packages and test results. The test case packages can be uploaded to the data management server 230 by a preset Maven plugin after packaging the files in the test case project, or uploaded to the data management server 230 by a user through the client 210.

[0046] In some embodiments of the present application, the data management server 230 may be one physical device or multiple physical devices. In the case where the data management server 230 is multiple physical devices, different types of data may be stored in different physical devices.

[0047] In some embodiments of the present application, Figure 2 As shown, the test platform also includes: a user management system 240, which is used to manage the user information (such as user name, account ID, account password, etc.) of users registered on the test platform, as well as to manage the test tasks uploaded by each user, the storage address of the test case package corresponding to each test task, and other information. After the user logs in to the test platform through the client 210, the client 210 obtains the test tasks uploaded by the user through the user management system 240 and displays them to the user through the interactive interface of the client 210, so that the user can select the test task to be executed.

[0048] In some embodiments of the present application, a user may trigger a test task through the client 210 .

[0049] The client 210 is used to display the test case packages matched by the current user, and in response to the test task for the test case package selected by the user being triggered, sends a test task execution request to the background test server, wherein the test task execution request carries: information about the test case package to be executed. For example, a list of selectable test case packages can be displayed on the interactive interface of the client for the user to select the test case package to be executed, and a start test button can be set for the user to trigger the test task for executing the selected test case package. After detecting that the user selects a test case package and submits a test task execution request for the test case package, the client obtains the information of the test case package selected by the user (such as the name of the test case package or the system identifier), and generates a test task execution request based on the information of the test case package. Thereafter, the generated test task execution request is sent to the background test server 220, and the background test server 220 executes the test task.

[0050] In some embodiments of the present application, the client 210 may be a web page or an application program. The present application does not limit the specific implementation form of the client.

[0051] After receiving the test task execution request, the background test server 220 confirms that the test task is triggered, and further executes the test task matching the test task execution request.

[0052] In some embodiments of the present application, the backend test server 220 executing the test task matching the test task execution request further includes:

[0053] The backend test server 220 is configured to, in response to receiving the test task execution request, obtain a test case package to be executed for the test task. For example, in response to receiving the test task execution request, the backend test server 220 initiates a process to execute the test task corresponding to the test task execution request.

[0054] In some embodiments of the present application, a task identifier is assigned to each test task in the test platform, and the task identifier corresponds to the task to be completed, so that the user can choose to end the test task.

[0055] Afterwards, the background test server 220 obtains the test case package that matches the information of the test case package carried in the test task execution request through the data management server 230 through the process.

[0056] In some embodiments of the present application, a task identifier is assigned to each test task in the test platform.

[0057] In some embodiments of the present application, Figure 3 As shown, in response to a test task being triggered, before obtaining a test case package corresponding to the test task, the process further includes: step 100 and step 101.

[0058] Step 100: Obtain and display the information of the test case package uploaded by the currently logged-in user.

[0059] Step 101: In response to a test case package selection operation performed by a user through a test configuration interface, information of the test case package selected by the user is determined.

[0060] The information of the test case package includes: the test case package name, estimated running time and other information.

[0061] In some embodiments of the present application, the client 210 is further configured to obtain and display information about the test case package uploaded by the currently logged-in user.

[0062] For example, after a user logs in, the client 210 displays a test task configuration interface to the user and displays a list of test case packages uploaded by the currently logged-in user on the test task configuration interface. The client 210 obtains the test case packages uploaded by the user through the user management system 240 and displays information such as the name of the test case package and the estimated execution time to the user through the test configuration interface of the client 210.

[0063] The user can select a test case package through the test configuration interface. The client detects that the user selects a test case package through the test configuration interface, and after a test case package is selected, further obtains the name of the test case package.

[0064] In some embodiments of the present application, the test task configuration interface is also used to display pre-test parameters of the test task, such as the test environment, test description and other information.

[0065] In some embodiments of the present application, the data management server 230 is further configured to store test parameter information of the test task.

[0066] Step 120: Determine the object to be tested corresponding to the test task by parsing the test case package.

[0067] In some embodiments of the present application, determining the object to be tested corresponding to the test task by parsing the test case package includes: parsing the test case package to obtain the objects included in the test case package and the code of each object; traversing the code of the object, and based on the value of the preset second annotation marked in the code, determining the object indicated by the value as requiring execution as the object to be tested corresponding to the test task. The value of the preset second annotation is used to indicate whether the corresponding object needs to be executed.

[0068] The objects described in the embodiments of this application include classes and methods. The test case package includes the code for multiple classes, the code for one or more methods within each class, and the code for one or more test cases within each class. By parsing the test case package, the code for all packaged classes, methods, and test cases can be obtained.

[0069] In some embodiments of the present application, the test platform predefines annotations for marking whether objects in the test case are executed, and provides the annotations to the user. During the process of the platform loading objects (such as classes or methods), the value of the annotation is parsed to determine whether the corresponding object is executed. In the process of writing test cases, the user marks annotations on each object and configures whether the object needs to be executed by setting different values ​​for the annotation. Furthermore, during the execution of the test case, by traversing the code, the object marked with a preset second annotation in the code is determined, and the value of the preset second annotation indicates the object that needs to be executed as the object to be tested corresponding to the test task.

[0070] In some embodiments of the present application, during the class loading process, the information on the class (such as annotations) is analyzed through a reflection mechanism to determine whether to load the class.

[0071] by Figure 2 Taking the test platform shown as an example, the background test server 220 is further configured to determine the object to be tested corresponding to the test task by parsing the test case package.

[0072] Furthermore, the background test server 220 is used to parse the test case package, obtain the objects included in the test case package, and the code of each object; traverse the code of the object, and according to the value of the preset second annotation marked in the code, determine the object indicated by the value as needing to be executed as the object to be tested corresponding to the test task. The value of the preset second annotation is used to indicate whether the corresponding object needs to be executed. For example, the background test server 220 parses the test case package to obtain the class included in the test case package; thereafter, further parses the preset second annotation value of the class marked with the preset second annotation, and selects the class indicated by the preset second annotation value as the class to be tested.

[0073] Step 130 , parsing the annotations of the object to be tested, and determining the test framework that matches the test task and the test cases of each of the objects to be tested.

[0074] In some embodiments of the present application, by introducing a tag mechanism, the user sets a specified tag for a specific class or method when writing a test case class to specify the execution information such as the test framework of the corresponding class.

[0075] In the prior art, annotations are widely used in frameworks such as Hibernate and Spring. Annotations are embedded in programs as metadata. Annotations can be parsed by parsing tools or compilation tools. In some embodiments of the present application, by setting annotations on test classes when writing test cases, information such as the execution mode (i.e., the test framework) of the test class can be specified.

[0076] In some embodiments of the present application, the parsing of the annotations of the object to be tested and determining the test framework that matches the test task and the test cases of each object to be tested includes: parsing the annotations of the object to be tested and obtaining the value of the annotation used to indicate the type of test framework; and determining the test framework used to execute the test case of the object to be tested based on the value. Different test frameworks have different annotation types when writing test cases. Based on the annotation type of the object to be tested, it is possible to dynamically determine which specific test framework the object to be tested belongs to, thereby determining which test framework to use for execution. For example, if user A uses the junit framework, then the annotation on the test case must be "org.junit.test". By parsing the annotations of the class to be tested and obtaining the value of the annotation indicating the type of test framework, such as "org.junit.test", it is possible to determine based on the value of the annotation that the junit framework's execution mode should be used to execute the test case of the class to be tested, and to collect test results.

[0077] Specific to Figure 2 For the test platform shown, the background test server 220 is also used to parse the annotations of the test object to determine the test framework and test cases for each test object that match the test task. The annotations described in some embodiments of the present application are annotations that users mark for corresponding classes according to preset rules when designing test cases.

[0078] Step 140: Execute the test case of each of the objects to be tested according to the test framework to complete the test task.

[0079] After determining the test framework that matches the current test task and the test cases to be executed, the test cases specified for each object to be tested can be executed according to the execution mode matched by the test framework to complete the test task.

[0080] Specific to Figure 2 As for the test platform shown, the background test server 220 executes the test cases of each of the objects to be tested according to the test framework to complete the test task.

[0081] The specific implementation method of executing the test cases of each class or method to be tested according to the test framework is the existing technology and will not be repeated in the embodiments of this application.

[0082] In some embodiments of the present application, executing the test cases of each of the objects to be tested according to the test framework includes: in the process of executing the test cases of each of the objects to be tested, obtaining the execution results of the test cases of each of the objects to be tested according to the test framework, wherein the execution results include one or more of the following: data execution results, error stack, and test case execution log. For example, in a project that executes a determined test case according to a selected execution mode, the execution results of the executed test cases are collected through the test framework. The execution results of the test cases include, but are not limited to, one or more of the following: data execution results output after executing the corresponding test case code based on given test data; error stack information when a test case execution error occurs; and execution log information such as the execution mode and time of the test case.

[0083] The specific implementation method of collecting test case execution results under a specified test framework is prior art and will not be described in detail here.

[0084] In some embodiments of the present application, Figure 3 As shown, after executing the test cases in each of the objects to be tested according to the test framework, the method further includes: step 150.

[0085] Step 150: Display the execution results of the test cases for each of the objects to be tested.

[0086] In some embodiments of the present application, after the test case is executed, the user can intuitively see the description of the executed test case, error stack information, and the complete test case execution log on the client page.

[0087] like Figure 2 As shown, the testing platform also includes a test result collection system 250. As the backend testing server 220 executes the test cases for each test object according to the testing framework, the test result collection system 250 collects the test case execution results in real time and stores them sequentially. The client 210 can obtain the test case execution results stored by the test result collection system 250 in real time, and can also view historical test case execution results after the test task is completed.

[0088] The multi-framework compatible testing method disclosed in the embodiment of the present application obtains a test case package corresponding to the test task in response to the test task being triggered; determines the object to be tested corresponding to the test task by parsing the test case package; parses the annotations of the object to be tested to determine the test framework matching the test task and the test cases of each object to be tested; executes the test cases of each object to be tested according to the test framework to complete the test task, which helps to improve testing efficiency.

[0089] The multi-framework compatible testing method disclosed in the embodiment of the present application, by marking the class or method to be executed in the form of annotations in the test case, and configuring the test framework in the form of annotations, makes it possible for the test case package to be executed according to the user's test requirements on the test platform, with low test case migration cost and high test efficiency. In addition, there is no need for the user to locally deploy the execution environment of the test case, which reduces the user's testing cost. On the other hand, the test configuration data can be set through the client interactive interface of the test platform and does not need to be written in the test case code, so that the test case code and test data are loosely coupled, which helps to improve the stability of the test project.

[0090] Furthermore, the testing method disclosed in the embodiment of the present application can realize the white-screen configuration of the test project through the client of the test platform, and supports the white-screen output of the test results, which can further improve the testing efficiency.

[0091] Example 2

[0092] The embodiment of the present application discloses a test device compatible with multiple frames, such as Figure 4 As shown, the device includes:

[0093] The test case package acquisition module 410 is configured to acquire a test case package corresponding to the test task in response to the test task being triggered;

[0094] The test object determination module 420 is used to determine the test object corresponding to the test task by parsing the test case package;

[0095] A test case determination module 430 is configured to parse the annotations of the object to be tested and determine the test framework that matches the test task and the test cases of each object to be tested;

[0096] The test case execution module 440 is configured to execute the test case of each of the objects to be tested according to the test framework to complete the test task.

[0097] In some embodiments of the present application, the test case execution module 440 is further configured to:

[0098] In the process of executing the test case of each of the objects to be tested, obtaining the execution result of the test case of each of the objects to be tested according to the test framework, wherein the execution result includes one or more of the following: data execution result, error stack, and test case execution log;

[0099] like Figure 5 As shown, the device also includes:

[0100] The test case execution result display module 450 is used to display the execution result of the test case of each of the objects to be tested.

[0101] In some embodiments of the present application, the test case package is packaged using a preset Maven plug-in.

[0102] In some embodiments of the present application, the test object determination module 420 is further configured to:

[0103] Parsing the test case package to obtain objects included in the test case package and codes of each object;

[0104] The code of the object is traversed, and according to the value of the preset second annotation marked in the code, the object indicated by the value as needing to be executed is determined as the object to be tested corresponding to the test task.

[0105] In some embodiments of the present application, the test case determination module 430 is further configured to:

[0106] Parsing the annotation of the object to be tested to obtain the value of the annotation indicating the test framework type;

[0107] A test framework used to execute the test case of the object to be tested is determined according to the value.

[0108] In some embodiments of the present application, Figure 5 As shown, in response to the test task being triggered, before obtaining the test case package corresponding to the test task, the apparatus further includes:

[0109] The test case package display module 400 is used to obtain and display the information of the test case package uploaded by the currently logged-in user;

[0110] The test case package information determination module 401 is configured to determine information of a test case package selected by a user in response to a test case package selection operation performed by the user through a test configuration interface.

[0111] The multi-frame compatible testing device disclosed in the embodiment of the present application is used to implement the multi-frame compatible testing method described in Example 1 of the present application. The specific implementation methods of each module of the device will not be repeated here. Please refer to the specific implementation methods of the corresponding steps in the method embodiment.

[0112] The multi-framework compatible testing device disclosed in the embodiment of the present application obtains a test case package corresponding to the test task in response to a test task being triggered; determines the object to be tested corresponding to the test task by parsing the test case package; parses the annotations of the object to be tested to determine the test framework matching the test task and the test cases of each object to be tested; executes the test cases of each object to be tested according to the test framework to complete the test task, which helps to improve testing efficiency.

[0113] The multi-framework compatible test device disclosed in the embodiment of the present application, by marking the class or method to be executed in the form of annotations in the test case, and configuring the test framework in the form of annotations, makes it possible for the test case package to be executed according to the user's test requirements on the test platform, with low test case migration cost and high test efficiency. In addition, there is no need for the user to locally deploy the execution environment of the test case, which reduces the user's testing cost. On the other hand, the test configuration data can be set through the client interactive interface of the test platform and does not need to be written in the test case code, so that the test case code and test data are loosely coupled, which helps to improve the stability of the test project.

[0114] Furthermore, the test device disclosed in the embodiment of the present application can realize the white-screen configuration of the test project through the client of the test platform, and supports the white-screen output of the test results, which can further improve the test efficiency.

[0115] Each embodiment in this specification is described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between the various embodiments can be referred to in conjunction with each other. For the device embodiments, since they are generally similar to the method embodiments, their description is relatively simple, and for relevant parts, reference can be made to the description of the method embodiments.

[0116] The above is a detailed introduction to a multi-framework compatible testing method and device provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

[0117] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0118] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be appreciated by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all of the functions of some or all of the components in the electronic device according to the embodiment of the present application. The application can also be implemented as a device or apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0119] For example, Figure 6 An electronic device that can implement the method according to the present application is shown. The electronic device can be a PC, a mobile terminal, a personal digital assistant, a tablet computer, etc. The electronic device conventionally includes a processor 610 and a memory 620, and program code 630 stored on the memory 620 and executable on the processor 610. When the processor 610 executes the program code 630, the method described in the above embodiments is implemented. The memory 620 can be a computer program product or a computer-readable medium. The memory 620 can be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk, or a ROM. The memory 620 has a storage space 6201 for program code 630 of a computer program for executing any of the method steps described above. For example, the storage space 6201 for program code 630 can include individual computer programs for implementing various steps in the above method. The program code 630 is computer-readable code. These computer programs can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards, or floppy disks. The computer program includes a computer-readable code, and when the computer-readable code is run on an electronic device, the electronic device is caused to execute the method according to the above embodiment.

[0120] An embodiment of the present application further discloses a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the multi-framework compatible testing method as described in the first embodiment of the present application are implemented.

[0121] Such a computer program product may be a computer-readable storage medium having a computer program product. Figure 6 The memory 620 in the electronic device shown is similarly arranged as a storage segment, storage space, etc. The program code can be compressed and stored in the computer readable storage medium in an appropriate form. The computer readable storage medium is generally as shown in FIG. Figure 7 The portable or fixed storage unit generally includes computer-readable code 630', which is a code read by a processor and implements the steps of the above-described method when executed by the processor.

[0122] References herein to "one embodiment," "an embodiment," or "one or more embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Furthermore, please note that instances of the phrase "in one embodiment" do not necessarily all refer to the same embodiment.

[0123] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.

[0124] In the claims, any reference signs placed between brackets shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in the claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

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

Claims

1. A multi-framework compatible testing method, characterized in that: include: In response to a test task being triggered, obtaining a test case package corresponding to the test task; Determine the object to be tested corresponding to the test task by parsing the test case package; Parsing the annotations of the object to be tested, and determining the test framework and test cases of each object to be tested that match the test task; Executing the test cases of each of the objects to be tested according to the test framework to complete the test task; The step of determining the object to be tested corresponding to the test task by parsing the test case package includes: Parsing the test case package to obtain objects included in the test case package and codes of each object; Traversing the code of the object, and determining, according to the value of the preset second annotation marked in the code, the object indicated by the value as needing to be executed as the object to be tested corresponding to the test task; The step of parsing the annotations of the object to be tested and determining the test framework matching the test task and the test cases of each of the objects to be tested includes: Parsing the annotation of the object to be tested to obtain the value of the annotation indicating the test framework type; A test framework used to execute the test case of the object to be tested is determined according to the value.

2. The method according to claim 1, characterized in that The step of executing the test case of each of the objects to be tested according to the test framework includes: In the process of executing the test case of each of the objects to be tested, obtaining the execution result of the test case of each of the objects to be tested according to the test framework, wherein the execution result includes one or more of the following: data execution result, error stack, and test case execution log; After the step of executing the test cases of each of the objects to be tested according to the test framework, the method further includes: Display the execution results of the test cases for each of the objects to be tested.

3. The method according to claim 1, characterized in that The test case package is packaged using a preset Maven plug-in.

4. The method according to any one of claims 1 to 3, characterized in that Before the step of obtaining a test case package corresponding to the test task in response to the test task being triggered, the method includes: Get and display the information of the test case package uploaded by the currently logged-in user; In response to a test case package selection operation performed by a user through a test configuration interface, information of the test case package selected by the user is determined.

5. A multi-frame compatible testing system, characterized in that: include: A client, a background test server, and a data management server, wherein the data management server is used to store test case packages; The client is configured to display the test case packages matched by the current user and, in response to a test task for the test case package selected by the user being triggered, send a test task execution request to the background test server, wherein the test task execution request carries information about the test case package to be executed; The backend test server is configured to obtain a test case package to be executed for the test task in response to receiving the test task execution request; The backend test server is further configured to determine the object to be tested corresponding to the test task by parsing the test case package; The backend test server is further configured to parse the annotations of the object to be tested, and determine the test framework that matches the test task and the test cases of each object to be tested; The background test server is further configured to execute the test cases of each of the objects to be tested according to the test framework to complete the test task; Determining the object to be tested corresponding to the test task by parsing the test case package includes: Parsing the test case package to obtain objects included in the test case package and codes of each object; Traversing the code of the object, and determining, according to the value of the preset second annotation marked in the code, the object indicated by the value as needing to be executed as the object to be tested corresponding to the test task; The parsing of the annotations of the object to be tested and determining the test framework matching the test task and the test cases of each of the objects to be tested includes: Parsing the annotation of the object to be tested to obtain the value of the annotation indicating the test framework type; A test framework used to execute the test case of the object to be tested is determined according to the value.

6. A multi-frame compatible testing device, characterized in that: include: A test case package acquisition module, configured to acquire a test case package corresponding to a test task in response to a test task being triggered; A test object determination module, configured to determine the test object corresponding to the test task by parsing the test case package; A test case determination module, configured to parse the annotations of the object to be tested, and determine the test framework that matches the test task and the test cases of each of the objects to be tested; A test case execution module, configured to execute the test case of each of the objects to be tested according to the test framework to complete the test task; Determining the object to be tested corresponding to the test task by parsing the test case package includes: Parsing the test case package to obtain objects included in the test case package and codes of each object; Traversing the code of the object, and determining, according to the value of the preset second annotation marked in the code, the object indicated by the value as needing to be executed as the object to be tested corresponding to the test task; The parsing of the annotations of the object to be tested and determining the test framework matching the test task and the test cases of each of the objects to be tested includes: Parsing the annotation of the object to be tested to obtain the value of the annotation indicating the test framework type; A test framework used to execute the test case of the object to be tested is determined according to the value.

7. An electronic device comprising a memory, a processor, and a program code stored in the memory and executable on the processor, wherein: When the processor executes the program code, the multi-framework compatible testing method described in any one of claims 1 to 4 is implemented.

8. A computer-readable storage medium having program code stored thereon, characterized in that: When the program code is executed by a processor, the steps of the multi-framework compatible testing method described in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Method and device for constructing Android App automated test framework based on Appium

    CN108427646A

  • Testing method, testing device and electronic equipment

    CN110768860A