CN113138935A - Program testing method and device, electronic equipment and storage medium - Google Patents

Program testing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113138935A
CN113138935A CN202110532383.7A CN202110532383A CN113138935A CN 113138935 A CN113138935 A CN 113138935A CN 202110532383 A CN202110532383 A CN 202110532383A CN 113138935 A CN113138935 A CN 113138935A
Authority
CN
China
Prior art keywords
test
program
preview
dimensional code
abnormal data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110532383.7A
Other languages
Chinese (zh)
Inventor
张东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Tuoxian Technology Co Ltd
Original Assignee
Beijing Jingdong Tuoxian 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 Tuoxian Technology Co Ltd filed Critical Beijing Jingdong Tuoxian Technology Co Ltd
Priority to CN202110532383.7A priority Critical patent/CN113138935A/en
Publication of CN113138935A publication Critical patent/CN113138935A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging using diagnostics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a program testing method, a program testing device, electronic equipment and a storage medium, and relates to the technical field of computers. One embodiment of the method comprises: receiving a program test request, acquiring an identifier of a test program and an identifier of a test environment in the program test request to generate a preview two-dimensional code of the test program in the test environment, and displaying the preview two-dimensional code; when it is monitored that a user enters a test environment through previewing the two-dimensional code, a unique identifier is distributed to the user, operation data of the user on a test program are collected, a log file is generated by combining the unique identifier, and abnormal data in the log file are identified and stored; and receiving an abnormal data viewing request, acquiring the unique identifier in the abnormal data viewing request, inquiring abnormal data corresponding to the unique identifier and returning. The implementation mode can solve the problems of complex operation and low efficiency of the test mode in the prior art.

Description

Program testing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for program testing, an electronic device, and a storage medium.
Background
Applets have been widely popularized as an application that can be used directly without downloading. The small program needs to be tested after being developed and deployed, and the existing testing mode is that a tester captures test data in a program test through a packet capturing tool and then performs exception analysis on the captured test data to determine problems in the test program. However, this kind of test method not only needs to use the bale plucking tool, but also needs the tester to spend time to perform the anomaly analysis, resulting in the test process operation being complicated and the efficiency being low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for program testing, an electronic device, and a storage medium, which can solve the problems of complex operation and low efficiency of the testing method in the prior art.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of program testing.
The program testing method of the embodiment of the invention comprises the following steps: receiving a program test request, acquiring an identifier of a test program and an identifier of a test environment in the program test request, generating a preview two-dimensional code of the test program in the test environment, and displaying the preview two-dimensional code; after a user is monitored to enter the test environment through the preview two-dimensional code, a unique identifier is distributed to the user, operation data of the user on the test program are collected, a log file is generated by combining the unique identifier, and abnormal data in the log file are identified and stored; and receiving an abnormal data viewing request, acquiring the unique identifier in the abnormal data viewing request, inquiring abnormal data corresponding to the unique identifier and returning.
In one embodiment, identifying anomalous data in the log file comprises:
monitoring response data corresponding to a target event based on the log file, and identifying the response data to judge whether the response data comprises abnormal key characters;
if yes, determining the response data as abnormal data; if not, determining that the response data is not abnormal data.
In yet another embodiment, identifying and storing anomalous data in the log file comprises:
identifying abnormal data in the log file, and acquiring a position identifier of the abnormal data in the log file;
and storing the abnormal data and the position identification of the abnormal data.
In another embodiment, generating a preview two-dimensional code of the test program in the test environment, and displaying the preview two-dimensional code includes:
inquiring the generation duration of the historical preview two-dimensional code of the test program in the test environment to judge whether the generation duration is greater than a preset duration threshold value;
if so, generating a preview two-dimensional code of the test program under the test environment, and displaying the preview two-dimensional code; and if not, displaying the history preview two-dimensional code.
In another embodiment, generating a preview two-dimensional code of the test program in the test environment includes:
calling a two-dimension code generation interface, sending a preview two-dimension code generation request of the test program in the test environment to a two-dimension code generation server, and further receiving a preview two-dimension code returned by the two-dimension code generation server, wherein the two-dimension code generation interface is generated based on a preset development framework.
In yet another embodiment, the receiving the user request further comprises:
the method comprises the steps of creating a docker container in a linux environment, and creating a wire mirror image based on the docker container so as to run the test environment through the wire mirror image.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided an apparatus for program testing.
The program testing device of the embodiment of the invention comprises: the generating unit is used for receiving a program test request, acquiring an identifier of a test program and an identifier of a test environment in the program test request, generating a preview two-dimensional code of the test program in the test environment, and displaying the preview two-dimensional code; the test unit is used for distributing a unique identifier for a user after the user is monitored to enter the test environment through the preview two-dimensional code, collecting operation data of the user on the test program, generating a log file by combining the unique identifier, and further identifying and storing abnormal data in the log file; and the viewing unit is used for receiving the abnormal data viewing request, acquiring the unique identifier in the abnormal data viewing request, inquiring the abnormal data corresponding to the unique identifier and returning.
In one embodiment, the test unit is specifically configured to:
monitoring response data corresponding to a target event based on the log file, and identifying the response data to judge whether the response data comprises abnormal key characters;
if yes, determining the response data as abnormal data; if not, determining that the response data is not abnormal data.
In another embodiment, the test unit is specifically configured to:
identifying abnormal data in the log file, and acquiring a position identifier of the abnormal data in the log file;
and storing the abnormal data and the position identification of the abnormal data.
In another embodiment, the generating unit is specifically configured to:
inquiring the generation duration of the historical preview two-dimensional code of the test program in the test environment to judge whether the generation duration is greater than a preset duration threshold value;
if so, generating a preview two-dimensional code of the test program under the test environment, and displaying the preview two-dimensional code; and if not, displaying the history preview two-dimensional code.
In another embodiment, the generating unit is specifically configured to:
calling a two-dimension code generation interface, sending a preview two-dimension code generation request of the test program in the test environment to a two-dimension code generation server, and further receiving a preview two-dimension code returned by the two-dimension code generation server, wherein the two-dimension code generation interface is generated based on a preset development framework.
In yet another embodiment, the apparatus further comprises:
the method comprises the steps of creating a docker container in a linux environment, and creating a wire mirror image based on the docker container so as to run the test environment through the wire mirror image.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided an electronic apparatus.
An electronic device of an embodiment of the present invention includes: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the program testing method provided by the embodiment of the invention.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a computer-readable medium.
A computer-readable medium of an embodiment of the present invention stores thereon a computer program, which, when executed by a processor, implements the method for program testing provided by an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: in the embodiment of the invention, after the program test request is received, the corresponding preview two-dimensional code can be generated based on the identifier of the test program and the identifier of the test environment in the program test request, and the preview two-dimensional code is displayed, so that a user can conveniently enter the test environment through the preview two-dimensional code; when the condition that a user enters a test environment through previewing the two-dimensional code is monitored, a unique identifier can be distributed for the user, operation data of the user on a test program is collected, a log file is generated by combining the unique identifier, and abnormal data in the log file is identified and stored; therefore, after the abnormal data checking request is received, the abnormal data corresponding to the unique identifier can be inquired and returned, and the checking of the abnormal data in the test by the user is realized. In the embodiment of the invention, when the test program is tested, the operation data of the test program can be collected, the log file is generated by combining the distributed unique identifier, and the log file can be identified to obtain the abnormal data in the log file.
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 one major flow of a method of program testing in accordance with an embodiment of the present invention;
fig. 2 is a schematic diagram of a main flow of a method for previewing two-dimensional code generation according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the main elements of an apparatus for program testing according to an embodiment of the present invention;
FIG. 4 is a diagram of yet another exemplary system architecture to which embodiments of the present invention may be applied;
FIG. 5 is a schematic block diagram of a computer system suitable for use in implementing embodiments of the present 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.
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
The embodiment of the invention provides a program testing system which can be used for a program testing scene, such as an applet testing scene.
An embodiment of the present invention provides a method for program testing, where the method may be executed by a server, and as shown in fig. 1, the method includes:
s101: and receiving a program test request, acquiring the identifier of the test program and the identifier of the test environment in the program test request to generate a preview two-dimensional code of the test program in the test environment, and displaying the preview two-dimensional code.
The program test request may be sent by a user through a client, and the program test request may include an identifier of a test program and an identifier of a test environment, so as to indicate which program is tested in which test environment.
For some programs, different test environments are typically used for testing, for example, for applets, it typically includes an offline test environment and a formal online test environment. When testing, a user usually needs to enter a testing environment through the corresponding preview two-dimensional code to test a testing program. Because the file of the test program can be updated irregularly, the preview two-dimensional code of the test program under the test environment is usually generated temporarily during testing, so that when the test program is tested, the preview two-dimensional code of the test program under the corresponding test environment needs to be generated firstly and provided for a user, so that the user can enter the test environment through the preview two-dimensional code. Therefore, in this step, after the identifier of the test program and the identifier of the test environment are obtained, the procedure for previewing the generation of the two-dimensional code can be executed to generate the preview two-dimensional code of the test program in the test environment. In this step, the server side can send the preview two-dimensional code to the client side, so that the client side displays the generated preview two-dimensional code to the user.
S102: and after monitoring that the user enters a test environment by previewing the two-dimensional code, allocating a unique identifier for the user, collecting operation data of the user on the test program, generating a log file by combining the unique identifier, and further identifying and storing abnormal data in the log file.
After the preview two-dimensional code is displayed in step S101, the user can enter the corresponding test environment by scanning the preview two-dimensional code, and the server can monitor whether the user enters the test environment by previewing the two-dimensional code. After the situation that the user enters the test environment through the preview two-dimensional code is monitored, a unique identifier can be allocated to the user to be used for identifying the operation data of the user. The user can execute the test operation on the test program after entering the test environment, the server can collect the operation data of the user on the test program, namely the test data of the user on the test program, and generate the log file by combining the unique identifier of the user, so that each data in the log file can distinguish the corresponding user through the unique identifier, and the data in the log file can be determined as the operation data of the user based on the unique identifier in the step. The log file can be identified in the embodiment of the invention, so that the abnormal data in the log file can be obtained and stored.
It should be noted that, because the log file is generated by combining the unique identifier, after the abnormal data is obtained, the unique identifier corresponding to each abnormal data can be determined, and further, the unique identifiers corresponding to each abnormal data and the abnormal data can be stored.
In the embodiment of the present invention, identifying abnormal data in a log file may be specifically performed as: monitoring response data corresponding to the target event based on the log file, and identifying the response data to judge whether the response data comprises abnormal key characters; if yes, determining the response data as abnormal data; if not, determining that the response data is not abnormal data.
In the embodiment of the invention, the target event to be monitored can be set based on the test experience, and whether the test program is abnormal or not and which abnormal events occur can be analyzed by monitoring the response data corresponding to the target event. For example, for interface testing, whether an interface is abnormal can be judged through data corresponding to two events, namely loadstart and loadend, of an ajax request and an XMLHttpRequest object, so that the two events, namely the loadstart and the loadend, of the ajax request and the XMLHttpRequest object can be set as target events in the embodiment of the invention. Data formats and numerical values under different scenes are preset in all parameters of corresponding data during data processing and transmission, and some numerical values can represent abnormal conditions. For example, for interface testing, a response data 500 indicates a server exception or a service restart, and a response data 404 indicates an interface address error, which all indicate that an exception occurs in the interface. Therefore, in this step, an abnormal key character may be preset, where the abnormal key character includes characters, such as 500, 404, etc., used for representing an abnormality in the data. After the response data corresponding to the target event is monitored, the response data can be identified to judge whether the response data comprises abnormal key characters or not, and further judge whether the response data is abnormal data or not. If the response data includes an abnormal key character, it may be determined as abnormal data; if the response data does not include the abnormal key character, it may be determined not to be abnormal data.
It should be noted that for some scenarios, it is also generally necessary to specifically locate and determine the abnormal problem in the test according to the position where the abnormal data appears in the log. For example, for js blocking, it is necessary to quickly locate the exception based on the previous and subsequent data of the exception data in the log file. Therefore, in the step, after the abnormal data in the log file is identified, the position identifier of the abnormal data in the log file can be obtained, and the abnormal data and the position identifier of the abnormal data are stored, so that the subsequent abnormal quick positioning is facilitated.
In the embodiment of the invention, the operation behavior of the user can be recorded through the js probe, namely, the operation data of the user is collected. The unique identifier may be specifically a user identifier, or may also be a unique key allocated to the user, and the operation data corresponding to the user may be acquired from the cache based on the unique key. The in-test exception problem may include a front-end exception (e.g., js block, link jump exception, etc.), a back-end exception (e.g., interface exception), a network exception, and so on. In the embodiment of the invention, the recognized abnormal data can be thrown out through the window.
S103: and receiving an abnormal data viewing request, acquiring the unique identifier in the abnormal data viewing request, inquiring abnormal data corresponding to the unique identifier and returning.
After the user operates the test program, the server can store abnormal data in the test. The user may view the anomalous data through an anomalous data viewing request. In this step, the abnormal data viewing request may be sent by the user through the client, where the unique identifier of the user is included, and then the abnormal data corresponding to the user may be queried based on the unique identifier and returned, so that the abnormal data may be displayed through the client.
Specifically, in the embodiment of the present invention, a control for a user to check the abnormal data may be set in the client, and the user may implement sending the abnormal data check request by operating the control, so that checking of the abnormal data may be implemented simply and quickly.
In the embodiment of the invention, when the test program is tested, the operation data of the test program can be collected, the log file is generated by combining the distributed unique identifier, and the log file can be identified to obtain the abnormal data in the log file.
In the embodiment of the present invention, a preview two-dimensional code generation method is described by taking an applet as an example. The preview two-dimensional code generation mode can be developed based on a preset development framework, for example, a node + koa2 development framework can be used. An interface for preview two-dimensional code generation may be generated based on the incoming frame, such that the preview two-dimensional code is generated by calling the interface.
Specifically, in the embodiment of the present invention, four interfaces, that is, open, logic, preview, and build, may be generated in advance as an example. After receiving the program test request, calling an open interface to open the item in the specified path based on the program test request and a preset project URL parameter, that is, opening the item corresponding to the test program in the test environment, entering the item directory through the shell, and opening a command start tool; then a login method is called to determine if the user is already logged in. If the user logs in, the corresponding HTTP service port number is stored in the user file corresponding to the user in the server, so that whether the user logs in is judged by judging whether the HTTP service port number is included in the user file. If the user does not complete login, the user file does not include the HTTP service port number, and at the moment, the server needs to return a login prompt to prompt the user to log in; if the user logs in, the corresponding HTTP service port number of the user can be obtained. After the user is confirmed to log in, a build method can be called based on the HTTP service port number to package files corresponding to the test program in the test environment, the packaged files are returned, and then a preview method is called to generate a preview two-dimensional code based on the packaged files.
Specifically, in the embodiment of the present invention, the preview two-dimensional code may be generated by a generation server for generating the preview two-dimensional code, so in the embodiment of the present invention, the step of generating the preview two-dimensional code may further be executed as: and calling a two-dimension code generation interface, sending a preview two-dimension code generation request of the test program in the test environment to a two-dimension code generation server, and further receiving a preview two-dimension code returned by the two-dimension code generation server, wherein the two-dimension code generation interface is generated based on a preset development framework. The preview two-dimensional code generation request may include an identifier of the test program and an identifier of the test environment.
It should be noted that although the preview two-dimensional code needs to be temporarily generated during the test due to the file update of the test program, since the file update frequency is not necessarily fast, the preview two-dimensional code generated each time can be reused within a certain time, so that in the embodiment of the present invention, a time length threshold may be set, so that the generated preview two-dimensional code can be reused within a preset time length threshold.
Therefore, the following specifically describes the step of generating and displaying the preset two-dimensional code in step S101 in the embodiment of the present invention with reference to the embodiment shown in fig. 1. As shown in fig. 2, the method includes:
s201: and inquiring the generation duration of the historical preview two-dimensional code of the test program in the test environment to judge whether the generation duration is greater than a preset duration threshold.
After receiving the program test request, whether the history preview two-dimensional code of the test program under the test environment is stored or not can be inquired based on the identifier of the test program and the identifier of the test environment. If the history preview two-dimensional code is stored, the generation time of the history preview two-dimensional code can be inquired, namely how long the history preview two-dimensional code is generated, and then the generation time is compared with a preset time threshold value to judge whether the generation time is greater than the preset time threshold value or not; if the test program history preview two-dimensional code under the test environment is not stored, the process of generating the preview two-dimensional code of the test program under the test environment and displaying the preview two-dimensional code can be directly executed.
S202: if so, generating a preview two-dimensional code of the test program in the test environment, and displaying the preview two-dimensional code; and if not, displaying the history preview two-dimensional code.
If the generation duration is longer than the preset duration threshold, the generation time of the historical preview two-dimensional code is too long, the historical preview two-dimensional code cannot be reused, and the historical preview two-dimensional code needs to be regenerated.
If the generation duration is not greater than the preset duration threshold, the generation time of the history preview two-dimensional code is short, and the history preview two-dimensional code can be reused, so that the history preview two-dimensional code can be determined to be the preview two-dimensional code required by the user test in the step and is directly displayed, namely the history preview two-dimensional code is displayed.
In the embodiment of the invention, the preview two-dimensional code can be repeatedly used in a short time by presetting the time length threshold, and the preview two-dimensional code does not need to be repeatedly generated in a short time, so that the operation required to be executed in the test is reduced, the process is simplified, and the test time is saved.
In the embodiment of the invention, the test of the program is usually executed in the linux environment, but the test of the test program also needs different test environments, so that the docker container can be created in the linux environment, and then the wire image is created based on the docker container, so as to run different test environments through the wire image, thereby realizing the test of the test program in different test environments in the linux environment. The file of the test program can be uploaded to the bastion machine through an uploading command, so that the bastion machine can be accessed through the configured agent during program test, and the test of the test program is realized.
The uploading process of the test program may be performed as: and executing an mkdir-p command to create a folder, then executing an rm-f dist/. multidot command to delete all files in the dist under the file (if the deletion step is not needed in the first uploading process), and then proceeding to the disc file directory (cd/dist) to execute a begin upload distzip command.
In order to solve the problems in the prior art, an embodiment of the present invention provides an apparatus 300 for program testing, as shown in fig. 3, the apparatus 300 includes:
a generating unit 301, configured to receive a program test request, acquire an identifier of a test program and an identifier of a test environment in the program test request, to generate a preview two-dimensional code of the test program in the test environment, and display the preview two-dimensional code;
the testing unit 302 is configured to, after it is monitored that a user enters the testing environment through the preview two-dimensional code, allocate a unique identifier to the user, collect operation data of the user on the testing program, generate a log file in combination with the unique identifier, and further identify and store abnormal data in the log file;
the checking unit 303 is configured to receive an abnormal data checking request, acquire a unique identifier in the abnormal data checking request, query the abnormal data corresponding to the unique identifier, and return the abnormal data.
It should be understood that the manner of implementing the embodiment of the present invention is the same as the manner of implementing the embodiment shown in fig. 1, and the description thereof is omitted.
In an implementation manner of the embodiment of the present invention, the test unit 302 is specifically configured to:
monitoring response data corresponding to a target event based on the log file, and identifying the response data to judge whether the response data comprises abnormal key characters;
if yes, determining the response data as abnormal data; if not, determining that the response data is not abnormal data.
In another implementation manner of the embodiment of the present invention, the test unit 302 is specifically configured to:
identifying abnormal data in the log file, and acquiring a position identifier of the abnormal data in the log file;
and storing the abnormal data and the position identification of the abnormal data.
In another implementation manner of the embodiment of the present invention, the generating unit 301 is specifically configured to:
inquiring the generation duration of the historical preview two-dimensional code of the test program in the test environment to judge whether the generation duration is greater than a preset duration threshold value;
if so, generating a preview two-dimensional code of the test program under the test environment, and displaying the preview two-dimensional code; and if not, displaying the history preview two-dimensional code.
In another implementation manner of the embodiment of the present invention, the generating unit 301 is specifically configured to:
calling a two-dimension code generation interface, sending a preview two-dimension code generation request of the test program in the test environment to a two-dimension code generation server, and further receiving a preview two-dimension code returned by the two-dimension code generation server, wherein the two-dimension code generation interface is generated based on a preset development framework.
In another implementation manner of the embodiment of the present invention, the apparatus 300 further includes:
the method comprises the steps of creating a docker container in a linux environment, and creating a wire mirror image based on the docker container so as to run the test environment through the wire mirror image. .
It should be understood that the manner of implementing the embodiment of the present invention is the same as the manner of implementing the embodiment shown in fig. 2, and the description thereof is omitted.
When the test program is tested, the operation data of the test program can be collected, the log file is generated by combining the distributed unique identification, and then the log file can be identified to obtain the abnormal data in the log file.
According to an embodiment of the present invention, an electronic device and a readable storage medium are also provided.
The electronic device of the embodiment of the invention comprises: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the processor, and the instructions are executed by the at least one processor to cause the at least one processor to execute the method for program testing provided by the embodiment of the invention.
Fig. 4 shows an exemplary system architecture 400 of a program testing method or apparatus to which embodiments of the invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 401, 402, 403 to interact with a server 405 over a network 404 to receive or send messages or the like. Various client applications may be installed on the terminal devices 401, 402, 403.
The terminal devices 401, 402, 403 may be, but are not limited to, smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 405 may be a server that provides various services, and the server may analyze and perform other processes on data such as a received program test request, and feed back a processing result (e.g., abnormal data — just an example) to the terminal device.
It should be noted that the method for program testing provided by the embodiment of the present invention is generally executed by the server 405, and accordingly, the apparatus for program testing is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, a block diagram of a computer system 500 suitable for use in implementing embodiments of the present invention is shown. The computer system illustrated in FIG. 5 is only an example and should not impose any limitations on the scope of use or functionality of embodiments of the invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 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 product 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 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
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 program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a unit, 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 units described in the embodiments of the present invention may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a generation unit, a test unit, and a viewing unit. Where the names of these units do not in some cases constitute a limitation of the unit itself, for example, a generating unit may also be described as a "unit that generates the function of the unit".
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 perform the method of program testing provided by the present invention.
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. A method of program testing, comprising:
receiving a program test request, acquiring an identifier of a test program and an identifier of a test environment in the program test request, generating a preview two-dimensional code of the test program in the test environment, and displaying the preview two-dimensional code;
after a user is monitored to enter the test environment through the preview two-dimensional code, a unique identifier is distributed to the user, operation data of the user on the test program are collected, a log file is generated by combining the unique identifier, and abnormal data in the log file are identified and stored;
and receiving an abnormal data viewing request, acquiring the unique identifier in the abnormal data viewing request, inquiring abnormal data corresponding to the unique identifier and returning.
2. The method of claim 1, wherein the identifying anomalous data in the log file comprises:
monitoring response data corresponding to a target event based on the log file, and identifying the response data to judge whether the response data comprises abnormal key characters;
if yes, determining the response data as abnormal data; if not, determining that the response data is not abnormal data.
3. The method of claim 1, wherein identifying and storing anomalous data in the log file comprises:
identifying abnormal data in the log file, and acquiring a position identifier of the abnormal data in the log file;
and storing the abnormal data and the position identification of the abnormal data.
4. The method of claim 1, wherein the generating a preview two-dimensional code of the test program in the test environment and displaying the preview two-dimensional code comprises:
inquiring the generation duration of the historical preview two-dimensional code of the test program in the test environment to judge whether the generation duration is greater than a preset duration threshold value;
if so, generating a preview two-dimensional code of the test program under the test environment, and displaying the preview two-dimensional code; and if not, displaying the history preview two-dimensional code.
5. The method of claim 1, wherein the generating the preview two-dimensional code of the test program in the test environment comprises:
calling a two-dimension code generation interface, sending a preview two-dimension code generation request of the test program in the test environment to a two-dimension code generation server, and further receiving a preview two-dimension code returned by the two-dimension code generation server, wherein the two-dimension code generation interface is generated based on a preset development framework.
6. The method of claim 1, wherein prior to receiving the user request, further comprising:
the method comprises the steps of creating a docker container in a linux environment, and creating a wire mirror image based on the docker container so as to run the test environment through the wire mirror image.
7. An apparatus for program testing, comprising:
the generating unit is used for receiving a program test request, acquiring an identifier of a test program and an identifier of a test environment in the program test request, generating a preview two-dimensional code of the test program in the test environment, and displaying the preview two-dimensional code;
the test unit is used for distributing a unique identifier for a user after the user is monitored to enter the test environment through the preview two-dimensional code, collecting operation data of the user on the test program, generating a log file by combining the unique identifier, and further identifying and storing abnormal data in the log file;
and the viewing unit is used for receiving the abnormal data viewing request, acquiring the unique identifier in the abnormal data viewing request, inquiring the abnormal data corresponding to the unique identifier and returning.
8. The device according to claim 7, characterized in that the test unit is specifically configured to:
monitoring response data corresponding to a target event based on the log file, and identifying the response data to judge whether the response data comprises abnormal key characters;
if yes, determining the response data as abnormal data; if not, determining that the response data is not abnormal data.
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-6.
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-6.
CN202110532383.7A 2021-05-17 2021-05-17 Program testing method and device, electronic equipment and storage medium Pending CN113138935A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110532383.7A CN113138935A (en) 2021-05-17 2021-05-17 Program testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110532383.7A CN113138935A (en) 2021-05-17 2021-05-17 Program testing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113138935A true CN113138935A (en) 2021-07-20

Family

ID=76817091

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110532383.7A Pending CN113138935A (en) 2021-05-17 2021-05-17 Program testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113138935A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116431122A (en) * 2023-03-07 2023-07-14 中电金信软件有限公司 Compiling method, displaying method and device for development effect and readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116431122A (en) * 2023-03-07 2023-07-14 中电金信软件有限公司 Compiling method, displaying method and device for development effect and readable storage medium
CN116431122B (en) * 2023-03-07 2024-05-07 中电金信软件有限公司 Compiling method and device for development effect and readable storage medium

Similar Documents

Publication Publication Date Title
CN108900776B (en) Method and apparatus for determining response time
CN108769214B (en) Method and apparatus for controlling edge computing device, and method and apparatus for updating data
CN107704360B (en) Monitoring data processing method, equipment, server and storage medium
CN106411721B (en) Instant messaging method, device and system
CN110224897B (en) Weak network testing method and device of application program, mobile device and storage medium
CN112583898A (en) Business process arranging method and device and readable medium
CN112311620A (en) Method, apparatus, electronic device and readable medium for diagnosing network
CN111274153A (en) Automatic testing method and device and electronic equipment
CN112835792A (en) Pressure testing system and method
CN113495820B (en) Anomaly information collecting and processing method and device and anomaly monitoring system
CN112463588A (en) Automatic test system and method, storage medium and computing equipment
CN112395187A (en) Test method, test system, computer device and storage medium
CN113792341A (en) Privacy compliance automation detection method, device, equipment and medium for application program
CN113138935A (en) Program testing method and device, electronic equipment and storage medium
CN110069406B (en) Automatic triggering TPC-DS test method and system
CN107315672B (en) Method and device for monitoring server
CN109873731B (en) Test method, device and system
CN109522202B (en) Software testing method and device
CN111190761A (en) Log output method and device, storage medium and electronic equipment
US20200028733A1 (en) Method and apparatus for processing information
CN113485864B (en) Abnormality detection, abnormality analysis method, abnormality detection device, abnormality analysis device, electronic apparatus, and storage medium
CN108933802B (en) Method and apparatus for monitoring operation
CN112948195B (en) Interface testing method, device, electronic equipment and storage medium
CN114020513A (en) Method and device for processing log information
CN114371866A (en) Version reconfiguration test method, device and equipment of service system

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