[go: up one dir, main page]

CN112799933A - Automatic testing method and device - Google Patents

Automatic testing method and device Download PDF

Info

Publication number
CN112799933A
CN112799933A CN201911114410.8A CN201911114410A CN112799933A CN 112799933 A CN112799933 A CN 112799933A CN 201911114410 A CN201911114410 A CN 201911114410A CN 112799933 A CN112799933 A CN 112799933A
Authority
CN
China
Prior art keywords
result
test
file
parameterized
log file
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.)
Granted
Application number
CN201911114410.8A
Other languages
Chinese (zh)
Other versions
CN112799933B (en
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.)
Beijing Jingdong Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi Information Technology 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 Beijing Jingdong Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN201911114410.8A priority Critical patent/CN112799933B/en
Publication of CN112799933A publication Critical patent/CN112799933A/en
Application granted granted Critical
Publication of CN112799933B publication Critical patent/CN112799933B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • G06F9/548Object oriented; Remote method invocation [RMI]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses an automatic testing method and device, and relates to the technical field of computers. One embodiment of the method comprises: downloading a parameterized file in a fixed-length line mode by utilizing multithread program execution, and loading the parameterized file into a memory; test parameters in the parameterized file are entered into a remote procedure calling method, and the remote procedure calling method is called; and receiving a returned test result, and generating a log file according to the test result and an expected result. The implementation method can solve the technical problem of high dependency on the third-party testing tool.

Description

Automatic testing method and device
Technical Field
The invention relates to the technical field of computers, in particular to an automatic testing method and device.
Background
Currently, automated testing is typically implemented based on third party performance testing tools (e.g., LoadRunner, Jmeter, etc.).
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the operation environment needs to be supported by the corresponding test tool, which causes additional load; the written automatic test code needs to be embedded into a test tool to be operated; it is desirable for performance testers to have a relatively solid foundation for the testing tools.
Disclosure of Invention
In view of this, embodiments of the present invention provide an automated testing method and apparatus to solve the technical problem of high dependency on a third-party testing tool.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided an automated testing method using a multithread program to perform the steps of:
downloading a parameterized file in a fixed-length line mode, and loading the parameterized file into a memory;
test parameters in the parameterized file are entered into a remote procedure calling method, and the remote procedure calling method is called;
and receiving a returned test result, and generating a log file according to the test result and an expected result.
Optionally, before downloading the parameterized file in fixed-length lines, the method further includes:
writing the test parameters into a parameterized file according to the preset byte number; in the parameterized file, the length of each line is a preset byte number;
and uploading the parameterized file to a cloud.
Optionally, if the number of bytes of the test parameter is less than the preset number of bytes, occupying the space until the number of bytes of the row in which the test parameter is located is equal to the preset number of bytes.
Optionally, receiving a returned test result, and generating a log file according to the test result and an expected result, including:
receiving a returned test result;
determining response time according to the time node for calling the remote procedure calling method and the time node for receiving the test result, and writing the response time and the occurrence times thereof into a response result log file;
and judging whether the test result is the same as the expected result, and if not, writing the test result into an abnormal log file.
Optionally, writing the response time and the occurrence number thereof into a response result log file, including:
writing the response time into a global result variable, wherein the global result variable is a shared variable and is stored in a multiple mapping mode; wherein, key is response time, and value is the occurrence frequency of the response time;
and traversing the multiple mapping results of the global result variables, respectively calculating the total occurrence times corresponding to each response time to obtain key value pair information, and writing the key value pair information into a response result log file.
Optionally, writing the key-value pair information into a response result log file, including:
according to the sequence of response time from small to large, the key value pair information is arranged in an ascending order;
deleting key value pair information outside a preset response threshold percentage range according to the preset response threshold percentage range;
and writing the rest key value pair information into a response result log file according to the sequence of response time from small to large.
Optionally, after generating a log file according to the test result and the expected result, the method further includes:
and uploading the log file to a test platform.
In addition, according to another aspect of an embodiment of the present invention, there is provided an automated testing apparatus including:
the loading module is used for downloading the parameterized file in a fixed-length line mode by utilizing a multithread program and loading the parameterized file into the memory;
the calling module is used for utilizing a multithreading program to participate the test parameters in the parameterized file into a remote procedure calling method and calling the remote procedure calling method;
and the log module is used for receiving the returned test result by using the multithread program and generating a log file according to the test result and the expected result.
Optionally, the loading module is further configured to write the test parameter into the parameterized file according to a preset number of bytes before downloading the parameterized file in a fixed-length row manner; in the parameterized file, the length of each line is a preset byte number;
and uploading the parameterized file to a cloud.
Optionally, if the number of bytes of the test parameter is less than the preset number of bytes, occupying the space until the number of bytes of the row in which the test parameter is located is equal to the preset number of bytes.
Optionally, the logging module is further configured to:
receiving a returned test result;
determining response time according to the time node for calling the remote procedure calling method and the time node for receiving the test result, and writing the response time and the occurrence times thereof into a response result log file;
and judging whether the test result is the same as the expected result, and if not, writing the test result into an abnormal log file.
Optionally, the logging module is further configured to:
writing the response time into a global result variable, wherein the global result variable is a shared variable and is stored in a multiple mapping mode; wherein, key is response time, and value is the occurrence frequency of the response time;
and traversing the multiple mapping results of the global result variables, respectively calculating the total occurrence times corresponding to each response time to obtain key value pair information, and writing the key value pair information into a response result log file.
Optionally, the logging module is further configured to: :
according to the sequence of response time from small to large, the key value pair information is arranged in an ascending order;
deleting key value pair information outside a preset response threshold percentage range according to the preset response threshold percentage range;
and writing the rest key value pair information into a response result log file according to the sequence of response time from small to large.
Optionally, the logging module is further configured to:
and after a log file is generated according to the test result and the expected result, uploading the log file to a test platform.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of any of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: the technical means that the parameterized file is downloaded by a multithread program in a fixed-length line mode, the test parameters in the parameterized file are entered into the remote procedure calling method, and the remote procedure calling method is called is adopted, so that the technical problem of high dependency on a third-party test tool in the prior art is solved. The embodiment of the invention performs the performance test through the multi-thread program OpenMP, thereby greatly reducing the entry difficulty and the code amount of the performance test script. The debugging and compiling difficulty of the performance test script is reduced due to the small code amount; compared with a third-party tool, the performance testing process has visibility, the subsequent related functions can be conveniently expanded, the hardware performance of the execution machine is fully utilized, and the number of the performance testing execution machines is reduced.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of an automated testing method according to an embodiment of the invention;
FIG. 2 is a schematic view of a main flow of an automated test method according to a referential embodiment of the present invention;
FIG. 3 is a schematic view of a main flow of an automated test method according to another referential embodiment of the present invention;
FIG. 4 is a schematic diagram of the main modules of an automated test equipment according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 6 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The compiler-carried multithreading program library OpenMP has the setting functions of implicit encapsulation multithreading calling and multithreading execution strategies, and can automatically convert common for-loop statements into a multithreading mode for execution.
Fig. 1 is a schematic diagram of a main flow of an automated testing method according to an embodiment of the present invention. As an embodiment of the present invention, as shown in fig. 1, the automated testing method utilizes a multi-thread program to perform the following steps:
step 101, downloading a parameterized file in a fixed-length line mode, and loading the parameterized file into a memory.
Generally speaking, the parameterized file is stored in the cloud, so before starting testing, the parameterized file needs to be downloaded to the local and loaded into the memory. In order to increase the speed of reading and downloading the parameterized file, in the embodiment of the present invention, each line of test parameters in the parameterized file is read in a fixed-length line manner, and deserialized (from a text to a memory) into the memory.
Optionally, before downloading the parameterized file in fixed-length lines, the method further includes: writing the test parameters into a parameterized file according to the preset byte number; in the parameterized file, the length of each line is a preset byte number; and uploading the parameterized file to a cloud. In the embodiment of the invention, the parameterized file of the fixed-length line can be written in advance, and the written parameterized file is uploaded to the cloud. Specifically, the fixed-length number of bytes may be determined according to the number of bytes of the longest test parameter, for example, the number of bytes of the longest test parameter is 100, and then the number of bytes of the fixed-length row is 101 (100 bytes +1 linefeed character).
Optionally, if the number of bytes of the test parameter is less than the preset number of bytes, occupying the space until the number of bytes of the row where the test parameter is located is equal to the preset number of bytes, so as to ensure that the test parameter in the parameterized file can be read from the cloud in a fixed-length row manner, thereby improving the speed of downloading the parameterized file.
And 102, inputting the test parameters in the parameterized file into a remote procedure calling method, and calling the remote procedure calling method.
Firstly, reading a test parameter from a memory, then inputting the test parameter into a packaged remote procedure call method (such as an http request), then calling the packaged remote procedure call method, and recording a time node for calling the remote procedure call method. It should be noted that, for some performance tests without network request, the tested program and the performance test script may be deployed on one server, and the local procedure call is directly invoked to implement the performance test without network access.
And 103, receiving the returned test result, and generating a log file according to the test result and the expected result.
In this step, a test result returned by calling the remote procedure call method is received, and a time node for receiving the test result is recorded. And then generating a log file according to the test result and the expected result. Optionally, step 103 may comprise: receiving a returned test result; determining response time according to the time node for calling the remote procedure calling method and the time node for receiving the test result, and writing the response time and the occurrence times thereof into a response result log file; and judging whether the test result is the same as the expected result, and if not, writing the test result into an abnormal log file.
Optionally, writing the response time and the occurrence number thereof into a response result log file, including: writing the response time into a global result variable, wherein the global result variable is a shared variable and is stored in a multiple mapping mode; wherein, key is response time, and value is the occurrence frequency of the response time; and traversing the multiple mapping results of the global result variables, respectively calculating the total occurrence times corresponding to each response time to obtain key value pair information, and writing the key value pair information into a response result log file. And subtracting the time node for receiving the test result from the time node for calling the remote procedure calling method to obtain the response time, and writing the response time into the global result variable. In the embodiment of the present invention, the global result variable is stored in a multi-map (key repeatable map) manner, and the global result variable is a shared variable, and each thread performs read and write operations on the global result variable during the test process.
The key value pair information can be filtered first, and the filtered key value pair information is written into a response result log file. Optionally, writing the key-value pair information into a response result log file, including: according to the sequence of response time from small to large, the key value pair information is arranged in an ascending order; deleting key value pair information outside a preset response threshold percentage range according to the preset response threshold percentage range; and writing the rest key value pair information into a response result log file according to the sequence of response time from small to large. And after the test is finished, traversing multimap results of the global result variables, counting the total response times of each response time, and performing ascending arrangement according to the order of keys from small to large. After sorting the keys, according to a preset response threshold percentage range, removing the first 0.05% and the second 0.02% of key-values, calculating the starting and ending intervals of the remaining multimap, circularly traversing all the key-values in the starting to ending intervals of the multimap, and outputting the key-values to a response result log file according to the order of the keys from small to large.
According to the various embodiments described above, it can be seen that the technical means of downloading the parameterized file in a fixed-length-row manner by using the multithread program, participating the test parameters in the parameterized file into the remote procedure call method, and calling the remote procedure call method in the present invention solves the technical problem of high dependency on the third-party test tool in the prior art. The embodiment of the invention performs the performance test through the multi-thread program OpenMP, thereby greatly reducing the entry difficulty and the code amount of the performance test script. The debugging and compiling difficulty of the performance test script is reduced due to the small code amount; compared with a third-party tool, the performance testing process has visibility, the subsequent related functions can be conveniently expanded, the hardware performance of the execution machine is fully utilized, and the number of the performance testing execution machines is reduced.
Fig. 2 is a schematic view of a main flow of an automated test method according to a referential embodiment of the present invention. As another embodiment of the present invention, as shown in fig. 2, the automated testing method utilizes a multi-thread program to perform the following steps:
step 201, writing the test parameters into a parameterized file according to a preset byte number, and uploading the parameterized file to a cloud.
In the parameterized file, the length of each row is a preset number of bytes. The preset number of bytes is equal to the number of bytes +1 of the longest test parameter, for example, the number of bytes of the longest test parameter is 95, and then the number of bytes of the fixed-length row is 96. If the byte number of the test parameter is smaller than the preset byte number, space occupation is carried out until the byte number of a row where the test parameter is located is equal to the preset byte number, so that the test parameter in the parameterized file can be read from the cloud end in a fixed-length row mode, and the speed of downloading the parameterized file is improved.
Step 202, downloading a parameterized file in a fixed-length line mode, and loading the parameterized file into a memory.
In order to increase the speed of reading and downloading the parameterized file, the embodiment of the invention reads each row of test parameters in the parameterized file in a fixed-length row mode and deserializes the test parameters into the memory.
Step 203, the test parameters in the parameterized file are entered into a remote procedure call method, the remote procedure call method is called, and the time node for calling the remote procedure call method is recorded.
And step 204, receiving the returned test result, and recording the time node for receiving the test result.
Step 205, determining response time according to the time node for calling the remote procedure calling method and the time node for receiving the test result, and writing the response time and the occurrence frequency thereof into a response result log file.
Specifically, the time node receiving the test result is subtracted from the time node calling the remote procedure call method to obtain the response time, and the response time is written into the global result variable. The global result variable is a shared variable and is stored in a multiple mapping mode; wherein, key is response time, and value is the occurrence number of the response time. And traversing the multiple mapping results of the global result variables, respectively calculating the total occurrence times corresponding to each response time to obtain key value pair information, and writing the key value pair information into a response result log file.
Optionally, the key value pair information is filtered first, and the received key value pair information is written into a response result log file. For example, the key-values are arranged in ascending order according to the order of the keys from small to large; and removing the key-values of the first 0.03% and the second 0.05%, and writing the rest key-values into the response result log file according to the order of the keys from small to large.
And step 206, judging whether the test result is the same as the expected result, and if not, writing the test result into an abnormal log file.
And step 207, uploading the response result log file and the abnormal log file to the test platform.
In addition, in a reference embodiment of the present invention, the implementation of the automated testing method is described in detail in the above automated testing method, so that the repeated description is not repeated here.
Fig. 3 is a schematic view of a main flow of an automated test method according to another referential embodiment of the present invention. The automated testing method of the embodiment of the invention can be implemented by adopting a testing framework as shown in fig. 3, wherein the testing framework comprises an agent module, a main program module, a file loading module and a remote calling module. The automated testing method may include the steps of:
and writing the test parameters into a parameterized file according to the preset byte number, and uploading the parameterized file to the cloud. In the parameterized file, the length of each row is a preset number of bytes. And the preset byte number is equal to the byte number of the longest test parameter + 1. And if the byte number of the test parameter is less than the preset byte number, occupying the space until the byte number of the row where the test parameter is positioned is equal to the preset byte number.
The agent module is mainly responsible for compiling the performance test script, setting the performance strategy (realized by setting OpenMP environment variables) and running the performance test script (namely, the main program module).
The main program module is provided with a compiling instruction statement (# the compiling instruction statement at the beginning of pragmam omp), and simultaneously, global result variables are configured as shared variables, so that each thread can perform read-write operation on the global result variables. The main program module is provided with performance strategies (such as thread number, cycle working mode and the like). And the for loop initiates a remote call to perform a multi-thread test, and exits the loop when the loop times and the execution are completed or a certain execution time is reached.
The agent module runs the main program module, the main program module sends a downloading instruction to the file loading module, the file loading module downloads the parameterized files of the fixed-length lines from the cloud by using the multithreading program OpenMP, and deserializes the downloaded test parameters of the fixed-length lines into the memory.
The main program module sends a remote calling instruction to the remote calling module, the remote calling module reads the test parameters from the memory, then the test parameters are entered into the packaged remote procedure calling method, then the packaged remote procedure calling method is called, and finally the returned test result is received. And the remote calling module records the time node for calling the remote procedure calling method and the time node for receiving the test result respectively.
And the remote calling module judges whether the test result is the same as the expected result or not, and if not, the actual test result is written into the abnormal log file. And the exception log is directly stored in the hard disk by the remote calling module.
And the remote calling module determines response time according to the time node for calling the remote procedure calling method and the time node for receiving the test result, and counts the response time into a global result variable. The global result variable is a shared variable and is stored in a multiple mapping mode; wherein, key is response time, and value is the occurrence number of the response time.
The main program module initializes global result variables at an initialization stage. After the test is finished, the main program module traverses the multimap result of the global result variable and respectively calculates the total response times of each response time. And then sorting the keys in an ascending order, removing a part of key-values according to a preset response threshold percentage range, calculating the starting interval and the ending interval of the rest multimap, circularly traversing all the key-values in the starting interval and the ending interval of the multimap, and outputting the key-values to a response result log file according to the order of the keys from small to large.
And the main program module sends a remote calling instruction to the remote calling module again, continues to execute the next remote calling, and circularly operates according to the performance strategy until all tests are completed and then exits from the main program.
And the agent module collects the log file and uploads the log file to the test platform.
In addition, in another embodiment of the present invention, the detailed description of the automated testing method is provided, and therefore the repeated description is not repeated herein.
Fig. 4 is a schematic diagram of main modules of an automatic test apparatus according to an embodiment of the present invention, and as shown in fig. 4, the automatic test apparatus 400 includes a logging module 401, a calling module 402, and a logging module 403. The loading module 401 is configured to download a parameterized file in a fixed-length line manner by using a multithread program, and load the parameterized file into a memory; the calling module 402 is configured to utilize a multithreading program to enter the test parameter in the parameterized file into a remote procedure calling method and call the remote procedure calling method; the log module 403 is configured to receive the returned test result by using the multithread program, and generate a log file according to the test result and the expected result.
Optionally, the loading module 401 is further configured to write the test parameter into the parameterized file according to a preset number of bytes before downloading the parameterized file in a fixed-length row manner; in the parameterized file, the length of each line is a preset byte number;
and uploading the parameterized file to a cloud.
Optionally, if the number of bytes of the test parameter is less than the preset number of bytes, occupying the space until the number of bytes of the row in which the test parameter is located is equal to the preset number of bytes.
Optionally, the log module 403 is further configured to:
receiving a returned test result;
determining response time according to the time node for calling the remote procedure calling method and the time node for receiving the test result, and writing the response time and the occurrence times thereof into a response result log file;
and judging whether the test result is the same as the expected result, and if not, writing the test result into an abnormal log file.
Optionally, the log module 403 is further configured to:
writing the response time into a global result variable, wherein the global result variable is a shared variable and is stored in a multiple mapping mode; wherein, key is response time, and value is the occurrence frequency of the response time;
and traversing the multiple mapping results of the global result variables, respectively calculating the total occurrence times corresponding to each response time to obtain key value pair information, and writing the key value pair information into a response result log file.
Optionally, the log module 403 is further configured to: :
according to the sequence of response time from small to large, the key value pair information is arranged in an ascending order;
deleting key value pair information outside a preset response threshold percentage range according to the preset response threshold percentage range;
and writing the rest key value pair information into a response result log file according to the sequence of response time from small to large.
Optionally, the log module 403 is further configured to:
and after a log file is generated according to the test result and the expected result, uploading the log file to a test platform.
According to the various embodiments described above, it can be seen that the technical means of downloading the parameterized file in a fixed-length-row manner by using the multithread program, participating the test parameters in the parameterized file into the remote procedure call method, and calling the remote procedure call method in the present invention solves the technical problem of high dependency on the third-party test tool in the prior art. The embodiment of the invention performs the performance test through the multi-thread program OpenMP, thereby greatly reducing the entry difficulty and the code amount of the performance test script. The debugging and compiling difficulty of the performance test script is reduced due to the small code amount; compared with a third-party tool, the performance testing process has visibility, the subsequent related functions can be conveniently expanded, the hardware performance of the execution machine is fully utilized, and the number of the performance testing execution machines is reduced.
It should be noted that, in the implementation of the automated testing apparatus of the present invention, the above automated testing method has been described in detail, and therefore, the repeated description is not repeated here.
Fig. 5 illustrates an exemplary system architecture 500 to which the automated test method or automated test apparatus of embodiments of the invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 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 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 501, 502, 503. The background management server may analyze and otherwise process the received data such as the item information query request, and feed back a processing result (for example, target push information, item information — just an example) to the terminal device.
It should be noted that the automated testing method provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the automated testing apparatus is generally disposed in the server 505. The automatic testing method provided by the embodiment of the invention can also be executed by the terminal equipment 501, 502 and 503, and correspondingly, the automatic testing device can be arranged in the terminal equipment 501, 502 and 503.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer programs according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a load module, a call module, and a log module, where the names of the modules do not in some cases constitute a definition of the module itself.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: downloading a parameterized file in a fixed-length line mode by utilizing multithread program execution, and loading the parameterized file into a memory; test parameters in the parameterized file are entered into a remote procedure calling method, and the remote procedure calling method is called; and receiving a returned test result, and generating a log file according to the test result and an expected result.
According to the technical scheme of the embodiment of the invention, the technical means that the parameterized file is downloaded by utilizing the multithread program in a fixed-length line mode, the test parameters in the parameterized file are entered into the remote procedure calling method and the remote procedure calling method is called is adopted, so that the technical problem of high dependency on a third-party test tool in the prior art is solved. The embodiment of the invention performs the performance test through the multi-thread program OpenMP, thereby greatly reducing the entry difficulty and the code amount of the performance test script. The debugging and compiling difficulty of the performance test script is reduced due to the small code amount; compared with a third-party tool, the performance testing process has visibility, the subsequent related functions can be conveniently expanded, the hardware performance of the execution machine is fully utilized, and the number of the performance testing execution machines is reduced.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. An automated testing method, characterized by using a multi-thread program to execute the following steps:
downloading a parameterized file in a fixed-length line mode, and loading the parameterized file into a memory;
test parameters in the parameterized file are entered into a remote procedure calling method, and the remote procedure calling method is called;
and receiving a returned test result, and generating a log file according to the test result and an expected result.
2. The method of claim 1, further comprising, before downloading the parameterized file in fixed length rows:
writing the test parameters into a parameterized file according to the preset byte number; in the parameterized file, the length of each line is a preset byte number;
and uploading the parameterized file to a cloud.
3. The method of claim 2, wherein if the number of bytes of the test parameter is less than the preset number of bytes, the space is occupied until the number of bytes of the row in which the test parameter is located is equal to the preset number of bytes.
4. The method of claim 1, wherein receiving returned test results, and generating a log file based on the test results and expected results comprises:
receiving a returned test result;
determining response time according to the time node for calling the remote procedure calling method and the time node for receiving the test result, and writing the response time and the occurrence times thereof into a response result log file;
and judging whether the test result is the same as the expected result, and if not, writing the test result into an abnormal log file.
5. The method of claim 4, wherein writing the response time and the number of occurrences thereof into a response result log file comprises:
writing the response time into a global result variable, wherein the global result variable is a shared variable and is stored in a multiple mapping mode; wherein, key is response time, and value is the occurrence frequency of the response time;
and traversing the multiple mapping results of the global result variables, respectively calculating the total occurrence times corresponding to each response time to obtain key value pair information, and writing the key value pair information into a response result log file.
6. The method of claim 5, wherein writing the key-value pair information to a response result log file comprises:
according to the sequence of response time from small to large, the key value pair information is arranged in an ascending order;
deleting key value pair information outside a preset response threshold percentage range according to the preset response threshold percentage range;
and writing the rest key value pair information into a response result log file according to the sequence of response time from small to large.
7. The method of claim 1, further comprising, after generating a log file based on the test results and expected results:
and uploading the log file to a test platform.
8. An automated testing apparatus, comprising:
the loading module is used for downloading the parameterized file in a fixed-length line mode by utilizing a multithread program and loading the parameterized file into the memory;
the calling module is used for utilizing a multithreading program to participate the test parameters in the parameterized file into a remote procedure calling method and calling the remote procedure calling method;
and the log module is used for receiving the returned test result by using the multithread program and generating a log file according to the test result and the expected result.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN201911114410.8A 2019-11-14 2019-11-14 Automatic test method and device Active CN112799933B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911114410.8A CN112799933B (en) 2019-11-14 2019-11-14 Automatic test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911114410.8A CN112799933B (en) 2019-11-14 2019-11-14 Automatic test method and device

Publications (2)

Publication Number Publication Date
CN112799933A true CN112799933A (en) 2021-05-14
CN112799933B CN112799933B (en) 2023-11-03

Family

ID=75803797

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911114410.8A Active CN112799933B (en) 2019-11-14 2019-11-14 Automatic test method and device

Country Status (1)

Country Link
CN (1) CN112799933B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06103104A (en) * 1992-09-18 1994-04-15 Hitachi Ltd Remote debugging method
US20180173606A1 (en) * 2016-12-15 2018-06-21 Syntel, Inc. Hybrid testing automation engine
US20180285424A1 (en) * 2017-03-31 2018-10-04 University Of Virginia Patent Foundation Disjunctive rule mining with finite automaton hardware
CN109547272A (en) * 2019-01-09 2019-03-29 西安交通大学 A kind of numerical control device novel maintenance system internet interface
CN109815105A (en) * 2017-11-20 2019-05-28 北京京东尚科信息技术有限公司 Applied program testing method and device based on Btrace
CN109992495A (en) * 2017-12-29 2019-07-09 北京京东尚科信息技术有限公司 The method and apparatus of interface testing

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06103104A (en) * 1992-09-18 1994-04-15 Hitachi Ltd Remote debugging method
US20180173606A1 (en) * 2016-12-15 2018-06-21 Syntel, Inc. Hybrid testing automation engine
US20180285424A1 (en) * 2017-03-31 2018-10-04 University Of Virginia Patent Foundation Disjunctive rule mining with finite automaton hardware
CN109815105A (en) * 2017-11-20 2019-05-28 北京京东尚科信息技术有限公司 Applied program testing method and device based on Btrace
CN109992495A (en) * 2017-12-29 2019-07-09 北京京东尚科信息技术有限公司 The method and apparatus of interface testing
CN109547272A (en) * 2019-01-09 2019-03-29 西安交通大学 A kind of numerical control device novel maintenance system internet interface

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
曹宗雁;: "高性能计算集群运行时环境的配置优化", 科研信息化技术与应用, no. 06 *
田鸿运;刘青凯;成杰;杨章;单雅辉;: "一种面向高性能数值模拟软件的自动化测试平台", 计算机工程与科学, no. 11 *

Also Published As

Publication number Publication date
CN112799933B (en) 2023-11-03

Similar Documents

Publication Publication Date Title
CN109002395B (en) Code coverage rate management method and device
CN113076253B (en) A test method and a test device
CN113360368B (en) Method and device for testing software performance
CN113076251A (en) Test method and device
CN113778849A (en) Method, apparatus, device and storage medium for testing code
CN107644075B (en) Method and device for collecting page information
CN111666201A (en) Regression testing method, device, medium and electronic equipment
CN110795331A (en) Software testing method and device
CN112860538B (en) Method and device for carrying out interface regression test based on online log
CN110866031B (en) Database access path optimization method and device, computing equipment and medium
CN112631590A (en) Component library generation method and device, electronic equipment and computer readable medium
CN112380088B (en) Test method, device and electronic equipment
CN113778777A (en) Log playback method and device
CN112799933B (en) Automatic test method and device
CN112579428A (en) Interface testing method and device, electronic equipment and storage medium
CN108628909B (en) Information pushing method and device
CN112965910B (en) Automatic regression testing method and device, electronic equipment and storage medium
CN113342633B (en) Performance test method and device
CN113254325A (en) Test case processing method and device
CN113419957A (en) Rule-based big data offline batch processing performance capacity scanning method and device
CN112463616A (en) Chaos testing method and device for Kubernetes container platform
CN117130945B (en) Test method and device
CN112148292A (en) Method, apparatus, system and medium for optimizing code of application program
CN116610479B (en) Automatic fault monitoring method and device, electronic equipment and readable storage medium
CN113515437B (en) Method and device for debugging interface

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
GR01 Patent grant
GR01 Patent grant