CN110750409A - Method, device and system for realizing test - Google Patents
Method, device and system for realizing test Download PDFInfo
- Publication number
- CN110750409A CN110750409A CN201810811988.8A CN201810811988A CN110750409A CN 110750409 A CN110750409 A CN 110750409A CN 201810811988 A CN201810811988 A CN 201810811988A CN 110750409 A CN110750409 A CN 110750409A
- Authority
- CN
- China
- Prior art keywords
- test
- log
- request
- data
- task
- 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
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 521
- 238000000034 method Methods 0.000 title claims abstract description 83
- 238000012795 verification Methods 0.000 claims abstract description 32
- 238000004891 communication Methods 0.000 claims description 12
- 238000010998 test method Methods 0.000 claims description 12
- 230000000875 corresponding effect Effects 0.000 description 76
- 238000013515 script Methods 0.000 description 12
- 238000010586 diagram Methods 0.000 description 10
- XSQUKJJJFZCRTK-NJFSPNSNSA-N UREA C 14 Chemical compound N[14C](N)=O XSQUKJJJFZCRTK-NJFSPNSNSA-N 0.000 description 8
- 238000004458 analytical method Methods 0.000 description 6
- 238000004590 computer program Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 5
- 238000007726 management method Methods 0.000 description 5
- 238000013524 data verification Methods 0.000 description 3
- 238000010276 construction Methods 0.000 description 2
- 230000002596 correlated effect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000013522 software testing Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3065—Monitoring arrangements determined by the means or processing involved in reporting the monitored data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a method, a device and a system for realizing a test. The method comprises the following steps: acquiring test data corresponding to a test task, and constructing a test request according to the test data; sending the test request to a test server so that the test server completes the test task according to the test request, and sending the generated test log corresponding to the test task to a log search engine; obtaining the test log from the log search engine; and verifying the test log according to a preset log verification rule. The log can be directly obtained from the log search engine and verified in one testing process, effective management and verification of the test log are achieved, and compared with the prior art, verification efficiency and accuracy are greatly improved.
Description
Technical Field
The invention relates to the field of software testing, in particular to a method, a device and a system for realizing testing.
Background
In advertisement and other businesses which pay attention to statistics, the correctness of an interface and a server log is usually concerned, and for the interface, a mature automatic scheme is provided, but for the verification of the log, most of the current test schemes read the server log by manually or automatically executing a shell command and verify a desired result, which is tedious.
Disclosure of Invention
In view of the above, the present invention has been developed to provide a method, apparatus and system for implementing a test that overcomes, or at least partially solves, the above-mentioned problems.
According to an aspect of the present invention, there is provided a method for implementing a test, including:
acquiring test data corresponding to a test task, and constructing a test request according to the test data;
sending the test request to a test server so that the test server completes the test task according to the test request, and sending the generated test log corresponding to the test task to a log search engine;
obtaining the test log from the log search engine;
and verifying the test log according to a preset log verification rule.
Optionally, the obtaining test data corresponding to the test task, and the constructing a test request according to the test data includes:
acquiring a test configuration file corresponding to the test task, wherein test data corresponding to one or more test processes are stored in the test configuration file;
and traversing the test configuration file, and sequentially reading test data corresponding to a test process from the test configuration file.
Optionally, a test process is started when a piece of test data is read, and the corresponding test process is ended when the corresponding test log is obtained.
Optionally, the constructing a test request according to the test data includes:
and writing each parameter in the test data into a corresponding field of a protobuf request template according to the parameter type, and further generating a test request in a protobuf format.
Optionally, the obtaining the test log from the log search engine includes:
and calling an interface of the log search engine to acquire log data under the specified field in the test log.
Optionally, the method further comprises:
receiving return data of the test task sent by the test server;
and verifying the returned data according to a preset returned data verification rule.
Optionally, the returning data is data in a protobuf format, and the verifying the returning data according to a preset verification rule includes:
and converting the returned data into a JSON format and then verifying.
Optionally, the method is implemented based on a test script under a pytest test framework.
According to another aspect of the present invention, there is provided an apparatus for implementing a test, including:
the test request constructing unit is suitable for acquiring test data corresponding to the test task and constructing a test request according to the test data;
the communication unit is suitable for sending the test request to a test server so that the test server can complete the test task according to the test request and send the generated test log corresponding to the test task to a log search engine; and adapted to retrieve the test log from the log search engine;
and the checking unit is suitable for checking the test log according to a preset log checking rule.
Optionally, the test request constructing unit is adapted to obtain a test configuration file corresponding to the test task, where test data corresponding to one or more test procedures are stored in the test configuration file; and traversing the test configuration file, and sequentially reading test data corresponding to a test process from the test configuration file.
Optionally, a test process is started when a piece of test data is read, and the corresponding test process is ended when the corresponding test log is obtained.
Optionally, the test request constructing unit is adapted to write each parameter in the test data into a corresponding field of a protobuf request template according to a parameter type, and further generate a test request in a protobuf format.
Optionally, the communication unit is adapted to call an interface of the log search engine to obtain log data in a specified field in the test log.
Optionally, the communication unit is further adapted to receive return data of the test task sent by the test server;
the checking unit is also suitable for checking the returned data according to a preset returned data checking rule.
Optionally, the return data is data in a protobuf format;
and the verification unit is suitable for converting the returned data into a JSON format and then verifying the converted returned data.
Optionally, the apparatus is implemented based on a test script under a pytest test framework.
According to another aspect of the present invention, there is provided a system for implementing a test, including: the system comprises a test server, a log search engine and a device for realizing the test according to any one of the above items;
the test implementation device is suitable for sending a test request to the test server;
the test server is suitable for completing the test task according to the test request and sending the generated test log corresponding to the test task to a log search engine;
the device for implementing the test is also suitable for acquiring the test log from the log search engine.
Optionally, the test server is further adapted to send the return data of the test task to the implementation apparatus of the test.
According to still another aspect of the present invention, there is provided an electronic apparatus including: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform a method as any one of the above.
According to a further aspect of the invention, there is provided a computer readable storage medium, wherein the computer readable storage medium stores one or more programs which, when executed by a processor, implement a method as any one of the above.
According to the technical scheme, the test data corresponding to the test task are obtained, the test request is constructed according to the test data, the test request is sent to the test server, so that the test server completes the test task according to the test request, the generated test log corresponding to the test task is sent to the log search engine, the test log is obtained from the log search engine, and the test log is verified according to the preset log verification rule.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 shows a flow diagram of a method of implementing a test according to one embodiment of the invention;
FIG. 2 shows a schematic diagram of an apparatus for performing a test according to an embodiment of the invention;
FIG. 3 shows a schematic diagram of a test implementation system according to an embodiment of the invention;
FIG. 4 shows a schematic structural diagram of an electronic device according to one embodiment of the invention;
fig. 5 shows a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 shows a flow diagram of a method for implementing a test according to an embodiment of the invention. As shown in fig. 1, the method includes:
step S110, obtaining test data corresponding to the test task, and constructing a test request according to the test data.
The test request can be similar to the test request in the prior art and needs to be sent to the test server in the test environment, and it can be seen that the log test and the test in the prior art can be effectively and reasonably combined just without much improvement on the test request, so that the workload is greatly saved.
Step S120, sending the test request to the test server, so that the test server completes the test task according to the test request, and sending the generated test log corresponding to the test task to the log search engine.
Specifically, the method is realized through an ELK technology stack, namely, a log collection tool Logstash is deployed at a test server, an Elasticissearch log search engine is deployed at another server, and the Logstash and the Elasticissearch log search engine are correlated, so that the test log generated by the test server can be collected to the log search engine in real time, and the effective management of the test log is realized. Another component of ELK, Kibana, may provide a friendly log analysis Web interface for Logstash and ElasticSearch, which may help summarize, analyze, and search test logs.
Step S130, a test log is obtained from the log search engine.
Step S140, verifying the test log according to a preset log verification rule.
It can be seen that, in the method shown in fig. 1, by obtaining test data corresponding to a test task, constructing a test request according to the test data, and sending the test request to a test server, so that the test server completes the test task according to the test request, and sends a generated test log corresponding to the test task to a log search engine, and obtains the test log from the log search engine, and verifies the test log according to a preset log verification rule, the log can be directly obtained from the log search engine and verified in a test process, so that effective management and verification of the test log are realized, and compared with the prior art, verification efficiency and accuracy are greatly improved.
In an embodiment of the present invention, in the method, acquiring test data corresponding to the test task, and constructing the test request according to the test data includes: acquiring a test configuration file corresponding to the test task, wherein test data corresponding to one or more test processes are stored in the test configuration file; and traversing the test configuration file, and sequentially reading test data corresponding to one test process from the test configuration file.
That is, multiple test data sets, each corresponding to a test procedure, may be stored in a test configuration file. In an embodiment of the present invention, in the method, a test process is started when a piece of test data is read, and the corresponding test process is ended when the corresponding test log is obtained.
For example, there are ten test data in the test configuration file, when the first test data is read, a corresponding test request is constructed and sent to the test server, and after the test log is obtained, when the second test data is read, a corresponding test request is constructed and sent to the test server … … until the test log corresponding to the tenth test log is obtained, that is, all the test processes are realized. Here, the completion of the test process does not represent log verification and ends at the same time.
In an embodiment of the present invention, the constructing the test request according to the test data in the method includes: and writing each parameter in the test data into a corresponding field of the protobuf request template according to the parameter type, and further generating a test request in a protobuf format.
In many service scenarios, network communication can be well realized by using the data in the protobuf format, which utilizes many advantages of protobuf, such as platform independence, language independence and extensibility; a friendly dynamic library is provided, and the use is simple; the analysis speed is high, and is about 20 to 100 times faster than that of the corresponding XML; the serialized data is very compact and compact, and compared with XML, the data size after serialization is about 1/3 to 1/10, and the like. The corresponding test needs therefore correspond to the actual traffic, so that the constructed test request is also a binary data stream in protobuf format. The specific construction method may refer to generation of protobuf data in the prior art, which is not described herein again, and only needs to pay attention to the fact that parameters in the test data reasonably correspond to the parameters.
In an embodiment of the present invention, the method, wherein obtaining the test log from the log search engine includes: and calling an interface of a log search engine to obtain log data under a specified field in the test log.
Taking the Elasticsearch as an example, the provided interface can perform full-text search and field analysis on the test log, so that log data under a specified field can be acquired. In fact, the log verification needs to determine whether record information corresponding to the test is recorded in the log according to the parameters in the test request, such as dotting record, and the like. Therefore, the function of verifying the correctness of the log in an interface mode is realized, and the efficiency of log verification is greatly improved.
In an embodiment of the present invention, the method further includes: receiving return data of the test task sent by the test server; and verifying the returned data according to a preset returned data verification rule.
For example, in the interface function test, if a test request is sent to the interface to be tested, the interface returns a return value, and the return data can be checked according to a preset assertion (alert). For example, if the expected interface returns a value of 3 and the actual interface returns a value of 5, then the interface may be problematic.
In an embodiment of the present invention, in the method, the returned data is data in a protobuf format, and verifying the returned data according to a preset verification rule includes: and converting the returned data into a JSON format and then checking.
Although the information such as key-value recorded in the Protobuf format can be directly verified, the overall efficiency is higher if the information is converted into the JSON format and then verified, so that although some embodiments may directly verify the data in the Protobuf format, in this embodiment, it is still limited that the returned data is first converted into the JSON format and then verified.
In one embodiment of the invention, the method is implemented based on a test script under a pytest test framework.
Pytest is a popular testing framework in which test scripts (also referred to herein as test cases, which is a broad meaning of test cases) can be written for testing. Therefore, the interface and the log can be tested in batch after the script is operated only by writing the script in advance by a tester.
Fig. 2 shows a schematic structural diagram of a device for implementing a test according to an embodiment of the present invention. As shown in fig. 2, the apparatus 200 for implementing the test includes:
the test request constructing unit 210 is adapted to obtain test data corresponding to the test task, and construct a test request according to the test data.
The test request can be similar to the test request in the prior art and needs to be sent to the test server in the test environment, and it can be seen that the log test and the test in the prior art can be effectively and reasonably combined just without much improvement on the test request, so that the workload is greatly saved.
The communication unit 220 is adapted to send the test request to the test server, so that the test server completes the test task according to the test request, and sends the generated test log corresponding to the test task to the log search engine; and adapted to obtain a test log from a log search engine;
specifically, the method is realized through an ELK technology stack, namely, a log collection tool Logstash is deployed at a test server, an Elasticissearch log search engine is deployed at another server, and the Logstash and the Elasticissearch log search engine are correlated, so that the test log generated by the test server can be collected to the log search engine in real time, and the effective management of the test log is realized. Another component of ELK, Kibana, may provide a friendly log analysis Web interface for Logstash and ElasticSearch, which may help summarize, analyze, and search test logs.
The verification unit 230 is adapted to verify the test log according to a preset log verification rule.
It can be seen that, in the apparatus shown in fig. 2, by obtaining test data corresponding to a test task, constructing a test request according to the test data, and sending the test request to the test server, the test server completes the test task according to the test request, and sends a generated test log corresponding to the test task to the log search engine, and obtains the test log from the log search engine, and verifies the test log according to a preset log verification rule, the log can be directly obtained from the log search engine and verified in a test process, so that effective management and verification of the test log are achieved, and compared with the prior art, verification efficiency and accuracy are greatly improved.
In an embodiment of the present invention, in the above apparatus, the test request constructing unit 210 is adapted to obtain a test configuration file corresponding to the test task, where the test configuration file stores test data corresponding to one or more test procedures, respectively; and traversing the test configuration file, and sequentially reading test data corresponding to one test process from the test configuration file.
That is, multiple test data sets, each corresponding to a test procedure, may be stored in a test configuration file. In an embodiment of the present invention, in the apparatus, a test process is started when a piece of test data is read, and the corresponding test process is ended when the corresponding test log is obtained.
For example, there are ten test data in the test configuration file, when the first test data is read, a corresponding test request is constructed and sent to the test server, and after the test log is obtained, when the second test data is read, a corresponding test request is constructed and sent to the test server … … until the test log corresponding to the tenth test log is obtained, that is, all the test processes are realized. Here, the completion of the test process does not represent log verification and ends at the same time.
In an embodiment of the present invention, in the apparatus, the test request constructing unit is adapted to write each parameter in the test data into a corresponding field of the protobuf request template according to a parameter type, and further generate a test request in a protobuf format.
In many service scenarios, network communication can be well realized by using the data in the protobuf format, which utilizes many advantages of protobuf, such as platform independence, language independence and extensibility; a friendly dynamic library is provided, and the use is simple; the analysis speed is high, and is about 20 to 100 times faster than that of the corresponding XML; the serialized data is very compact and compact, and compared with XML, the data size after serialization is about 1/3 to 1/10, and the like. The corresponding test needs therefore correspond to the actual traffic, so that the constructed test request is also a binary data stream in protobuf format. The specific construction method may refer to generation of protobuf data in the prior art, which is not described herein again, and only needs to pay attention to the fact that parameters in the test data reasonably correspond to the parameters.
In an embodiment of the present invention, in the apparatus, the communication unit is adapted to call an interface of a log search engine to obtain log data under a specified field in the test log.
Taking the Elasticsearch as an example, the provided interface can perform full-text search and field analysis on the test log, so that log data under a specified field can be acquired. In fact, the log verification needs to determine whether record information corresponding to the test is recorded in the log according to the parameters in the test request, such as dotting record, and the like. Therefore, the function of verifying the correctness of the log in an interface mode is realized, and the efficiency of log verification is greatly improved.
In an embodiment of the present invention, in the above apparatus, the communication unit is further adapted to receive return data of the test task sent by the test server; and the checking unit is also suitable for checking the returned data according to a preset returned data checking rule.
For example, in the interface function test, if a test request is sent to the interface to be tested, the interface returns a return value, and the return data can be checked according to a preset assertion (alert). For example, if the expected interface returns a value of 3 and the actual interface returns a value of 5, then the interface may be problematic.
In an embodiment of the present invention, in the apparatus, the returned data is data in a protobuf format; and the verification unit is suitable for converting the returned data into a JSON format and then verifying the converted returned data.
Although the information such as key-value recorded in the Protobuf format can be directly verified, the overall efficiency is higher if the information is converted into the JSON format and then verified, so that although some embodiments may directly verify the data in the Protobuf format, in this embodiment, it is still limited that the returned data is first converted into the JSON format and then verified.
In one embodiment of the invention, in the above device, the device is implemented based on a test script under a pytest test framework.
Pytest is a popular testing framework in which test scripts (also referred to herein as test cases, which is a broad meaning of test cases) can be written for testing. Therefore, the interface and the log can be tested in batch after the script is operated only by writing the script in advance by a tester.
Fig. 3 shows a schematic structural diagram of a test implementation system according to an embodiment of the present invention. As shown in fig. 3, the system 300 for implementing the test includes: a test server 310, a log search engine 320 and an apparatus 200 for implementing a test according to any of the above embodiments.
The implementing device 200 of the test is adapted to send a test request to the test server 310; the test server 310 is adapted to complete a test task according to the test request and send the generated test log corresponding to the test task to the log search engine 320.
The apparatus 200 for implementing a test is further adapted to obtain a test log from the log search engine 320.
In an embodiment of the present invention, in the system, the test server 310 is further adapted to send the return data of the test task to the implementing device of the test.
The log search engine 320 may be implemented based on an Elasticsearch, and a log collection tool logstack may be deployed on the test server 310, as described in the foregoing embodiment, and is not described herein again.
When the system is used, a client of the implementation apparatus 200 that includes a test constructs a test request, for example, a protobuf binary data stream is sent to the test server 310 in the test environment, the test server 310 generates return data and a test log, returns the return data to the client, and sends the test log to the log search engine 320 for storage. The client end calls the interface of the log search engine 320 to obtain the information of the desired field, and the returned data are respectively checked, so that one test is completed.
In summary, according to the technical scheme of the present invention, by obtaining test data corresponding to a test task, constructing a test request according to the test data, and sending the test request to a test server, so that the test server completes the test task according to the test request, and sends a generated test log corresponding to the test task to a log search engine, and obtains the test log from the log search engine, and verifies the test log according to a preset log verification rule, the log can be directly obtained from the log search engine and verified in a test process, thereby implementing effective management and verification of the test log, and greatly improving verification efficiency and accuracy compared with the prior art.
It should be noted that:
the algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose devices may be used with the teachings herein. The required structure for constructing such a device will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may 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) may be used in practice to implement some or all of the functions of some or all of the components in a test-enabling apparatus and system according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
For example, fig. 4 shows a schematic structural diagram of an electronic device according to an embodiment of the invention. The electronic device comprises a processor 410 and a memory 420 arranged to store computer executable instructions (computer readable program code). The memory 420 may 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 420 has a storage space 430 storing computer readable program code 431 for performing any of the method steps described above. For example, the storage space 430 for storing the computer readable program code may include respective computer readable program codes 431 for respectively implementing various steps in the above method. The computer readable program code 431 can be read from or written to one or more computer program products. These computer program products comprise a program code carrier such as a hard disk, a Compact Disc (CD), a memory card or a floppy disk. Such a computer program product is typically a computer readable storage medium such as described in fig. 5. Fig. 5 shows a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present invention. The computer readable storage medium 500 has stored thereon a computer readable program code 431 for performing the steps of the method according to the invention, which is readable by the processor 410 of the electronic device 400, the computer readable program code 431, when executed by the electronic device 400, causing the electronic device 400 to perform the steps of the method described above, in particular the computer readable program code 431 stored thereon, is capable of performing the method shown in any of the embodiments described above. The computer readable program code 431 may be compressed in a suitable form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
The embodiment of the invention discloses A1 and a test implementation method, which comprises the following steps:
acquiring test data corresponding to a test task, and constructing a test request according to the test data;
sending the test request to a test server so that the test server completes the test task according to the test request, and sending the generated test log corresponding to the test task to a log search engine;
obtaining the test log from the log search engine;
and verifying the test log according to a preset log verification rule.
A2, the method as in A1, wherein the obtaining test data corresponding to a test task, and the constructing a test request according to the test data comprises:
acquiring a test configuration file corresponding to the test task, wherein test data corresponding to one or more test processes are stored in the test configuration file;
and traversing the test configuration file, and sequentially reading test data corresponding to a test process from the test configuration file.
A3, the method according to a2, wherein a test procedure is started when a piece of test data is read, and the corresponding test procedure is ended when the corresponding test log is obtained.
A4, the method of A1, wherein the constructing a test request from the test data comprises:
and writing each parameter in the test data into a corresponding field of a protobuf request template according to the parameter type, and further generating a test request in a protobuf format.
A5, the method of A1, wherein the obtaining the test log from the log search engine comprises:
and calling an interface of the log search engine to acquire log data under the specified field in the test log.
A6, the method of a1, wherein the method further comprises:
receiving return data of the test task sent by the test server;
and verifying the returned data according to a preset returned data verification rule.
The method a7, as in a6, where the return data is in protobuf format, and the verifying the return data according to the preset verification rule includes:
and converting the returned data into a JSON format and then verifying.
A8, the method of any one of A1-A7, wherein the method is implemented based on a test script under the pytest test framework.
The embodiment of the invention also discloses B9 and a device for realizing the test, which comprises:
the test request constructing unit is suitable for acquiring test data corresponding to the test task and constructing a test request according to the test data;
the communication unit is suitable for sending the test request to a test server so that the test server can complete the test task according to the test request and send the generated test log corresponding to the test task to a log search engine; and adapted to retrieve the test log from the log search engine;
and the checking unit is suitable for checking the test log according to a preset log checking rule.
B10, the device of B9, wherein,
the test request constructing unit is suitable for acquiring a test configuration file corresponding to the test task, wherein test data corresponding to one or more test processes are stored in the test configuration file; and traversing the test configuration file, and sequentially reading test data corresponding to a test process from the test configuration file.
B11, the apparatus according to B10, wherein a test procedure is started when a piece of test data is read, and the corresponding test procedure is ended when the corresponding test log is obtained.
B12, the device of B9, wherein,
the test request constructing unit is suitable for writing each parameter in the test data into a corresponding field of a protobuf request template according to the parameter type, and further generating a test request in a protobuf format.
B13, the device of B9, wherein,
the communication unit is suitable for calling an interface of the log search engine to acquire the log data under the specified field in the test log.
B14, the device of B9, wherein,
the communication unit is also suitable for receiving the return data of the test task sent by the test server;
the checking unit is also suitable for checking the returned data according to a preset returned data checking rule.
B15, the device as B14, wherein the return data is data in protobuf format;
and the verification unit is suitable for converting the returned data into a JSON format and then verifying the converted returned data.
B16, the apparatus according to any one of B9-B15, wherein the apparatus is implemented based on a test script under a pytest test framework.
The embodiment of the invention also discloses C17, a test implementation system, which comprises: a test server, a log search engine and an implementation means of the test as described in any of B9-B16;
the test implementation device is suitable for sending a test request to the test server;
the test server is suitable for completing the test task according to the test request and sending the generated test log corresponding to the test task to a log search engine;
the device for implementing the test is also suitable for acquiring the test log from the log search engine.
C18, the system of C17, wherein,
the test server is also adapted to send the return data of the test task to the implementing device of the test.
The embodiment of the invention also discloses D19 and electronic equipment, wherein the electronic equipment comprises: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform the method of any one of a 1-A8.
Embodiments of the invention also disclose 20 a computer readable storage medium, wherein the computer readable storage medium stores one or more programs which, when executed by a processor, implement the method as any one of a 1-A8.
Claims (10)
1. A method for implementing a test comprises the following steps:
acquiring test data corresponding to a test task, and constructing a test request according to the test data;
sending the test request to a test server so that the test server completes the test task according to the test request, and sending the generated test log corresponding to the test task to a log search engine;
obtaining the test log from the log search engine;
and verifying the test log according to a preset log verification rule.
2. The method of claim 1, wherein the obtaining test data corresponding to a test task, and constructing a test request from the test data comprises:
acquiring a test configuration file corresponding to the test task, wherein test data corresponding to one or more test processes are stored in the test configuration file;
and traversing the test configuration file, and sequentially reading test data corresponding to a test process from the test configuration file.
3. The method of claim 2, wherein a test procedure is started when a piece of test data is read, and the corresponding test procedure is ended when the corresponding test log is obtained.
4. An apparatus for implementing a test, comprising:
the test request constructing unit is suitable for acquiring test data corresponding to the test task and constructing a test request according to the test data;
the communication unit is suitable for sending the test request to a test server so that the test server can complete the test task according to the test request and send the generated test log corresponding to the test task to a log search engine; and adapted to retrieve the test log from the log search engine;
and the checking unit is suitable for checking the test log according to a preset log checking rule.
5. The apparatus of claim 4, wherein,
the test request constructing unit is suitable for acquiring a test configuration file corresponding to the test task, wherein test data corresponding to one or more test processes are stored in the test configuration file; and traversing the test configuration file, and sequentially reading test data corresponding to a test process from the test configuration file.
6. The apparatus of claim 5, wherein a test procedure is started when a piece of test data is read, and the corresponding test procedure is ended when the corresponding test log is acquired.
7. A system for implementing a test, comprising: a test server, a log search engine and an implementation of the test according to any of claims 4-6;
the test implementation device is suitable for sending a test request to the test server;
the test server is suitable for completing the test task according to the test request and sending the generated test log corresponding to the test task to a log search engine;
the device for implementing the test is also suitable for acquiring the test log from the log search engine.
8. The system of claim 7, wherein,
the test server is also adapted to send the return data of the test task to the implementing device of the test.
9. An electronic device, wherein the electronic device comprises: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform the method of any one of claims 1-3.
10. A computer readable storage medium, wherein the computer readable storage medium stores one or more programs which, when executed by a processor, implement the method of any of claims 1-3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810811988.8A CN110750409A (en) | 2018-07-23 | 2018-07-23 | Method, device and system for realizing test |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810811988.8A CN110750409A (en) | 2018-07-23 | 2018-07-23 | Method, device and system for realizing test |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110750409A true CN110750409A (en) | 2020-02-04 |
Family
ID=69275000
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810811988.8A Pending CN110750409A (en) | 2018-07-23 | 2018-07-23 | Method, device and system for realizing test |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110750409A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114666258A (en) * | 2022-03-22 | 2022-06-24 | 阿波罗智联(北京)科技有限公司 | Interface test method, device, electronic equipment and medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104360920A (en) * | 2014-12-02 | 2015-02-18 | 微梦创科网络科技(中国)有限公司 | Automatic testing method and device for interface |
CN106648945A (en) * | 2016-09-30 | 2017-05-10 | 北京金山安全软件有限公司 | Interface data testing method and device and electronic equipment |
CN107066386A (en) * | 2017-04-12 | 2017-08-18 | 合网络技术(北京)有限公司 | The method of testing and system of a kind of video ads |
CN107729238A (en) * | 2017-10-09 | 2018-02-23 | 郑州云海信息技术有限公司 | A kind of plug-in unit adjustment method, system, device and computer-readable recording medium |
-
2018
- 2018-07-23 CN CN201810811988.8A patent/CN110750409A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104360920A (en) * | 2014-12-02 | 2015-02-18 | 微梦创科网络科技(中国)有限公司 | Automatic testing method and device for interface |
CN106648945A (en) * | 2016-09-30 | 2017-05-10 | 北京金山安全软件有限公司 | Interface data testing method and device and electronic equipment |
CN107066386A (en) * | 2017-04-12 | 2017-08-18 | 合网络技术(北京)有限公司 | The method of testing and system of a kind of video ads |
CN107729238A (en) * | 2017-10-09 | 2018-02-23 | 郑州云海信息技术有限公司 | A kind of plug-in unit adjustment method, system, device and computer-readable recording medium |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114666258A (en) * | 2022-03-22 | 2022-06-24 | 阿波罗智联(北京)科技有限公司 | Interface test method, device, electronic equipment and medium |
CN114666258B (en) * | 2022-03-22 | 2023-11-07 | 阿波罗智联(北京)科技有限公司 | Interface testing method, device, electronic equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109302522B (en) | Test method, test device, computer system, and computer medium | |
CN109189665B (en) | Method and device for recording, replaying and automatically testing data | |
US8819642B2 (en) | Method and system for generating and processing black box test cases | |
CN107729255B (en) | Software testing method, device and system | |
CN113535538B (en) | Method, device, electronic equipment and storage medium for automatically testing application full link | |
CN111198809A (en) | Interface automation test method and device | |
CN112241360A (en) | Test case generation method, device, equipment and storage medium | |
CN111176918A (en) | Server testing method, system, equipment and computer readable storage medium | |
CN112148607B (en) | Interface testing method and device for service scene | |
CN111290905A (en) | Testing method and device for cloud platform of Internet of things | |
CN110750434A (en) | Interface testing method and device, electronic equipment and computer readable storage medium | |
CN111274120B (en) | Interface document verification method and device | |
CN111708712A (en) | User behavior test case generation method, flow playback method and electronic equipment | |
CN113849388B (en) | Test method and device, electronic equipment and storage medium | |
CN110750409A (en) | Method, device and system for realizing test | |
CN112052070A (en) | Application containerization evaluation method and device, electronic equipment and storage medium | |
CN114500348B (en) | CDN gateway testing method and system | |
CN112015436A (en) | Short message platform deployment method and device, computing equipment and computer storage medium | |
CN115599668A (en) | Interface test case generation method and device and electronic equipment | |
CN111198798B (en) | Service stability measuring method and device | |
CN114942878A (en) | Automatic performance testing method for internet application and related equipment | |
CN111104328B (en) | Use case generation method and device, computer equipment and readable storage medium | |
CN115437903A (en) | Interface test method, device, apparatus, storage medium, and program | |
CN112433946A (en) | Interface test management method, device, equipment and storage medium | |
CN111444057A (en) | Page performance data acquisition method and device and computing equipment |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200204 |
|
RJ01 | Rejection of invention patent application after publication |