CN114297081A - Automatic testing method and related equipment - Google Patents

Automatic testing method and related equipment Download PDF

Info

Publication number
CN114297081A
CN114297081A CN202111669291.XA CN202111669291A CN114297081A CN 114297081 A CN114297081 A CN 114297081A CN 202111669291 A CN202111669291 A CN 202111669291A CN 114297081 A CN114297081 A CN 114297081A
Authority
CN
China
Prior art keywords
test case
target test
test
target
automated testing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111669291.XA
Other languages
Chinese (zh)
Inventor
唐健
曾小龙
黄海
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Jieshun Science and Technology Industry Co Ltd
Original Assignee
Shenzhen Jieshun Science and Technology Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Jieshun Science and Technology Industry Co Ltd filed Critical Shenzhen Jieshun Science and Technology Industry Co Ltd
Priority to CN202111669291.XA priority Critical patent/CN114297081A/en
Publication of CN114297081A publication Critical patent/CN114297081A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application discloses an automatic testing method and related equipment, which are used for improving the efficiency of automatic testing. The method in the embodiment of the application comprises the following steps: acquiring a target test case, wherein the target test case comprises a test case among single-process multi-modules; analyzing the target test cases and sequentially arranging the target test cases in an operation list; when the target test case is legal, carrying out automatic test among the single-process multi-modules according to the operation list; and when the preset conditions are met, ending the test and outputting the result.

Description

Automatic testing method and related equipment
Technical Field
The embodiment of the application relates to the field of automatic testing, in particular to an automatic testing method and related equipment.
Background
The automated testing, namely the automation of software testing, is to run test cases under preset conditions and analyze the running results. Generally, this test method is a process of converting human-driven test behavior into machine execution. For manual testing, after a test case is designed, a tester needs to execute testing step by step according to the designed test case to obtain an actual result, and compare the actual result with an expected result. And automatic testing can be realized by compiling an automatic test case without manual operations such as clicking a mouse and triggering services by a keyboard, and a test result is output.
The existing automatic test scheme is usually only directed at the synchronous interface of a single module, and the test result of the interface is obtained through synchronous return data of the interface. When a multi-module and multi-interface asynchronous input and output business process is involved and the input and output requirements of each node of the business process are ordered and complete, a tester needs to manually trigger the business process for multiple times and check the interface display or software log output to confirm the test result. Therefore, a large amount of time and labor cost are consumed for carrying out automatic testing among the multiple modules, and the improvement of the automatic testing efficiency is limited.
Disclosure of Invention
A first aspect of an embodiment of the present application provides an automated testing method, including:
acquiring a target test case, wherein the target test case comprises a test case among single-process multi-modules;
analyzing the target test cases and sequentially arranging the target test cases in an operation list;
when the target test case is legal, carrying out automatic test among the single-process multi-modules according to the operation list;
and when the preset conditions are met, ending the test and outputting the result.
Optionally, before performing the automated testing among the single-process multi-modules according to the operation list when the target test case is legal, the method further includes:
and if the target test case contains third party keywords, registering the third party keywords.
Optionally, before ending the test and outputting the result when the preset condition is met, the method further includes:
and when the target test case is illegal, returning to execute the step of obtaining the target test case.
Optionally, when the preset condition is met, ending the test and outputting the result includes:
and when any operation fails to be executed, ending the test and outputting a result.
A second aspect of the embodiments of the present application provides an automatic testing apparatus, including:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target test case, and the target test case comprises a test case among single-process multi-modules;
the analysis unit is used for analyzing the target test cases and sequentially arranging the target test cases in an operation list;
the test unit is used for carrying out the automatic test among the single-process multi-modules according to the operation list when the target test case is legal;
and the output unit is used for finishing the test and outputting the result when the preset condition is met.
Optionally, the automatic testing apparatus further includes:
and the registration unit is used for registering the third party keyword if the target test case contains the third party keyword.
Optionally, the test unit is further configured to, when the target test case is illegal, return to the step of obtaining the target test case.
Optionally, the output unit is configured to end the test and output the result when any one of the operations fails to be executed.
A third aspect of the embodiments of the present application provides an automated testing apparatus, including:
the system comprises a central processing unit, a memory and an input/output interface;
the memory is a transient memory or a persistent memory;
the central processor is configured to communicate with the memory and execute the operations of the instructions in the memory to perform the method of the first aspect.
A fourth aspect of the embodiments of the present application provides a computer storage medium, where instructions are stored in the computer storage medium, and when the instructions are executed on a computer, the instructions cause the computer to perform the method of the first aspect.
According to the technical scheme, the embodiment of the application has the following advantages: the multiple modules of the single process can be automatically tested through the target test case containing the test case between the single process and the multiple modules, a tester does not need to manually trigger the target test case many times, and the efficiency of automatic testing is improved to a certain extent.
Drawings
FIG. 1 is a flow chart of an automated testing method according to an embodiment of the present application;
FIG. 2 is another flow chart of an automated testing method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a test case of the automated testing method according to the embodiment of the present application;
FIG. 4 is a schematic diagram of a test case operation list of the automated testing method according to the embodiment of the present application;
FIG. 5 is a block diagram of an automated testing apparatus according to an embodiment of the present application;
FIG. 6 is another block diagram of an automated testing apparatus according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides an automatic testing method and related equipment, which are used for improving the automatic testing efficiency.
Referring to fig. 1, an embodiment of the present application provides an automated testing method, including:
101. and acquiring a target test case, wherein the target test case comprises a test case among single-process multi-modules.
Before the automatic test is carried out, a test case written by an operator according to a test case writing specification needs to be obtained, and a target test case is determined according to a certain process to be tested. Specifically, the corresponding test case may be automatically obtained according to the process to be tested, or an operator may manually select a suitable test case according to a requirement to perform the test, which is not limited herein.
In addition, any operation of a test case at least comprises a primary keyword. In practical applications, the test case further includes a secondary keyword or a third-party keyword, which is not limited herein. The first-level keywords and the second-level keywords are preset keywords in the test case compiling specification, and the third-party keywords are other keywords except the first-level keywords and the second-level keywords which are registered by self according to different test services.
102. And analyzing the target test cases and sequentially arranging the target test cases in the operation list.
And analyzing the target test cases into an operation list, and sequentially arranging the target test cases according to the operation sequence. The operation list includes a plurality of operations and data inputs and/or data outputs that each operation specifically needs to be performed.
103. And when the target test case is legal, carrying out automatic test among single-process multi-modules according to the operation list.
And after the target test case is obtained, carrying out legality detection on the target test case, and if the target test case passes the legality detection, carrying out automatic testing among the multiple modules of the process to be tested according to the operation list to which the target test case is analyzed.
Specifically, the validity test checks whether the grammar of the target test case is qualified or not, or whether unregistered keywords exist, and the validity test can be passed only when the grammar is qualified and the unregistered keywords do not exist. In practical applications, the validity test may be performed by other conditions, and is not limited herein.
104. And when the preset conditions are met, ending the test and outputting the result.
If the preset condition for finishing the test is that all the operations in the operation list are finished, outputting a result according to the indication in the operation list after all the operations in the operation list are finished. In practical applications, the preset condition for ending the test may be that a certain operation fails to be executed, or that the test case fails to pass the validity detection, which is not limited herein.
In the embodiment of the application, the multiple modules of the single process can be automatically tested through the target test case containing the test case among the multiple modules of the single process, a tester does not need to manually trigger the multiple modules of the single process, and the efficiency of automatic testing is improved to a certain extent.
Referring to fig. 2 on the basis of steps 101 to 104, in an embodiment, the automated testing method according to the embodiment of the present application is implemented by:
firstly, selecting and obtaining a proper test case according to a service to be tested. And then, initializing the test case analyzer to analyze the acquired test cases. Then, the test case is traversed to inquire whether the third party keywords which are not registered exist, if the third party keywords which are not registered exist, the legality judgment can be carried out, and whether the grammar and the keywords of the test case are legal or not can be judged. If the grammar and the keywords are legal, executing all operations according to the sequence of the operation list; and if the grammar or the keywords are illegal, returning to the step of obtaining the test case again for obtaining. In practical applications, each time an operation is executed, whether the operation is executed successfully is determined. And if the execution is successful, sequentially executing the next operation, and if the execution is unsuccessful, outputting a corresponding test result and finishing the test, wherein the output corresponding test result comprises failed operation data and a failure reason. After all operations are executed in sequence, whether all operations are executed is judged, if not, the steps of executing all operations according to the sequence of the operation list before returning are required to be tested again; and if the test is finished, outputting a corresponding test result and finishing the test.
In some embodiments, the obtained test cases are written according to the writing specification in Table 1 shown.
Figure BDA0003449158230000031
Figure BDA0003449158230000041
TABLE 1
The first-level keywords and the second-level keywords are preset in the automatic testing device, and the operation keywords, namely the third-party keywords, are keywords registered by an operator according to the service requirements of different testing services. It is to be understood that there may be other primary keywords, secondary keywords, or operation keywords in practical applications, and the present invention is not limited thereto.
In a specific embodiment, the obtained target test case may be the test case shown in fig. 3. The test case shown in fig. 3 is an automated test case written according to the test case specification of table 1 above based on the JSON data format. The test case takes a JSON array as a basic format, and each element of the JSON array is a JSON object. Each JSON object describes an operation, and an operation includes a primary key and may also include data such as a secondary key and an operation key, which is not limited herein.
In addition, in conjunction with the test case shown in fig. 3, in some embodiments, the parsed target test case may have an operation list as shown in fig. 4. The operation list is all the operations in the target test cases which are sequentially ordered from top to bottom.
In a specific embodiment, operation 1 (call interface) may use call, i.e., call interface, to set parameters and return values, and when async is 1 or true, it represents an asynchronous call, and the asynchronous call supports a delay parameter.
Operation 2 (data piling) can use callback to set callback interface data (baffle), can judge expected data, can return data, and can also set timeout time, and when the timeout time is less than or equal to 0, it means that the operation does not need waiting, and when async is 1 or true, it means asynchronous callback, and asynchronous supports delay parameter.
Operation 3 (loop operation) may use a loop to execute a loop that supports all primary keys internally and the loop may be nested, while when async is 1 or true, it represents an asynchronous loop that does not support the delay parameter itself, but asynchronous operations within the loop may support.
In built-in operation, the exitloop may traverse and exit the loop in which all loop operations in this case are name, output content through print, and sleep for a period of time through sleep. The time may be in units of milliseconds or seconds, and is not limited herein.
It should be noted that, in practical applications, besides the call interface, the data piling, the loop operation, the built-in operation, and the like shown in fig. 4, there may be other operations to implement the automated testing between the single-process multi-module, and the invention is not limited herein.
In the embodiment of the application, the writing specification of the test case, the specific form of the test case and the operation list with the JSON array as the basic format are provided, and the realizability is improved.
Referring to fig. 5, an embodiment of the present application provides an automatic testing apparatus, including:
an obtaining unit 501, configured to obtain a target test case, where the target test case includes a test case between single-process multiple modules;
an analyzing unit 502, configured to analyze the target test cases and sequentially arrange the target test cases in an operation list;
the testing unit 503 is configured to perform an automated test among the single-process multi-modules according to the operation list when the target test case is legal;
and the output unit 504 is configured to end the test and output a result when a preset condition is met.
Optionally, the automatic testing apparatus further includes:
and the registration unit is used for registering the third party keyword if the target test case contains the third party keyword.
Optionally, the testing unit 503 is further configured to, when the target test case is illegal, return to the step of obtaining the target test case.
Optionally, the output unit 504 is configured to end the test and output a result when any operation fails to be executed.
In the embodiment of the application, the target test case containing the test case between the single-process multi-module, which is acquired by the acquisition unit 501, can be used for automatically testing the multiple modules of the single-process through the test unit 503, so that a tester does not need to manually trigger the target test case multiple times, and the efficiency of automatic testing is improved to a certain extent.
Fig. 6 is a schematic structural diagram of an automatic test apparatus 600 according to an embodiment of the present disclosure, where the automatic test apparatus 600 may include one or more Central Processing Units (CPUs) 601 and a memory 605, and the memory 605 stores one or more application programs or data therein.
The memory 605 may be volatile storage or persistent storage, among other things. The program stored in the memory 605 may include one or more modules, each of which may include a sequence of instructions operating on an automated test equipment. Further, the central processor 601 may be configured to communicate with the memory 605 to execute a series of instruction operations in the memory 605 on the automated test equipment 600.
The automated test equipment 600 may also include one or more power supplies 602, one or more wired or wireless network interfaces 603, one or more input-output interfaces 604, and/or one or more operating systems, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The central processing unit 601 may perform the operations performed by the automatic testing apparatus in the embodiments shown in fig. 1 to fig. 4, and details thereof are not repeated herein.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like.

Claims (10)

1. An automated testing method, comprising:
acquiring a target test case, wherein the target test case comprises a test case among single-process multi-modules;
analyzing the target test cases and sequentially arranging the target test cases in an operation list;
when the target test case is legal, carrying out automatic test among the single-process multi-modules according to the operation list;
and when the preset conditions are met, ending the test and outputting the result.
2. The automated testing method according to claim 1, wherein before performing the automated testing between the single-process multi-module according to the operation list when the target test case is legal, the method further comprises:
and if the target test case contains third party keywords, registering the third party keywords.
3. The automated testing method of claim 1, wherein before ending the test and outputting the result when the preset condition is met, the method further comprises:
and when the target test case is illegal, returning to execute the step of obtaining the target test case.
4. The automated testing method of claim 1, wherein the ending of the test and outputting the result when the preset condition is met comprises:
and when any operation fails to be executed, ending the test and outputting a result.
5. An automated testing apparatus, comprising:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target test case, and the target test case comprises a test case among single-process multi-modules;
the analysis unit is used for analyzing the target test cases and sequentially arranging the target test cases in an operation list;
the test unit is used for carrying out the automatic test among the single-process multi-modules according to the operation list when the target test case is legal;
and the output unit is used for finishing the test and outputting the result when the preset condition is met.
6. The automated testing apparatus of claim 5, further comprising:
and the registration unit is used for registering the third party keyword if the target test case contains the third party keyword.
7. The automated testing device of claim 5, wherein the testing unit is further configured to return to performing the step of obtaining the target test case when the target test case is illegal.
8. The automated testing device of claim 5, wherein the output unit is configured to end the test and output the result when any one of the operations fails to be performed.
9. An automated testing apparatus, comprising:
the system comprises a central processing unit, a memory and an input/output interface;
the memory is a transient memory or a persistent memory;
the central processor is configured to communicate with the memory and execute the instructions in the memory to perform the method of any of claims 1-4.
10. A computer storage medium having stored therein instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 4.
CN202111669291.XA 2021-12-30 2021-12-30 Automatic testing method and related equipment Pending CN114297081A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111669291.XA CN114297081A (en) 2021-12-30 2021-12-30 Automatic testing method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111669291.XA CN114297081A (en) 2021-12-30 2021-12-30 Automatic testing method and related equipment

Publications (1)

Publication Number Publication Date
CN114297081A true CN114297081A (en) 2022-04-08

Family

ID=80974559

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111669291.XA Pending CN114297081A (en) 2021-12-30 2021-12-30 Automatic testing method and related equipment

Country Status (1)

Country Link
CN (1) CN114297081A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567201A (en) * 2011-12-15 2012-07-11 南京大学 Method for automatically recovering cross-model GUI (graphic user interface) test scripts
US20130097586A1 (en) * 2011-10-17 2013-04-18 International Business Machines Corporation System and Method For Automating Test Automation
CN110008111A (en) * 2019-01-31 2019-07-12 阿里巴巴集团控股有限公司 A kind of service test method and device
CN110399299A (en) * 2019-07-17 2019-11-01 深圳证券交易所 The execution method of automated test frame and test case
CN110532182A (en) * 2019-08-22 2019-12-03 锐捷网络股份有限公司 A kind of automated testing method and device of virtual platform
CN111176996A (en) * 2019-12-25 2020-05-19 平安普惠企业管理有限公司 Test case generation method and device, computer equipment and storage medium
CN113434387A (en) * 2021-06-01 2021-09-24 中国航空工业集团公司沈阳飞机设计研究所 Script-driven-based automatic testing tool and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130097586A1 (en) * 2011-10-17 2013-04-18 International Business Machines Corporation System and Method For Automating Test Automation
CN102567201A (en) * 2011-12-15 2012-07-11 南京大学 Method for automatically recovering cross-model GUI (graphic user interface) test scripts
CN110008111A (en) * 2019-01-31 2019-07-12 阿里巴巴集团控股有限公司 A kind of service test method and device
CN110399299A (en) * 2019-07-17 2019-11-01 深圳证券交易所 The execution method of automated test frame and test case
CN110532182A (en) * 2019-08-22 2019-12-03 锐捷网络股份有限公司 A kind of automated testing method and device of virtual platform
CN111176996A (en) * 2019-12-25 2020-05-19 平安普惠企业管理有限公司 Test case generation method and device, computer equipment and storage medium
CN113434387A (en) * 2021-06-01 2021-09-24 中国航空工业集团公司沈阳飞机设计研究所 Script-driven-based automatic testing tool and system

Similar Documents

Publication Publication Date Title
CN106294120B (en) Method, apparatus and computer program product for testing code
US8572437B2 (en) Multi-platform test automation enhancement
CN111475417A (en) Automatic testing method, device, equipment and storage medium
CN111897724A (en) Automatic testing method and device suitable for cloud platform
CN112732563A (en) Interface script test log extraction method and device, terminal and storage medium
CN110647471A (en) Interface test case generation method, electronic device and storage medium
CN111475390A (en) Log collection system deployment method, device, equipment and storage medium
CN111427784B (en) Data acquisition method, device, equipment and storage medium
CN113434396A (en) Interface test method, device, equipment, storage medium and program product
CN110750446A (en) System testing method and related device
CN112395182A (en) Automatic testing method, device, equipment and computer readable storage medium
CN117493188A (en) Interface testing method and device, electronic equipment and storage medium
CN116431522A (en) Automatic test method and system for low-code object storage gateway
CN112612706A (en) Automated testing method, computer device and storage medium
CN114297081A (en) Automatic testing method and related equipment
CN115576831A (en) Test case recommendation method, device, equipment and storage medium
CN115292159A (en) Test debugging method and system, corresponding computer equipment and storage medium
CN114238110A (en) Software application testing method, device, equipment and storage medium
CN110727601B (en) Multi-platform program testing method and related device
CN114003497A (en) Method, device and equipment for testing service system and storage medium
CN113868031A (en) Method, device and system for testing performance consistency of hard disk
CN108845932B (en) Unit testing method and device of network library, storage medium and terminal
CN113608996B (en) Mirror image compiling test method, system, device and readable storage medium
CN109656828B (en) Automatic testing method for pressure of virtual machine in cluster, terminal and readable storage medium
CN116909936B (en) Big data automatic test method, equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination