CN107807841B - Server simulation method, device, equipment and readable storage medium - Google Patents

Server simulation method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN107807841B
CN107807841B CN201710983499.6A CN201710983499A CN107807841B CN 107807841 B CN107807841 B CN 107807841B CN 201710983499 A CN201710983499 A CN 201710983499A CN 107807841 B CN107807841 B CN 107807841B
Authority
CN
China
Prior art keywords
server
application
execution code
simulation
parameters
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.)
Active
Application number
CN201710983499.6A
Other languages
Chinese (zh)
Other versions
CN107807841A (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.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN201710983499.6A priority Critical patent/CN107807841B/en
Publication of CN107807841A publication Critical patent/CN107807841A/en
Application granted granted Critical
Publication of CN107807841B publication Critical patent/CN107807841B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors

Abstract

The invention discloses a server simulation method, a device, equipment and a readable storage medium, wherein the server simulation method comprises the following steps: when a server simulation instruction is detected, acquiring a server configuration file of an application corresponding to the server simulation instruction; analyzing the server configuration file to obtain a feedback rule of the server to be simulated; and generating a corresponding target execution code statement based on the feedback rule so as to complete the simulation of the server. The invention solves the technical problems that in the prior art, the interface of the back-end server needs time to complete, so that the front-end service cannot be effectively displayed in time, and the development efficiency of the application is reduced.

Description

Server simulation method, device, equipment and readable storage medium
Technical Field
The present invention relates to the field of virtualization technologies, and in particular, to a server simulation method, apparatus, device, and readable storage medium.
Background
The existing software development process usually involves the butt joint with an external website data interface, the data exchange between a front-end system and a back-end system, and the like, that is, when application development is performed, a front-end service depends on a back-end service, and when the back-end service is not completed, the completion of a server interface can only be waited for, however, because the completion of the interface of the back-end server needs time, the front-end service cannot be effectively displayed in time, that is, time is wasted, and the development efficiency of the application is reduced.
Disclosure of Invention
The invention mainly aims to provide a server simulation method, a device, equipment and a readable storage medium, and aims to solve the technical problems that in the prior art, due to the fact that time is required for completing an interface of a back-end server, a front-end service cannot be effectively displayed in time, and the development efficiency of an application is reduced.
In order to achieve the above object, the present invention provides a server simulation method, including:
when a server simulation instruction is detected, acquiring a server configuration file of an application corresponding to the server simulation instruction;
analyzing the server configuration file to obtain a feedback rule of the server to be simulated;
and generating a corresponding target execution code statement based on the feedback rule so as to complete the simulation of the server.
Optionally, the step of parsing the server configuration file to obtain the feedback rule of the server to be simulated includes:
analyzing the server configuration file to obtain the application type, the application parameters and the execution flow of the application parameters of the application;
and acquiring a feedback rule of the server to be simulated based on the application type, the application parameters and the execution flow of the application parameters.
Optionally, the generating a corresponding target execution code statement based on the feedback rule to complete the server simulation step includes:
judging whether each initial execution code statement corresponding to the type application is prestored in a prestored execution code statement set;
and when each initial execution code statement corresponding to the type application is prestored, generating a corresponding target execution code statement based on each initial execution code statement and the feedback rule so as to complete server simulation.
Optionally, the generating a corresponding target execution code statement based on each initial execution code statement to complete the server simulation step includes:
acquiring each initial parameter in each initial execution code statement, and selecting each target application parameter matched with each initial parameter from application parameters;
and replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements so as to complete the simulation of the server.
Optionally, the step of replacing the target application parameter with the corresponding initial parameter to generate a corresponding target execution code statement to complete the server simulation includes:
replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements;
and sequencing and combining the target execution code statements based on the server configuration file to complete the server simulation.
Optionally, the step of performing sequencing combination on each target execution code statement based on the server configuration file to complete server simulation includes:
acquiring an application parameter type of an application based on the server configuration file;
and sequencing and combining the target execution code statements based on the application parameter types, performing block packaging processing on the sequenced and combined target execution code statements to obtain each partition, and taking the combination of all the partitions as a simulation server.
Optionally, the generating a corresponding target execution code statement based on the feedback rule to complete the server simulation step includes:
after the simulation of the server is completed, if a test instruction is detected, judging whether the simulated server returns target content corresponding to the test instruction or not;
and when the returned target content is detected, determining that the simulation of the server is successful.
Further, to achieve the above object, the present invention also provides a server simulation apparatus including: a memory, a processor, a communication bus, and a server simulation program stored on the memory,
the communication bus is used for realizing communication connection between the processor and the memory;
the processor is used for executing the server simulation program to realize the following steps:
when a server simulation instruction is detected, acquiring a server configuration file of an application corresponding to the server simulation instruction;
analyzing the server configuration file to obtain a feedback rule of the server to be simulated;
and generating a corresponding target execution code statement based on the feedback rule so as to complete the simulation of the server.
Optionally, the step of parsing the server configuration file to obtain the feedback rule of the server to be simulated includes:
analyzing the server configuration file to obtain the application type, the application parameters and the execution flow of the application parameters of the application;
and acquiring a feedback rule of the server to be simulated based on the application type, the application parameters and the execution flow of the application parameters.
Optionally, the generating a corresponding target execution code statement based on the feedback rule to complete the server simulation step includes:
judging whether each initial execution code statement corresponding to the type application is prestored in a prestored execution code statement set;
and when each initial execution code statement corresponding to the type application is prestored, generating a corresponding target execution code statement based on each initial execution code statement and the feedback rule so as to complete server simulation.
Optionally, the generating a corresponding target execution code statement based on each initial execution code statement to complete the server simulation step includes:
acquiring each initial parameter in each initial execution code statement, and selecting each target application parameter matched with each initial parameter from application parameters;
and replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements so as to complete the simulation of the server.
Optionally, the step of replacing the target application parameter with the corresponding initial parameter to generate a corresponding target execution code statement to complete the server simulation includes:
replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements;
and sequencing and combining the target execution code statements based on the server configuration file to complete the server simulation.
Optionally, the step of performing sequencing combination on each target execution code statement based on the server configuration file to complete server simulation includes:
acquiring an application parameter type of an application based on the server configuration file;
and sequencing and combining the target execution code statements based on the application parameter types, performing block packaging processing on the sequenced and combined target execution code statements to obtain each partition, and taking the combination of all the partitions as a simulation server.
Optionally, the generating a corresponding target execution code statement based on the feedback rule to complete the server simulation step includes:
after the simulation of the server is completed, if a test instruction is detected, judging whether the simulated server returns target content corresponding to the test instruction or not;
and when the returned target content is detected, determining that the simulation of the server is successful.
Further, to achieve the above object, the present invention also provides a readable storage medium storing one or more programs, the one or more programs being executable by one or more processors for:
when a server simulation instruction is detected, acquiring a server configuration file of an application corresponding to the server simulation instruction;
analyzing the server configuration file to obtain a feedback rule of the server to be simulated;
and generating a corresponding target execution code statement based on the feedback rule so as to complete the simulation of the server.
According to the method, when the server simulation instruction is detected, the server configuration file of the application corresponding to the server simulation instruction is obtained; analyzing the server configuration file to obtain a feedback rule of the server to be simulated; and generating a corresponding target execution code statement based on the feedback rule so as to complete the simulation of the server. In the application, server simulation can be realized, a server based on simulation realizes the function of the server, and the display of the front-end application service is realized without finishing the interface of a back-end server, namely, when the front-end application development is finished, a server simulation instruction is generated to obtain a server configuration file of an application corresponding to the server simulation instruction, the feedback rule of the server to be simulated is obtained based on the server configuration file, a target execution code statement is generated based on the feedback rule, the target execution code statement is orderly combined to finish the server simulation, and the function of the server can be finished based on the simulation, so that the technical problems that in the prior art, the front-end service cannot be effectively displayed in time and the development efficiency of the application is reduced due to the time required for finishing the interface of the back-end server are solved.
Drawings
FIG. 1 is a schematic flow chart of a server simulation method according to a first embodiment of the present invention;
FIG. 2 is a flowchart illustrating a server simulation method according to a second embodiment of the present invention;
FIG. 3 is a schematic diagram of an apparatus architecture of a hardware operating environment to which a method of an embodiment of the invention relates;
fig. 4 is a schematic diagram of a test report in the server simulation method of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In a first embodiment of the server simulation method according to the present invention, referring to fig. 1, the server simulation method includes:
step S10, when a server simulation instruction is detected, acquiring a server configuration file of an application corresponding to the server simulation instruction;
in the application, the simulation server replaces a back-end server to realize the display of the application service, so that the development efficiency is improved, wherein the display of the application service comprises the display of an application test result and the like.
It should be noted that, the server simulation process in the present application may be: the method includes acquiring a server configuration file or an interface file corresponding to an application, analyzing the configuration file or the interface file to generate a server and a server interface code in a simulation manner, and acquiring target data from a third-party website or acquiring target data from a simulation server itself based on the server and the server interface code generated in the simulation manner to realize a function of the server, as shown in fig. 4.
In addition, although the server simulation process is described in the present application by taking the application test as an example, the server simulation process in the present application is not limited to the application test.
In the application, a test instruction applied to a terminal is triggered by a user through clicking or touching, and when the test instruction applied to the terminal is detected, the terminal requests to acquire data based on the test instruction to acquire a corresponding test result, it should be noted that, because a corresponding entity server may not exist or an interface of the corresponding entity server is not completed, the data requested to be acquired by the terminal based on the test instruction cannot obtain return data within a preset time, where the return data includes a correct feedback result or an incorrect feedback result.
The server simulation systems communicate with each other, if the terminal does not detect the return data within the preset time, the terminal calls a pre-stored program segment to generate a server simulation instruction, where the program segment represents logic for generating the server simulation instruction when the return data is not detected within the preset time, and after the terminal generates the server simulation instruction, the terminal sends the server data simulation instruction to the server simulation system, where the server simulation system acquires a server configuration file of an application corresponding to the server simulation instruction when the server simulation instruction is detected.
It should be noted that the server configuration file of the application includes application parameters of the application, an execution flow of the application parameters, and a feedback rule of the server for the execution flow of the application, where the application parameters of different applications are different, for example, the application parameters of the WeChat include a login parameter, an address list parameter, and the parameters of the mail include a recipient parameter, a sender parameter, and the like.
Step S20, analyzing the server configuration file to obtain the feedback rule of the server to be simulated;
referring to fig. 2, the step of parsing the server configuration file to obtain the feedback rule of the server to be simulated includes:
step S21, analyzing the server configuration file to obtain the application type, application parameters and the execution flow of the application parameters of the application;
and analyzing the server configuration file to acquire the application type, the application parameters and the execution flow of the application parameters of the application, and after acquiring the application type, the application parameters and the execution flow of the application parameters of the application, acquiring a feedback or response rule of the server to the application execution flow.
Step S22, obtaining a feedback rule of the server to be simulated based on the application type, the application parameter, and the execution flow of the application parameter.
Based on the application type, the application parameters and the execution flow of the application parameters, a feedback or response rule of the server to be simulated for the corresponding application execution flow is selected from the pre-stored total rules, the feedback or response rule of the server to be simulated for the application execution flow is target data which should be obtained and fed back when the application execution flow is detected, or a target page which should be displayed, and the like, wherein before the target data is fed back to the terminal, the simulation server should generate the corresponding target data or obtain the corresponding target data from other websites or databases, specifically, the simulation server should generate the corresponding target data or obtain the corresponding target data from other websites or databases, and the feedback or response rule of the execution flow of the application parameters is included.
Step S30, based on the feedback rule, generating a corresponding target execution code statement to complete the simulation of the server;
it should be noted that, in the present application, the feedback or response rule for the application execution flow is pre-stored, and therefore, the essence of the simulation server is to generate the corresponding target execution code statement, when detecting the execution flow of the application parameter, the target execution code statement generates and feeds back data conforming to the response rule of the application execution flow, for describing the specific embodiment, the application test parameter includes an application login parameter, the execution process of the login parameter of the application comprises clicking, inputting and the like, the feedback or response rule of the server to the execution process of the application can be that when a first click command of the login parameter is detected, the prominently displayed input box is fed back for the user to input a login account number or a password, and thus, in the application, the simulation server needs to call a corresponding target execution code statement, and the target execution code statement generates the input box and feeds back the input box when the condition is met.
In addition, the feedback or response rule for the application execution flow may be that when it is detected that the user inputs the login account and the password, the corresponding third-party interface is fed back, and the third-party interface is obtained from another website, and the simulation server needs to obtain the third-party interface from another website and feed back the third-party interface based on the feedback or response rule of the login parameter when it is detected that the user inputs the login account and the password, so that in the simulation server, the corresponding target execution code sentence needs to be called or generated first to establish communication connection with another website or a database, and the corresponding third-party interface is obtained and fed back.
In the present application, when an execution flow of an application parameter is detected, a corresponding response rule stored in an application configuration file may be temporarily called based on the type of the execution flow of the application parameter, and a corresponding target execution code statement may be temporarily generated based on the response rule.
In the server simulation system according to the present invention, an execution code sentence generation tool is stored in advance, and execution code sentences in the execution code sentence generation tool can be classified according to application types, wherein the execution code sentences of the same application are classified according to application parameters of the application and an execution flow of the application parameters.
In the application, after each target execution code statement is obtained, the server is generated based on the target execution code statement, and particularly, each target execution code statement needs to be sequentially combined, and the application and the combination mode are different and are pre-stored in an application server configuration file.
According to the method, when the server simulation instruction is detected, the server configuration file of the application corresponding to the server simulation instruction is obtained; analyzing the server configuration file to obtain a feedback rule of the server to be simulated; and generating a corresponding target execution code statement based on the feedback rule so as to complete the simulation of the server. In the application, server simulation can be realized, a server based on simulation realizes the function of the server, and the display of the front-end application service is realized without finishing the interface of a back-end server, namely, when the front-end application development is finished, a server simulation instruction is generated to obtain a server configuration file of an application corresponding to the server simulation instruction, the feedback rule of the server to be simulated is obtained based on the server configuration file, a target execution code statement is generated based on the feedback rule, the target execution code statement is orderly combined to finish the server simulation, and the function of the server can be finished based on the simulation, so that the technical problems that in the prior art, the front-end service cannot be effectively displayed in time and the development efficiency of the application is reduced due to the time required for finishing the interface of the back-end server are solved.
Further, the present invention provides a second embodiment of the server simulation method, in the second embodiment, the generating a corresponding target execution code statement based on the feedback rule to complete the server simulation step includes:
judging whether each initial execution code statement corresponding to the type application is prestored in a prestored execution code statement set;
and when each initial execution code statement corresponding to the type application is prestored, generating a corresponding target execution code statement based on each initial execution code statement and the feedback rule so as to complete server simulation.
It should be noted that, in the server simulation system in the present application, an execution code statement generation tool is stored in advance, and execution code statements in the execution code statement generation tool can be classified according to application types, so in this embodiment, an application type is obtained, it is determined whether each initial execution code statement corresponding to the type application is prestored in a prestored execution code statement set, when each initial execution code statement corresponding to the type application is prestored, a corresponding target execution code statement is generated based on each initial execution code statement and the feedback rule, when each initial execution code statement corresponding to the type application is not stored in the prestored execution code statement set, each feedback rule is obtained to realize that similar code statements are selected from the prestored execution code statement set one by one, and carrying out automatic modification on similar code statements, wherein the automatic modification process comprises the following steps: and acquiring the matching parameters of the current application parameters in the similar code statements, and replacing the matching parameters in the similar code statements with the current application parameters.
In this embodiment, whether each initial execution code statement corresponding to the type application is prestored in a prestored execution code statement set is judged; and when each initial execution code statement corresponding to the type application is prestored, generating a corresponding target execution code statement based on each initial execution code statement and the feedback rule so as to complete server simulation. The embodiment accurately generates the target execution code statement and lays a foundation for the simulation of the server.
Further, the present invention provides a third embodiment of the server simulation method, in the third embodiment, the generating a corresponding target execution code statement based on each initial execution code statement to complete the server simulation step includes:
acquiring each initial parameter in each initial execution code statement, and selecting each target application parameter matched with each initial parameter from application parameters;
and replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements so as to complete the simulation of the server.
In this embodiment, when each initial execution code statement corresponding to the type application is prestored, each initial parameter of each initial execution code statement is obtained, an execution flow of the initial parameter corresponding to each initial execution code statement is obtained, each target application parameter matched with each initial parameter is selected from corresponding terminal application parameters, and the corresponding initial parameter is replaced by the target application parameter to generate a corresponding target execution code statement.
To illustrate by way of specific embodiments, when the application is a mail, each initial execution code statement corresponding to the mail is selected from a pre-stored execution code statement set based on the application type, i.e., the mail, since the parameters of the mail comprise the address of the sender, the address of the receiver, the attachment of the mail, the subject of the mail and the like, thus, the execution flow of the initial parameter corresponding to each initial execution code statement is obtained, for example, when the first initial execution code statement can check the sending instruction, and sending the mail to a receiver, wherein the terminal application may be different from the first initial execution code statement only in the address of the receiver, therefore, the address of the recipient in the first initial execution code statement is changed to the address corresponding to the terminal application mail, and the changed first initial execution code statement is used as the target execution code statement. Namely, the generation process of the target execution code statement may be: and replacing the parameters in the initial execution code statement with the corresponding parameters applied in the application so as to complete the simulation of the server.
In this embodiment, each initial parameter in each initial execution code statement is obtained, and each target application parameter matched with each initial parameter is selected from application parameters; and replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements so as to complete the simulation of the server. The embodiment accurately generates the target execution code statement and lays a foundation for the simulation of the server.
Further, the present invention provides a fourth embodiment of the server simulation method, in the fourth embodiment, the step of replacing the corresponding initial parameter with the target application parameter to generate a corresponding target execution code statement so as to complete the server simulation includes:
replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements;
and sequencing and combining the target execution code statements based on the server configuration file to complete the server simulation.
The step of sequencing and combining the target execution code statements based on the server configuration file to complete the server simulation comprises the following steps:
acquiring an application parameter type of an application based on the server configuration file;
and sequencing and combining the target execution code statements based on the application parameter types, performing block packaging processing on the sequenced and combined target execution code statements to obtain each partition, and taking the combination of all the partitions as a simulation server.
In this embodiment, after generating corresponding target execution code statements, an application server configuration file is called to obtain an arrangement rule of each target execution code statement, each target execution code statement is sequenced and combined based on the arrangement rule, and each target execution code statement after being sequenced and combined is subjected to block packaging processing to obtain each partition, where each partition is packaged and partitioned based on an application parameter type, and when all partitions are packaged, a server simulation is completed for describing a specific embodiment, where the sequencing and combining manner may be: and classifying the target execution code statements according to the application parameters, sequencing the target execution code statements according to the execution flow of the same application parameter when the target execution code statements corresponding to the same application parameter are the target execution code statements, and finishing the server simulation after finishing the sequencing combination of the target execution code statements.
In this embodiment, a corresponding target execution code statement is generated by replacing the corresponding initial parameter with the target application parameter; based on the server configuration file, sequencing and combining the target execution code statements to complete the server simulation, thereby laying a foundation for completely completing the simulation server.
Further, on the basis of the first embodiment of the server simulation method of the present invention, a fifth embodiment of the server simulation method is provided, in which the generating a corresponding target execution code statement based on the feedback rule to complete the server simulation step includes:
after the simulation of the server is completed, if a test instruction is detected, judging whether the simulated server returns target content corresponding to the test instruction or not;
and when the returned target content is detected, determining that the simulation of the server is successful.
In this embodiment, after the simulation of the server is completed, feedback information of the completed simulation is generated, and based on the feedback information, the terminal application generates a test instruction again, and then determines whether the simulated server returns target content corresponding to the test instruction; and when the returned target content is detected, determining that the simulation of the server is successful.
In this embodiment, after the simulation of the server is completed, if the test instruction is detected, it is determined whether the simulated server returns the target content corresponding to the test instruction; and when the returned target content is detected, determining that the simulation of the server is successful. Therefore, whether the server successfully simulates or not can be accurately judged.
The present invention also provides a server simulation apparatus, including:
the acquisition module is used for acquiring a server configuration file of an application corresponding to the server simulation instruction when the server simulation instruction is detected;
the analysis module is used for analyzing the server configuration file to obtain a feedback rule of the server to be simulated;
and the generating module is used for generating a corresponding target execution code statement based on the feedback rule so as to complete the simulation of the server.
Optionally, the parsing module includes:
the analysis submodule is used for analyzing the server configuration file to acquire the application type, the application parameters and the execution flow of the application parameters of the application;
and the obtaining submodule is used for obtaining the feedback rule of the server to be simulated based on the application type, the application parameters and the execution flow of the application parameters.
Optionally, the generating module includes:
the judging submodule is used for judging whether each initial execution code statement corresponding to the type application is prestored in a prestored execution code statement set;
and the generating submodule is used for generating corresponding target execution code statements based on each initial execution code statement and the feedback rule when each initial execution code statement corresponding to the type application is prestored so as to complete server simulation.
Optionally, the generating sub-module includes:
the acquiring unit is used for acquiring each initial parameter in each initial execution code statement and selecting each target application parameter matched with each initial parameter from the application parameters;
and the generating unit is used for replacing the corresponding initial parameters with the target application parameters and generating corresponding target execution code statements so as to complete the simulation of the server.
Optionally, the generating unit includes:
the generating subunit is used for replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements;
and the sequencing subunit is used for sequencing and combining the target execution code statements based on the server configuration file so as to complete server simulation.
Optionally, the sorting subunit includes:
the acquisition partition is used for acquiring the application parameter type of the application based on the server configuration file;
and the sequencing partition is used for sequencing and combining the target execution code statements based on the application parameter types, carrying out block packaging processing on the sequenced and combined target execution code statements to obtain each partition, and taking the combination of all the partitions as a simulation server.
Optionally, the generating module includes:
the detection module is used for judging whether the simulated server returns the target content corresponding to the test instruction or not if the test instruction is detected after the simulation of the server is finished;
and the determining module is used for determining that the simulation of the server is successful when the returned target content is detected.
Further, the server simulation apparatus further includes:
the first judgment module is used for judging whether the simulated server returns the target content corresponding to the test instruction or not when the test instruction is detected after the simulation of the server is finished;
and the second judging module is used for determining that the simulation of the server is successful when the returned target content is detected.
Referring to fig. 3, fig. 3 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present invention.
The server simulation device in the embodiment of the present invention may be a PC, or may be a terminal device such as a smart phone, a tablet computer, an electronic book reader, an MP3(Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3) player, an MP4(Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 3) player, a portable computer, or the like.
As shown in fig. 3, the server simulation apparatus may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used for realizing connection communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a memory device separate from the processor 1001 described above.
Optionally, the server simulation device may further include a user interface, a network interface, a camera, RF (radio frequency) circuitry, a sensor, audio circuitry, a WiFi module, and so on. The user interface may comprise a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface may also comprise a standard wired interface, a wireless interface. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface).
Those skilled in the art will appreciate that the server simulation device configuration shown in FIG. 3 does not constitute a limitation of server simulation devices, and may include more or fewer components than those shown, or some components in combination, or a different arrangement of components.
As shown in fig. 3, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, and a server simulation program. The operating system is a program that manages and controls the hardware and software resources of the server simulation device, supporting the operation of the server simulation program as well as other software and/or programs. The network communication module is used to implement communication between the components within the memory 1005 and with other hardware and software in the server simulation device.
In the server simulation apparatus shown in fig. 3, the processor 1001 is configured to execute a server simulation program stored in the memory 1005, and implement the following steps:
when a server simulation instruction is detected, acquiring a server configuration file of an application corresponding to the server simulation instruction;
analyzing the server configuration file to obtain a feedback rule of the server to be simulated;
and generating a corresponding target execution code statement based on the feedback rule so as to complete the simulation of the server.
Further, the step of analyzing the server configuration file to obtain the feedback rule of the server to be simulated includes:
analyzing the server configuration file to obtain the application type, the application parameters and the execution flow of the application parameters of the application;
and acquiring a feedback rule of the server to be simulated based on the application type, the application parameters and the execution flow of the application parameters.
Further, the step of generating a corresponding target execution code statement based on the feedback rule to complete the server simulation includes:
judging whether each initial execution code statement corresponding to the type application is prestored in a prestored execution code statement set;
and when each initial execution code statement corresponding to the type application is prestored, generating a corresponding target execution code statement based on each initial execution code statement and the feedback rule so as to complete server simulation.
Further, the step of generating corresponding target execution code statements based on the initial execution code statements to complete the server simulation includes:
acquiring each initial parameter in each initial execution code statement, and selecting each target application parameter matched with each initial parameter from application parameters;
and replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements so as to complete the simulation of the server.
Further, the step of replacing the target application parameters with the corresponding initial parameters to generate corresponding target execution code statements to complete the simulation of the server includes:
replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements;
and sequencing and combining the target execution code statements based on the server configuration file to complete the server simulation.
Further, the step of ordering and combining the target execution code statements based on the server configuration file to complete the server simulation includes:
acquiring an application parameter type of an application based on the server configuration file;
and sequencing and combining the target execution code statements based on the application parameter types, performing block packaging processing on the sequenced and combined target execution code statements to obtain each partition, and taking the combination of all the partitions as a simulation server.
Further, the generating a corresponding target execution code statement based on the feedback rule to complete the server simulation step includes:
after the simulation of the server is completed, if a test instruction is detected, judging whether the simulated server returns target content corresponding to the test instruction or not;
and when the returned target content is detected, determining that the simulation of the server is successful.
The specific implementation of the server simulation device of the present invention is substantially the same as that of the above embodiments of the server simulation method, and will not be described herein again.
The present invention provides a readable storage medium storing one or more programs, the one or more programs being further executable by one or more processors for implementing the steps of the server simulation method of any of the above.
The specific implementation of the readable storage medium of the present invention is substantially the same as that of the above embodiments of the server simulation method, and is not described herein again.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (9)

1. A server simulation method, characterized in that the server simulation method comprises:
when a server simulation instruction is detected, acquiring a server configuration file of an application corresponding to the server simulation instruction;
analyzing the server configuration file to obtain the application type, the application parameters and the execution flow of the application parameters of the application;
acquiring a feedback rule of the server to be simulated based on the application type, the application parameters and the execution flow of the application parameters;
based on the feedback rules, judging whether each initial execution code statement corresponding to the type application is prestored in a prestored execution code statement set, and when each initial execution code statement corresponding to the type application is not stored in the prestored execution code statement set, acquiring each feedback rule to realize that similar code statements of the initial execution code statements are selected one by one from the prestored execution code statement set, and carrying out automatic modification on the similar code statements, wherein the automatic modification process is as follows: and acquiring the matching parameters of the current application parameters in the similar code statements, and replacing the matching parameters in the similar code statements with the current application parameters.
2. The server simulation method according to claim 1, wherein after the step of determining whether each initial execution code statement corresponding to the type application is prestored in the prestored execution code statement set based on the feedback rule, the method includes:
and when each initial execution code statement corresponding to the type application is prestored, generating a corresponding target execution code statement based on each initial execution code statement and the feedback rule so as to complete server simulation.
3. The server simulation method of claim 2, wherein the step of generating corresponding target execution code statements based on the respective initial execution code statements and the feedback rules to complete the server simulation comprises:
acquiring each initial parameter in each initial execution code statement, and selecting each target application parameter matched with each initial parameter from application parameters;
and replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements so as to complete the simulation of the server.
4. The server simulation method of claim 3, wherein the step of replacing the corresponding initial parameter with the target application parameter to generate a corresponding target execution code statement to complete the server simulation comprises:
replacing the corresponding initial parameters with the target application parameters to generate corresponding target execution code statements;
and sequencing and combining the target execution code statements based on the server configuration file to complete the server simulation.
5. The server simulation method of claim 4, wherein the step of ordering and combining the target execution code statements to complete the server simulation based on the server configuration file comprises:
acquiring an application parameter type of an application based on the server configuration file;
and sequencing and combining the target execution code statements based on the application parameter types, performing block packaging processing on the sequenced and combined target execution code statements to obtain each partition, and taking the combination of all the partitions as a simulation server.
6. The server simulation method of any of claims 2-5, wherein the step of generating a corresponding target execution code statement based on the respective initial execution code statement and the feedback rule to complete the server simulation is followed by:
after the simulation of the server is completed, if a test instruction is detected, judging whether the simulated server returns target content corresponding to the test instruction or not;
and when the returned target content is detected, determining that the simulation of the server is successful.
7. A server simulation apparatus, characterized in that the server simulation apparatus comprises:
the acquisition module is used for acquiring a server configuration file of an application corresponding to the server simulation instruction when the server simulation instruction is detected;
the analysis module is used for analyzing the server configuration file to acquire the application type, the application parameters and the execution flow of the application parameters of the application, and acquiring the feedback rule of the server to be simulated based on the application type, the application parameters and the execution flow of the application parameters;
a generating module, configured to determine, based on the feedback rules, whether each initial execution code statement corresponding to the type application is prestored in a prestored execution code statement set, and when each initial execution code statement corresponding to the type application is not stored in the prestored execution code statement set, obtain each feedback rule to select similar code statements of the initial execution code statements one by one from the prestored execution code statement set, and perform automatic modification on the similar code statements, where the automatic modification process is as follows: and acquiring the matching parameters of the current application parameters in the similar code statements, and replacing the matching parameters in the similar code statements with the current application parameters.
8. A server simulation apparatus, characterized in that the server simulation apparatus comprises: a memory, a processor, a communication bus, and a server simulation program stored on the memory,
the communication bus is used for realizing communication connection between the processor and the memory;
the processor is configured to execute the server simulation program to implement the steps of the server simulation method according to any of claims 1 to 6.
9. A readable storage medium, having stored thereon a server simulation program which, when executed by a processor, carries out the steps of the server simulation method according to any one of claims 1 to 6.
CN201710983499.6A 2017-10-18 2017-10-18 Server simulation method, device, equipment and readable storage medium Active CN107807841B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710983499.6A CN107807841B (en) 2017-10-18 2017-10-18 Server simulation method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710983499.6A CN107807841B (en) 2017-10-18 2017-10-18 Server simulation method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN107807841A CN107807841A (en) 2018-03-16
CN107807841B true CN107807841B (en) 2020-10-09

Family

ID=61592261

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710983499.6A Active CN107807841B (en) 2017-10-18 2017-10-18 Server simulation method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN107807841B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109726108B (en) * 2018-06-04 2023-09-22 成都美满科技有限责任公司 Front-end code testing method, device, system and medium based on analog data
CN109388425B (en) * 2018-08-17 2021-08-31 东莞数汇大数据有限公司 Interface switching method, system, device and storage medium for front-end engineering
CN111159039A (en) * 2019-12-30 2020-05-15 中信百信银行股份有限公司 Service simulation method, system, device and storage medium
CN111715738B (en) * 2020-06-18 2022-03-25 深圳市汇川技术股份有限公司 Shaft action configuration method, device, equipment and computer readable storage medium
CN113535260B (en) * 2021-06-29 2022-11-04 未鲲(上海)科技服务有限公司 Simulator-based data processing method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103580937A (en) * 2012-07-24 2014-02-12 阿里巴巴集团控股有限公司 Web service simulating method and system and service agent system thereof
CN106250315A (en) * 2016-08-04 2016-12-21 上海携程商务有限公司 A kind of automatic imitation request-reply system and method for configurableization
CN106560797A (en) * 2016-08-24 2017-04-12 北京安天电子设备有限公司 Debugger-based unit testing system and method
WO2017130087A1 (en) * 2016-01-25 2017-08-03 Typemock Ltd. Methods and systems for isolating software components

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103580937A (en) * 2012-07-24 2014-02-12 阿里巴巴集团控股有限公司 Web service simulating method and system and service agent system thereof
WO2017130087A1 (en) * 2016-01-25 2017-08-03 Typemock Ltd. Methods and systems for isolating software components
CN106250315A (en) * 2016-08-04 2016-12-21 上海携程商务有限公司 A kind of automatic imitation request-reply system and method for configurableization
CN106560797A (en) * 2016-08-24 2017-04-12 北京安天电子设备有限公司 Debugger-based unit testing system and method

Also Published As

Publication number Publication date
CN107807841A (en) 2018-03-16

Similar Documents

Publication Publication Date Title
CN107807841B (en) Server simulation method, device, equipment and readable storage medium
CN109542399B (en) Software development method and device, terminal equipment and computer readable storage medium
CN108984388B (en) Method and terminal equipment for generating automatic test case
CN108345543B (en) Data processing method, device, equipment and storage medium
CN111078539B (en) Test method, device, system and computer readable storage medium
CN105302710A (en) Method and apparatus for determining test case in need of regression testing
CN109901881B (en) Plug-in loading method and device of application program, computer equipment and storage medium
CN110320378B (en) Method, apparatus, device and computer readable storage medium for applying for a quality control test
CN114036439A (en) Website building method, device, medium and electronic equipment
CN110209557B (en) User operation recording and restoring method, device and equipment and readable storage medium
CN107102937B (en) User interface testing method and device
CN113821433A (en) Method, device, equipment, medium and product for testing cloud mobile phone application program
CN110717315B (en) System data batch modification method and device, storage medium and electronic equipment
CN117370162A (en) Test tool management method, device, equipment and storage medium
CN112650689A (en) Test method, test device, electronic equipment and storage medium
CN106302011A (en) Method of testings based on multiterminal and terminal
CN107864038B (en) Certificate management method, device, equipment and computer readable storage medium
WO2015039585A1 (en) Method and device for testing software reliability
CN111813407B (en) Game development method, game running device and electronic equipment
RU2595763C2 (en) Method and apparatus for managing load on basis of android browser
CN110532186B (en) Method, device, electronic equipment and storage medium for testing by using verification code
CN109684191B (en) Application package construction method, device and equipment and readable storage medium
US9497253B2 (en) Authorization review system
KR20220003625A (en) Performance detection method, apparatus, electronic device, computer readable medium and computer program product
CN113626301A (en) Method and device for generating test script

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