CN112631924A - Automatic testing method and device, computer equipment and storage medium - Google Patents

Automatic testing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112631924A
CN112631924A CN202011590737.5A CN202011590737A CN112631924A CN 112631924 A CN112631924 A CN 112631924A CN 202011590737 A CN202011590737 A CN 202011590737A CN 112631924 A CN112631924 A CN 112631924A
Authority
CN
China
Prior art keywords
test
test case
data
preset
preset data
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
CN202011590737.5A
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.)
Ping An Consumer Finance Co Ltd
Original Assignee
Ping An Consumer Finance 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 Ping An Consumer Finance Co Ltd filed Critical Ping An Consumer Finance Co Ltd
Priority to CN202011590737.5A priority Critical patent/CN112631924A/en
Publication of CN112631924A publication Critical patent/CN112631924A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The embodiment of the application belongs to the technical field of cloud, and relates to an automatic test method, which comprises the steps of obtaining a configuration file of a test case generation instruction when the test case generation instruction is received, and analyzing the configuration file to obtain preset data; obtaining subdata in the preset data, and transmitting the subdata to a target interface in a parameter form; calling the target interface to generate a test case corresponding to the preset data, and storing the test case into a target database; and when a test instruction is received, acquiring a test case corresponding to the test instruction from the target database, and executing the test case. The application also provides an automatic testing device, computer equipment and a storage medium. In addition, the present application relates to blockchain techniques, where the test cases may be stored in a blockchain. The application improves the efficiency of automatic testing.

Description

Automatic testing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of cloud technologies, and in particular, to an automated testing method and apparatus, a computer device, and a storage medium.
Background
Automated testing, including interface automation, UI automation, big data automation, etc., has become a necessary trend to replace manual testing, which is also indispensable, of course, only the components need to be re-formulated.
Currently, automated test solutions implement test automation mainly by executing corresponding automation scripts. However, whether interface automation scripts or UI automation scripts; whether the scripts are written by codes or automatically recorded, the scripts are needed in many cases. For some interface automation, a single data for a single interface, this approach is sufficient. However, in the field with more complex data processing capacity, such as the financial field, when a complex multi-data single interface is faced, one data is compiled into one executable case, each data is manually needed to compile a corresponding executable test method, the compiling efficiency of the test case is low, and finally the overall automatic test efficiency is low.
Disclosure of Invention
An embodiment of the present application provides an automated testing method, an automated testing device, a computer device, and a storage medium, so as to solve the technical problem of low automated testing efficiency.
In order to solve the above technical problem, an embodiment of the present application provides an automated testing method, which adopts the following technical solutions:
when a test case generation instruction is received, acquiring a configuration file of the test case generation instruction, and analyzing the configuration file to obtain preset data;
obtaining subdata in the preset data, and transmitting the subdata to a target interface in a parameter form;
calling the target interface to generate a test case corresponding to the preset data, and storing the test case into a target database;
and when a test instruction is received, acquiring a test case corresponding to the test instruction from the target database, and executing the test case.
Further, the obtaining the subdata in the preset data and transmitting the subdata to the target interface in a parameter form includes:
and respectively converting the interface parameter data, the test case name and the expected value into corresponding parameter data, and transmitting the parameter data to the target interface.
Further, the invoking the target interface to generate the test case corresponding to the preset data includes:
creating an anonymous function, and calling the target interface according to the anonymous function;
and acquiring test parameters corresponding to the preset data according to the calling interface, and generating a test case of each preset data according to the test parameters.
Further, the generating a test case of each preset data according to the test parameters includes:
and acquiring a preset test class, and referring to the test parameters according to the preset test class to generate a test case of each preset datum.
Further, the generating a test case of each preset datum according to the preset test class by referring to the test parameter includes:
when a plurality of preset data are obtained through analysis, acquiring the data volume of the preset data;
and circularly generating the test cases with the data quantity and the test parameters quoted by the preset test classes through a preset circular function.
Further, the executing the test case includes:
obtaining the test type of the test case, and determining the target service of the test case according to the test type;
and sending the test case to the target service, and executing the test case based on the target service.
Further, after the step of executing the test case, the method further includes:
and acquiring a test result, and generating a test report corresponding to the test case according to the test result.
In order to solve the above technical problem, an embodiment of the present application further provides an automatic testing apparatus, which adopts the following technical scheme:
the analysis module is used for acquiring a configuration file of the test case generation instruction when the test case generation instruction is received, and analyzing the configuration file to obtain preset data;
the transmission module is used for acquiring the subdata in the preset data and transmitting the subdata to a target interface in a parameter form;
the calling module is used for calling the target interface to generate a test case corresponding to the preset data and storing the test case into a target database;
and the test module is used for acquiring the test case corresponding to the test instruction from the target database and executing the test case when the test instruction is received.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which includes a memory and a processor, and computer readable instructions stored in the memory and executable on the processor, where the processor implements the steps of the above automated testing method when executing the computer readable instructions.
In order to solve the above technical problem, an embodiment of the present application further provides a computer-readable storage medium, where computer-readable instructions are stored, and when executed by a processor, the computer-readable instructions implement the steps of the above automated testing method.
According to the automatic test method, when a test case generation instruction is received, a configuration file of the test case generation instruction is obtained, the configuration file is analyzed to obtain preset data, and a corresponding test case can be generated according to the preset data; then, obtaining subdata in the preset data, transmitting the subdata to a target interface in a parameter form, and uniformly managing the preset data through the target interface, so that the standardized management of the preset data is further realized, and the generation efficiency of the test case is improved; then, calling a target interface to generate a test case corresponding to the preset data, and storing the test case into a target database, so that the automatic generation of the test case is realized; and finally, when the test instruction is received, the test case corresponding to the test instruction is obtained from the target database, and the test case is executed, so that the automatic generation of the test case is realized, the time length of the automatic test is reduced, and the efficiency of the automatic test is further improved.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of an automated testing method according to the present application;
FIG. 3 is a schematic block diagram of one embodiment of an automated test equipment according to the present application;
FIG. 4 is a schematic block diagram of one embodiment of a computer device according to the present application.
Reference numerals: the automated testing device 300, a parsing module 301, a passing module 302, a calling module 303, and a testing module 304.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that the automated testing method provided in the embodiments of the present application is generally executed by a server/terminal device, and accordingly, the automated testing apparatus is generally disposed in the server/terminal device.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow diagram of one embodiment of a method of automated testing is shown, in accordance with the present application. The automatic testing method comprises the following steps:
step S201, when a test case generation instruction is received, acquiring a configuration file of the test case generation instruction, and analyzing the configuration file to obtain preset data;
in this embodiment, when a test case generation instruction is received, a configuration file corresponding to the test case generation instruction is acquired. Specifically, when a test case generation instruction is received, the test case generation instruction is analyzed to obtain a corresponding configuration file, wherein a plurality of preset data are configured in the configuration file, and a function or an interface and the like can be tested according to the preset data. When the configuration file is obtained, the preset data can be obtained by analyzing the configuration file. For example, for the configuration file of yaml, the preset data in the configuration file can be obtained by parsing the configuration file through a preset getyaml function.
Step S202, obtaining subdata in the preset data, and transmitting the subdata to a target interface in a parameter form;
in this embodiment, the preset data is composed of a plurality of subdata, and when the preset data is obtained, the preset data is analyzed to obtain the subdata. The subdata of each preset datum comprises interface parameter data, test case names and expected values. When the subdata is obtained, the interface parameter data, the test case name and the expected value are respectively transmitted to the target interface in the form of parameters.
Step S203, calling the target interface to generate a test case corresponding to the preset data, and storing the test case into a target database;
in this embodiment, when the target interface is obtained, the target interface is called, and a test case corresponding to the preset data is generated. The target interface is in a pre-packaged interface mode, each test parameter in the target interface can be obtained by calling the target interface, the test parameter is parameter data corresponding to preset data, and a test case corresponding to each preset data can be generated according to the test parameter. And when the test case is obtained, storing the test case into a target database.
It is emphasized that, to further ensure the privacy and security of the test cases, the test cases may also be stored in a node of a block chain.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Step S204, when receiving the test instruction, obtaining the test case corresponding to the test instruction from the target database, and executing the test case.
In this embodiment, when the test instruction is received, the test case corresponding to the test instruction is obtained from the target database, and the test case is executed. Specifically, when a test instruction is received, the test instruction is analyzed, and a test case required to be obtained from the target database is determined according to the test instruction. And when the test case corresponding to the test instruction is obtained, sending the test case to a corresponding target service, and executing the corresponding test case according to the target service to complete the current test task.
According to the embodiment, the automatic generation of the test case is realized, the time length of the automatic test is reduced, and the efficiency of the automatic test is further improved.
In some embodiments of the present application, the obtaining of the sub-data in the preset data and transmitting the sub-data to the target interface in the form of a parameter includes:
and respectively converting the interface parameter data, the test case name and the expected value into corresponding parameter data, and transmitting the parameter data to the target interface.
In this embodiment, the interface access parameter data is a specific content representation of preset data, such as a name and an account of a user; the name of the test case is the name of the test case corresponding to the current preset data, and one preset data corresponds to one test case; the expected value is an expected result value of the test case corresponding to the current preset data, and if the expected value is receiving or rejecting, the expected value is the expected result value. And when the interface parameter data, the test case name and the expected value are obtained, converting the interface parameter data, the test case name and the expected value into corresponding parameter data respectively, and transmitting the parameter data to a target interface.
In the embodiment, the sub-data in the preset data is transmitted to the target interface in a parameter form, so that the preset data is packaged, and when the test case corresponding to the preset data is generated, the test case can be automatically generated through the target interface, so that the generation time of the test case is saved, and the generation efficiency of the test case is further improved.
In some embodiments of the present application, the invoking the target interface to generate the test case corresponding to the preset data specifically includes:
creating an anonymous function, and calling the target interface according to the anonymous function;
and acquiring test parameters corresponding to the preset data according to the calling interface, and generating a test case of each preset data according to the test parameters.
In this embodiment, an anonymous function is created, the target interface can be called through the anonymous function, and when the calling interface is obtained, the test parameters corresponding to the preset data are obtained according to the calling interface. The test parameter is the parameter data after the conversion of the subdata parameter in the preset data. And obtaining a test case corresponding to each preset data according to the test parameters.
According to the embodiment, the target interface is called through the anonymous function, so that the test case of the preset data can be automatically generated through the target interface, and the generation efficiency of the test case is further improved.
In some embodiments of the application, the generating of the test case of each preset data according to the test parameter specifically includes:
and acquiring a preset test class, and referring to the test parameters according to the preset test class to generate a test case of each preset datum.
In this embodiment, the preset test class is a preset custom test class, and the test parameters in the target interface can be referred through the preset test class, so as to obtain a test case corresponding to each preset data. Therefore, when the test case corresponding to each preset data is generated according to the test parameters, the preset test class is obtained, and the test parameters are quoted according to the preset test class, so that the test case of each preset data is generated.
According to the embodiment, the test parameters are quoted through the preset test class, so that the automatic generation of the test case is realized, and the generation efficiency of the test case and the test efficiency of the test case are further improved.
In some embodiments of the application, the generating a test case of each preset data according to the test parameter referred by the preset test class specifically includes:
when a plurality of preset data are obtained through analysis, acquiring the data volume of the preset data;
and circularly generating the test cases with the data quantity and the test parameters quoted by the preset test classes through a preset circular function.
In this embodiment, a plurality of preset data may exist in one configuration file, and when the configuration file is analyzed to obtain the plurality of preset data, the data amount of the preset data in the configuration file is obtained. And when the test case corresponding to the preset data is generated, circularly generating the test cases with the data quantity and the test parameters quoted by the preset test class through a preset circular function (such as a for function).
According to the embodiment, the test cases are generated in batch through the preset circulation function, the generation efficiency of the test cases is improved, the generation time of a large number of test cases is saved, and the test efficiency during testing according to the test cases is further improved.
In some embodiments of the present application, the executing the test case specifically includes:
obtaining the test type of the test case, and determining the target service of the test case according to the test type;
and sending the test case to the target service, and executing the test case based on the target service.
In this embodiment, different test cases may correspond to different test types, where the test types include different types such as an interface test type and an application test type, and the different test types correspond to different target services. The test case can be tested according to the target service. Specifically, when a test case corresponding to the test instruction is obtained, the test type corresponding to each test case is obtained, the test cases are sent to corresponding target services according to the test types, and when the target services receive the corresponding test cases, the test cases are executed.
According to the embodiment, the test types of different test cases are obtained, and the corresponding target service is selected according to the test types, so that the automatic test of the test cases is realized, and the test efficiency of the test cases is improved.
In some embodiments of the present application, after the executing the test case, the method further includes:
and acquiring a test result, and generating a test report corresponding to the test case according to the test result.
In this embodiment, when it is detected that the target service test is completed, a test result is obtained, and a test report corresponding to each test case is generated according to the test result. The test report includes the number of execution pieces and execution results of the current test case, such as execution success or execution failure. The execution result is related to the actual test result and the expected value of the current test case, and when the test result of the test case is consistent with the expected value, the execution result indicates that the current test case is successfully executed; and when the test result of the test case is inconsistent with the expected value, indicating that the current test case fails to be executed. Furthermore, when the execution result is obtained, the associated test evaluation information can be obtained according to the execution result, and the test problems possibly existing in the execution process of the current test case can be evaluated and analyzed according to the test evaluation information.
According to the embodiment, the test report is generated through the test result, so that the execution condition of the current test case can be directly known through the test report, and the test accuracy of the test case is further improved.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware associated with computer readable instructions, which can be stored in a computer readable storage medium, and when executed, the processes of the embodiments of the methods described above can be included. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
With further reference to fig. 3, as an implementation of the method shown in fig. 2, the present application provides an embodiment of an automatic testing apparatus, which corresponds to the embodiment of the method shown in fig. 2, and which can be applied to various electronic devices.
As shown in fig. 3, the automated testing apparatus 300 according to the present embodiment includes: a parsing module 301, a passing module 302, a calling module 303, and a testing module 304. Wherein:
the analysis module 301 is configured to, when a test case generation instruction is received, obtain a configuration file of the test case generation instruction, and analyze the configuration file to obtain preset data;
in this embodiment, when a test case generation instruction is received, a configuration file corresponding to the test case generation instruction is acquired. Specifically, when a test case generation instruction is received, the test case generation instruction is analyzed to obtain a corresponding configuration file, wherein a plurality of preset data are configured in the configuration file, and a function or an interface and the like can be tested according to the preset data. When the configuration file is obtained, the preset data can be obtained by analyzing the configuration file. For example, for the configuration file of yaml, the preset data in the configuration file can be obtained by parsing the configuration file through a preset getyaml function.
A transmission module 302, configured to obtain sub-data in the preset data, and transmit the sub-data to a target interface in a parameter form;
in this embodiment, the preset data is composed of a plurality of subdata, and when the preset data is obtained, the preset data is analyzed to obtain the subdata. The subdata of each preset datum comprises interface parameter data, test case names and expected values. When the subdata is obtained, the interface parameter data, the test case name and the expected value are respectively transmitted to the target interface in the form of parameters.
Wherein, the transferring module 302 comprises:
and the conversion unit is used for respectively converting the interface parameter data, the test case name and the expected value into corresponding parameter data and transmitting the parameter data to the target interface.
In this embodiment, the interface access parameter data is a specific content representation of preset data, such as a name and an account of a user; the name of the test case is the name of the test case corresponding to the current preset data, and one preset data corresponds to one test case; the expected value is an expected result value of the test case corresponding to the current preset data, and if the expected value is receiving or rejecting, the expected value is the expected result value. And when the interface parameter data, the test case name and the expected value are obtained, converting the interface parameter data, the test case name and the expected value into corresponding parameter data respectively, and transmitting the parameter data to a target interface.
A calling module 303, configured to call the target interface to generate a test case corresponding to the preset data, and store the test case in a target database;
in this embodiment, when the target interface is obtained, the target interface is called, and a test case corresponding to the preset data is generated. The target interface is in a pre-packaged interface mode, each test parameter in the target interface can be obtained by calling the target interface, the test parameter is parameter data corresponding to preset data, and a test case corresponding to each preset data can be generated according to the test parameter. And when the test case is obtained, storing the test case into a target database.
It is emphasized that, to further ensure the privacy and security of the test cases, the test cases may also be stored in a node of a block chain.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Wherein, the calling module 303 includes:
the creating unit is used for creating an anonymous function and calling the target interface according to the anonymous function;
and the generating unit is used for acquiring the test parameters corresponding to the preset data according to the calling interface and generating the test case of each preset data according to the test parameters.
In this embodiment, an anonymous function is created, the target interface can be called through the anonymous function, and when the calling interface is obtained, the test parameters corresponding to the preset data are obtained according to the calling interface. The test parameter is the parameter data after the conversion of the subdata parameter in the preset data. And obtaining a test case corresponding to each preset data according to the test parameters.
Wherein the generating unit includes:
and the first generation subunit is used for acquiring a preset test class and referring to the test parameters according to the preset test class to generate a test case of each preset datum.
In this embodiment, the preset test class is a preset custom test class, and the test parameters in the target interface can be referred through the preset test class, so as to obtain a test case corresponding to each preset data. Therefore, when the test case corresponding to each preset data is generated according to the test parameters, the preset test class is obtained, and the test parameters are quoted according to the preset test class, so that the test case of each preset data is generated.
Wherein the first generating subunit includes:
the acquisition subunit is configured to acquire a data amount of the preset data when the preset data are obtained through analysis;
and the second generating subunit is used for circularly generating the test cases with the data quantity and the test parameters quoted by the preset test classes through a preset circular function.
In this embodiment, a plurality of preset data may exist in one configuration file, and when the configuration file is analyzed to obtain the plurality of preset data, the data amount of the preset data in the configuration file is obtained. And when the test case corresponding to the preset data is generated, circularly generating the test cases with the data quantity and the test parameters quoted by the preset test class through a preset circular function (such as a for function).
The test module 304 is configured to, when a test instruction is received, obtain a test case corresponding to the test instruction from the target database, and execute the test case.
In this embodiment, when the test instruction is received, the test case corresponding to the test instruction is obtained from the target database, and the test case is executed. Specifically, when a test instruction is received, the test instruction is analyzed, and a test case required to be obtained from the target database is determined according to the test instruction. And when the test case corresponding to the test instruction is obtained, sending the test case to a corresponding target service, and executing the corresponding test case according to the target service to complete the current test task.
Among them, the test module 304 includes:
the confirming unit is used for acquiring the test type of the test case and determining the target service of the test case according to the test type;
and the sending unit is used for sending the test case to the target service and executing the test case based on the target service.
In this embodiment, different test cases may correspond to different test types, where the test types include different types such as an interface test type and an application test type, and the different test types correspond to different target services. The test case can be tested according to the target service. Specifically, when a test case corresponding to the test instruction is obtained, the test type corresponding to each test case is obtained, the test cases are sent to corresponding target services according to the test types, and when the target services receive the corresponding test cases, the test cases are executed.
The automated testing device provided in this embodiment further includes:
and the acquisition module is used for acquiring the test result and generating a test report corresponding to the test case according to the test result.
In this embodiment, when it is detected that the target service test is completed, a test result is obtained, and a test report corresponding to each test case is generated according to the test result. The test report includes the number of execution pieces and execution results of the current test case, such as execution success or execution failure. The execution result is related to the actual test result and the expected value of the current test case, and when the test result of the test case is consistent with the expected value, the execution result indicates that the current test case is successfully executed; and when the test result of the test case is inconsistent with the expected value, indicating that the current test case fails to be executed. Furthermore, when the execution result is obtained, the associated test evaluation information can be obtained according to the execution result, and the test problems possibly existing in the execution process of the current test case can be evaluated and analyzed according to the test evaluation information.
The automatic testing device provided by the embodiment realizes automatic generation of the test case, reduces the time length of automatic testing, and further improves the efficiency of automatic testing.
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 4, fig. 4 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 6 comprises a memory 61, a processor 62, a network interface 63 communicatively connected to each other via a system bus. It is noted that only a computer device 6 having components 61-63 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 61 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 61 may be an internal storage unit of the computer device 6, such as a hard disk or a memory of the computer device 6. In other embodiments, the memory 61 may also be an external storage device of the computer device 6, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 6. Of course, the memory 61 may also comprise both an internal storage unit of the computer device 6 and an external storage device thereof. In this embodiment, the memory 61 is generally used for storing an operating system installed on the computer device 6 and various application software, such as computer readable instructions of an automated testing method. Further, the memory 61 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 62 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 62 is typically used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is configured to execute computer readable instructions stored in the memory 61 or process data, such as computer readable instructions for executing the automated testing method.
The network interface 63 may comprise a wireless network interface or a wired network interface, and the network interface 63 is typically used for establishing a communication connection between the computer device 6 and other electronic devices.
The computer equipment provided by the embodiment realizes automatic generation of the test case, reduces the time length of automatic test, and further improves the efficiency of automatic test.
The present application further provides another embodiment, which is a computer-readable storage medium storing computer-readable instructions executable by at least one processor to cause the at least one processor to perform the steps of the automated testing method as described above.
The computer-readable storage medium provided by the embodiment realizes automatic generation of the test case, reduces the time length of the automatic test, and further improves the efficiency of the automatic test.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. An automated testing method, comprising the steps of:
when a test case generation instruction is received, acquiring a configuration file of the test case generation instruction, and analyzing the configuration file to obtain preset data;
obtaining subdata in the preset data, and transmitting the subdata to a target interface in a parameter form;
calling the target interface to generate a test case corresponding to the preset data, and storing the test case into a target database;
and when a test instruction is received, acquiring a test case corresponding to the test instruction from the target database, and executing the test case.
2. The automated testing method of claim 1, wherein the sub-data comprises interface parameter data, a test case name and an expected value, and the obtaining the sub-data in the preset data and transmitting the sub-data to a target interface in a parameter form comprises:
and respectively converting the interface parameter data, the test case name and the expected value into corresponding parameter data, and transmitting the parameter data to the target interface.
3. The automated testing method of claim 1, wherein the invoking the target interface to generate the test case corresponding to the preset data comprises:
creating an anonymous function, and calling the target interface according to the anonymous function;
and acquiring test parameters corresponding to the preset data according to the calling interface, and generating a test case of each preset data according to the test parameters.
4. The automated testing method of claim 3, wherein the generating a test case for each of the predetermined data according to the test parameters comprises:
and acquiring a preset test class, and referring to the test parameters according to the preset test class to generate a test case of each preset datum.
5. The automated testing method of claim 4, wherein the generating a test case for each of the predetermined data according to the predetermined test class by referring to the test parameters comprises:
when a plurality of preset data are obtained through analysis, acquiring the data volume of the preset data;
and circularly generating the test cases with the data quantity and the test parameters quoted by the preset test classes through a preset circular function.
6. The automated testing method of claim 1, wherein said executing the test case comprises:
obtaining the test type of the test case, and determining the target service of the test case according to the test type;
and sending the test case to the target service, and executing the test case based on the target service.
7. The automated testing method of claim 1, further comprising, after the step of executing the test case:
and acquiring a test result, and generating a test report corresponding to the test case according to the test result.
8. An automated testing apparatus, comprising:
the analysis module is used for acquiring a configuration file of the test case generation instruction when the test case generation instruction is received, and analyzing the configuration file to obtain preset data;
the transmission module is used for acquiring the subdata in the preset data and transmitting the subdata to a target interface in a parameter form;
the calling module is used for calling the target interface to generate a test case corresponding to the preset data and storing the test case into a target database;
and the test module is used for acquiring the test case corresponding to the test instruction from the target database and executing the test case when the test instruction is received.
9. A computer device comprising a memory having computer readable instructions stored therein and a processor that when executed implements the steps of the automated testing method of any of claims 1-7.
10. A computer-readable storage medium having computer-readable instructions stored thereon which, when executed by a processor, implement the steps of the automated testing method of any of claims 1-7.
CN202011590737.5A 2020-12-29 2020-12-29 Automatic testing method and device, computer equipment and storage medium Pending CN112631924A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011590737.5A CN112631924A (en) 2020-12-29 2020-12-29 Automatic testing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011590737.5A CN112631924A (en) 2020-12-29 2020-12-29 Automatic testing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112631924A true CN112631924A (en) 2021-04-09

Family

ID=75285927

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011590737.5A Pending CN112631924A (en) 2020-12-29 2020-12-29 Automatic testing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112631924A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114328214A (en) * 2021-12-27 2022-04-12 深圳市六度人和科技有限公司 Method and device for improving efficiency of interface test case of report software and computer equipment
CN114553490A (en) * 2022-01-25 2022-05-27 浙江木链物联网科技有限公司 Industrial passive fuzz testing method and system and readable storage medium
CN114595106A (en) * 2022-05-10 2022-06-07 景网技术有限公司 Service control equipment debugging method and device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114328214A (en) * 2021-12-27 2022-04-12 深圳市六度人和科技有限公司 Method and device for improving efficiency of interface test case of report software and computer equipment
CN114328214B (en) * 2021-12-27 2023-05-12 深圳市六度人和科技有限公司 Efficiency improving method and device for interface test case of reporting software and computer equipment
CN114553490A (en) * 2022-01-25 2022-05-27 浙江木链物联网科技有限公司 Industrial passive fuzz testing method and system and readable storage medium
CN114553490B (en) * 2022-01-25 2024-02-09 浙江木链物联网科技有限公司 Industrial passive fuzzy test method, system and readable storage medium
CN114595106A (en) * 2022-05-10 2022-06-07 景网技术有限公司 Service control equipment debugging method and device

Similar Documents

Publication Publication Date Title
CN112631924A (en) Automatic testing method and device, computer equipment and storage medium
CN112631911A (en) Automatic testing method and device, computer equipment and storage medium
CN112052111A (en) Processing method, device and equipment for server abnormity early warning and storage medium
CN110659206A (en) Simulation architecture establishing method, device, medium and electronic equipment based on microservice
CN112597020A (en) Interface testing method and device, computer equipment and storage medium
CN112394908A (en) Method and device for automatically generating embedded point page, computer equipment and storage medium
CN114564294A (en) Intelligent service arranging method and device, computer equipment and storage medium
CN113536185A (en) Application page loading method, storage medium and related equipment thereof
CN111813418A (en) Distributed link tracking method, device, computer equipment and storage medium
CN113434254B (en) Client deployment method, client deployment apparatus, computer device, and storage medium
CN112860662A (en) Data blood relationship establishing method and device, computer equipment and storage medium
CN111475468A (en) Log access method, device, equipment and storage medium of newly added system
CN114968822A (en) Interface testing method and device, computer equipment and storage medium
CN114615325A (en) Message pushing method and device, computer equipment and storage medium
CN115328764A (en) Test code optimization method based on automatic test and related equipment thereof
CN115712422A (en) Form page generation method and device, computer equipment and storage medium
CN114637672A (en) Automatic data testing method and device, computer equipment and storage medium
CN110554892A (en) Information acquisition method and device
CN114143308A (en) File uploading information processing method and device, computer equipment and storage medium
CN114912003A (en) Document searching method and device, computer equipment and storage medium
CN114625372A (en) Automatic component compiling method and device, computer equipment and storage medium
CN111666328A (en) Method and device for displaying visual chart in real time, computer equipment and storage medium
CN112632192A (en) Node maintenance method and device, computer equipment and medium
CN110765610A (en) PDM (product data management) integration method and device, computer equipment and storage medium
CN113806372B (en) New data information construction method, device, computer equipment and 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