CN116795670A - Software testing method and device, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN116795670A
CN116795670A CN202210264792.8A CN202210264792A CN116795670A CN 116795670 A CN116795670 A CN 116795670A CN 202210264792 A CN202210264792 A CN 202210264792A CN 116795670 A CN116795670 A CN 116795670A
Authority
CN
China
Prior art keywords
test
target
instruction
software
packet
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
CN202210264792.8A
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210264792.8A priority Critical patent/CN116795670A/en
Publication of CN116795670A publication Critical patent/CN116795670A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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
    • G06F9/45558Hypervisor-specific management and integration aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • 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
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances

Landscapes

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

Abstract

The application relates to the technical field of software testing, in particular to a software testing method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: responding to the software test request, generating a target test instruction and calling a target virtual client; controlling the target virtual client to send a behavior data test packet to a server based on the target test instruction; the server processes the behavior data test packet through a target service program to obtain a data return packet; the behavior data test packet is generated for the target virtual client based on the target test instruction; and determining a software test result of the target service program based on the data packet sent by the server. The application can improve the test efficiency of the target service program.

Description

Software testing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of software testing technologies, and in particular, to a software testing method, a device, an electronic apparatus, and a storage medium.
Background
In the software development process, after the development of the server program is completed, whether the server program is normal or not needs to be verified, and whether the performance meets the standard or not needs to be verified.
In the prior art, a test script can be generally written by a server development engineer, and a simple server performance test is performed by using an existing pressure testing tool, so that a corresponding test frame is required to be built, the test efficiency is low, and the coupling degree of a test code and a server engineering code is high.
Disclosure of Invention
The application aims to solve the technical problem of providing a software testing method, a device, electronic equipment and a storage medium, which can improve the testing efficiency of a server program and reduce the coupling between a testing code and a server program code.
In order to solve the above technical problems, in one aspect, an embodiment of the present application provides a software testing method, including:
responding to the software test request, generating a target test instruction and calling a target virtual client;
controlling the target virtual client to send a behavior data test packet to a server based on the target test instruction; the server processes the behavior data test packet through a target service program to obtain a data return packet; the behavior data test packet is generated for the target virtual client based on the target test instruction;
and determining a software test result of the target service program based on the data packet sent by the server.
In another aspect, an embodiment of the present application provides a software testing apparatus, including:
the software test request response module is used for responding to the software test request, generating a target test instruction and calling a target virtual client;
the behavior data test packet sending module is used for controlling the target virtual client to send a behavior data test packet to a server based on the target test instruction; the server processes the behavior data test packet through a target service program to obtain a data return packet; the behavior data test packet is generated for the target virtual client based on the target test instruction;
and the test result determining module is used for determining a software test result of the target service program based on the data packet sent by the server.
In another aspect, the present application provides an apparatus comprising a processor and a memory having stored therein at least one instruction or at least one program loaded and executed by the processor to implement a software testing method as described above.
In another aspect, the present application provides a computer storage medium having at least one instruction or at least one program stored therein, the at least one instruction or the at least one program loaded by a processor and executed by a software testing method as described above.
The embodiment of the application has the following beneficial effects:
according to the method, the corresponding target test instruction is generated and the target virtual client is called by responding to the software test request, and the called target virtual client can be the communication client corresponding to the server; controlling a target virtual client to send a behavior data test packet to a server based on a target test instruction, and processing the behavior data test packet by the server through a target service program to obtain a data return packet; the behavior data test packet is generated for the target virtual client based on the target test instruction; and determining a software test result of the target service program based on the data packet. In the process of testing the target service program, the communication between the real client and the server is simulated by controlling the communication between the virtual client and the server, and corresponding software test results are determined according to the data packet returned by the server, so that the decoupling between the virtual client and the server is realized, the test efficiency of the target service program is improved, and the accuracy of the software test results is improved.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the application, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic illustration of an implementation environment provided by an embodiment of the present application;
FIG. 2 is a flowchart of a software testing method according to an embodiment of the present application;
FIG. 3 is a flowchart of a software test request processing method according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for generating a target test instruction according to an embodiment of the present application;
FIG. 5 is a flowchart of another method for generating target test instructions according to an embodiment of the present application;
FIG. 6 is a flowchart of another software testing method provided by an embodiment of the present application;
FIG. 7 is a flowchart of yet another software testing method provided by an embodiment of the present application;
FIG. 8 is a diagram of test patterns provided by an embodiment of the present application;
FIG. 9 is a test flow diagram of an interactive test scenario provided by an embodiment of the present application;
FIG. 10 is a test flow chart of a unit test scenario provided by an embodiment of the present application;
FIG. 11 is a test flow chart of a pressure test scenario provided by an embodiment of the present application;
FIG. 12 is a software testing apparatus according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the accompanying drawings, for the purpose of making the objects, technical solutions and advantages of the present application more apparent. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1, a schematic diagram of an implementation environment provided by an embodiment of the present application is shown, where the implementation environment may include: a test client 110 and a server 120, the test client 110 and the server 120 being in data communication over a network.
At least one virtual client may be set in the test client 110, where the virtual client is a client corresponding to the server 120, that is, the server 120 may process a request sent by the virtual client based on a server program, and return a corresponding processing result. When the server program needs to be tested, the virtual client in the test client can be started, and the test result of the target server program is determined based on the data communication result of the virtual client and the server.
The test Client 110 may communicate with the Server 120 based on Browser/Server (B/S) or Client/Server (C/S) mode. Test client 110 may include: smart phones, tablet computers, notebook computers, digital assistants, smart wearable devices, vehicle terminals, servers, etc. may also include software running in the physical devices, such as applications, etc. Operating systems running on test client 110 in embodiments of the present application may include, but are not limited to, android systems, IOS systems, linux, windows, and the like.
The server 120 and the test client 110 may establish a communication connection through a wire or wirelessly, and the server 120 may include a server that operates independently, or a distributed server, or a server cluster formed by a plurality of servers, where the server may be a cloud server.
In order to solve the problems of low testing efficiency and high code coupling degree of a server program in the prior art, the embodiment of the application provides a software testing method, and an execution main body of the method can be the testing client; referring to fig. 2, the method may include:
S210, responding to a software test request, generating a target test instruction and calling a target virtual client.
In the software development process, the development of the client program and the development of the server program can be parallel, and after the development of the server program is completed, whether the functions of the server program are normal or not needs to be verified, and whether the performances reach standards or not needs to be verified, so that the server program can be tested by using the client program corresponding to the server program. In some cases, the related functions of the client program corresponding to the server program may be complex, for example, the interface of the client program may be complex, so that the development progress is relatively slow, and if the server program is tested by using the developed client program, it takes a relatively long time to generate a stable version of the client program. Therefore, in the embodiment, the real client can be simulated to communicate with the server through the virtual client, the virtual client can be a simplified real client, some client programs with non-basic functions in the real client are simplified, and relevant client programs for realizing the basic functions of the client are reserved; the virtual client may have a client program that implements the basic function of the real client, and may not have a client program that implements the basic function of the real client, for example, the relevant program of the client program interface described above may be a client program that implements the basic function of the real client.
The test client can respond to a software test request, the software test request can be initiated by a tester or an automatic trigger program when the target service program needs to be tested, and in order to test the characteristics of different test dimensions of the target service program, the corresponding software test request can carry parameter information capable of representing the different test dimensions.
The target test instruction can be generated by filling relevant parameter information carried in the software test request into an instruction template, or can be obtained by converting information based on relevant parameters carried in the software test request. And calling the target virtual client to call the target virtual client required by the software testing process under the software testing scene.
Further, the calling of the target virtual client may include creation of the virtual client and virtual client calling, that is, when the target virtual client needs to be called, the target virtual client may be created in real time, and when the creation is completed, the target virtual client is called; i.e. on-demand creation of virtual clients is achieved.
The test client can manage the virtual client therein, and specifically can comprise operations such as creation of the virtual client, initialization of the virtual client, searching of the virtual client, destruction of the virtual client and the like; that is, the test client can determine the virtual client required in the current test scene based on the specific test scene, and call the required virtual client.
S220, controlling the target virtual client to send a behavior data test packet to a server based on the target test instruction; the server processes the behavior data test packet through a target service program to obtain a data return packet; and the behavior data test packet is generated for the target virtual client based on the target test instruction.
Under the condition that a target test instruction is generated, corresponding control operation can be carried out on the target virtual client based on the target test instruction; because the operation of the target virtual client needs to be based on the trigger instruction input by the outside, the target test instruction can comprise the trigger instruction input to the target virtual client, and the target virtual client can execute corresponding operation based on the trigger instruction to generate a corresponding behavior data test packet. The behavior data test packet may include behavior operation data generated after the target virtual client performs the corresponding operation according to the received trigger instruction.
The target service program in the application can be a service program stored in a server side, or can be a service program which is not stored in the server but can be called by the server; the target service program corresponds to the client program of the virtual client, and can process the data test packet sent by the virtual client to obtain a corresponding data return packet.
S230, determining a software test result of the target service program based on the data packet sent by the server.
According to different test scenes, the corresponding returned data return packet can comprise test data corresponding to corresponding test dimensions, the test data in the test return packet can be compared with preset data, and under the condition that the comparison of the test data and the preset data is consistent, the test result of the target service program in the corresponding test dimensions is determined to be passed; and under the condition that the comparison result of the test data and the preset data is inconsistent, determining that the test result of the target service program in the corresponding test dimension is not passed. And under the condition that the test result is not passed, the possible problems in the target service program can be reversely determined according to the test result in the data packet, the target service program is updated, and the test is performed again based on the updated target service program.
According to the method, the corresponding target test instruction is generated and the target virtual client is called by responding to the software test request, and the called target virtual client can be the communication client corresponding to the server; controlling a target virtual client to send a behavior data test packet to a server based on a target test instruction, and processing the behavior data test packet by the server through a target service program to obtain a data return packet; the behavior data test packet is generated for the target virtual client based on the target test instruction; and determining a software test result of the target service program based on the data packet. In the process of testing the target service program, the communication between the real client and the server is simulated by controlling the communication between the virtual client and the server, and the corresponding software test result is determined according to the data packet returned by the server, so that the decoupling between the virtual client and the server in the process of testing the service program is realized, the test efficiency of the target service program is improved, and the accuracy of the software test result is improved.
Further, in order to facilitate corresponding operations based on different software test requests, the software test requests may carry corresponding parameter information; specifically, the software test request comprises test execution information and a scene identifier of a test scene; the test execution information is associated with the test scenario; referring to fig. 3, a method for processing a software test request is shown, which may include:
s310, responding to the software test request, and generating the target test instruction based on the test execution information.
S320, calling the target virtual clients with target quantity; the target number is determined based on the scene identification.
The test execution information may be test auxiliary information in the test process; the test execution information can be determined according to different test scenes; thus, corresponding target test instructions can be generated based on the test execution information, and the target number of target virtual clients to be called is determined based on the scene identification.
Further, when generating the target test instruction based on the test execution information, determining a corresponding instruction template based on the scene identifier, and then filling the test execution information into the corresponding instruction template to obtain the target test instruction; or converting the test execution information to obtain a corresponding target test instruction.
In addition, when the target virtual clients are determined, the test clients can immediately establish the target number of virtual clients, so that the test work is executed based on the target number of target virtual clients; each virtual client can correspond to a preset program code, so that when a plurality of virtual clients need to be created, the creation of the plurality of virtual clients can be performed through code multiplexing, namely, the creation of the plurality of virtual clients is realized through code multiplexing, the code multiplexing rate is improved, and the creation efficiency of the virtual clients is improved. After the test is completed, the recovery of the target number of virtual clients can be realized, so that the system resources can be saved, and the long-term occupation of the memory resources can be avoided.
The test execution information is associated with a test scenario, and it can be understood that each type of test execution information corresponds to one type of test scenario. For example, the test scenarios may include an interactive test scenario, a unit test scenario, a stress test scenario, etc., each of which may correspond to different test execution information.
The application can generate corresponding target test instructions based on the test execution information in the software test request and the scene identification information of the test scene, and call the target virtual client, so that the call of the target test instructions and the virtual client is adapted to the test scene; further, the test execution information is associated with the test scene, and further when the software test request is generated, the relevance of the test execution information and the scene identification information can be judged, when the relevance of the test execution information and the scene identification information does not meet the preset condition, the corresponding software test request can be judged to be an illegal request, and the software test request is prompted to be reinitiated, so that the processing resource waste caused by processing the illegal software test request can be avoided, and the resource utilization efficiency is improved.
Specifically, the test execution information may be generated based on triggering a preset execution item, so that the test execution information may be an execution item identifier of the triggered preset execution item; accordingly, referring to FIG. 4, a method for generating a target test instruction is shown, which may include:
s410, determining a target execution item based on the execution item identification.
S420, acquiring a target execution instruction corresponding to the target execution item.
S430, generating the target test instruction based on the target execution instruction.
The preset execution items can be originally set execution operation items capable of realizing specific functions and triggerable, each preset execution item can correspond to an execution instruction, and the execution instruction corresponding to the preset execution item can be considered to be called after the preset execution item is triggered.
When the preset execution item is triggered, the corresponding execution item identification can be recorded, the corresponding target execution instruction is acquired based on the triggered execution item identification, and then the corresponding target test instruction is generated based on the target execution instruction. Under the condition that corresponding target test instructions are generated based on target execution instructions, when a plurality of preset execution items are triggered, the execution sequence of the execution instructions corresponding to the preset execution items in the target test instructions is determined based on the triggering sequence of the preset execution items, so that the execution sequence of the target test instructions is consistent with that of the test triggering instructions.
The target test instruction is generated by triggering a preset execution item, and can be used for testing the basic function of the server program; for example, in a scenario of testing the interactive functions of the client program and the server program, a plurality of different preset execution items may be triggered to generate target test instructions corresponding to different interactive functions, so that the interactive functions of the client program and the server program may be tested based on different target test instructions.
Therefore, the embodiment of the application can generate the corresponding target test instruction by directly triggering the preset execution item, namely, the automatic process from triggering the preset execution item to generating the target test instruction is realized, and the convenience and the efficiency of generating the target test instruction are realized.
In addition, the test execution information can be generated based on selection of the preset test cases, and the test execution information is the case identification information of the selected preset test cases, namely, in some test scenes, such as a unit test scene or a pressure test scene, the server program can be tested by combining with the related test cases; referring specifically to FIG. 5, another method for generating target test instructions is shown, which may include:
S510, determining a target test case based on the case identification.
S520, acquiring the target test case.
S530, generating the target test instruction based on the target test case.
When a software test request is initiated, a corresponding test case can be selected based on a test scene, the software test request can comprise a case identification of the selected test case according to the selection condition of the test case, a corresponding target test case can be determined based on the case identification, and then a target test instruction is generated based on the target test case.
The test cases can be used for testing specific functional programs of the server program, so that corresponding test cases can be determined according to the functions required to be tested.
In different test scenes, corresponding test cases can be selected according to the specific functions to be tested, and then corresponding target test instructions are generated based on the selected test cases, so that the convenience and the efficiency of generating the target test instructions can be improved; further, the test cases correspond to functions to be tested, so that the target test instructions generated based on the selected test cases also correspond to the functions to be tested, the adaptation of the functions to be tested and the target test instructions is realized, and the targeted software test is realized.
The target test instruction can specifically further comprise a target behavior instruction and a data transmission instruction; accordingly, referring to FIG. 6, another software testing method is shown, which may include:
s610, generating a target test instruction and calling a target virtual client in response to the software test request.
S620, sending the target test instruction to the target virtual client; the target test instruction is configured to instruct the target virtual client to: and executing the target behavior instruction, generating the behavior data test packet, executing the data transmission instruction, and transmitting the behavior data test packet to the server.
S630, determining a software test result of the target service program based on the data packet sent by the server.
Details of the implementation of step S610 and step S630 can be referred to above in this embodiment, and will not be described here again.
In addition, the target test instruction comprises a target behavior instruction and a data sending instruction, wherein the target behavior instruction can be a trigger instruction sent to the virtual client; the target virtual client can trigger a target button of the target virtual client to obtain corresponding behavior information by executing the target behavior instruction, or input the target information to the target virtual client, obtain the corresponding behavior information based on the input target information, and the like, and generate a corresponding behavior data test packet after the target behavior instruction is executed.
The target test instruction can comprise at least two types of instructions, namely a target behavior instruction and a data sending instruction, so that the target virtual client can execute corresponding operations based on the corresponding instructions in different test stages, and the test process of the target service program based on the target virtual client can be orderly carried out; further, after generating the behavior data test packet, the target virtual client may further execute a data transmission instruction to transmit the behavior data test packet to the server; here, when the target virtual client sends the behavior test data packet to the server, one embodiment may be: based on a communication protocol between the virtual client and the server, the target virtual client sends a behavior data test packet to the server, so that direct data interaction is realized; another embodiment may be: the target virtual client sends the behavior data test data packet to the communication module of the test client, and the communication module sends the behavior data test data packet to the server, so that the data processing pressure of the target virtual client can be reduced, and the sending efficiency of the behavior test data packet is improved.
Further, in the pressure test scene, the number of corresponding target virtual clients to be called is multiple, and the multiple target virtual clients are mutually independent and are not affected; referring specifically to fig. 7, yet another software testing method is shown, which may include:
S710, responding to the software test request, generating a target test instruction and calling a target virtual client.
S720, when the software test request corresponds to a multi-task test scene, creating target tasks corresponding to the target virtual clients when the number of the target virtual clients is multiple.
S730, when the target task is executed, the target test instruction is sent to a target virtual client corresponding to the target task; the target test instruction is used for indicating the target virtual client to execute the target test instruction respectively in a plurality of execution periods, generating a behavior data test packet corresponding to each of the execution periods, and sending the behavior data test packet generated in each execution period to the server in each execution period.
S740, determining a software test result of the target service program based on the data packet sent by the server.
The details of the implementation of step S710 and step S740 can be referred to above in this embodiment, and will not be described here again.
The multi-task scene can correspond to a pressure test scene, namely a test scene in which a plurality of tasks run simultaneously, and each task can correspond to one target virtual client, so that in the multi-task scene, the number of target virtual clients to be called is multiple, corresponding tasks are created for each target virtual client, and each task is independent and does not affect each other. In a specific test process, the test instructions executed by each task can be the same or different, and when the target test instruction is one, the test instructions executed by the corresponding multiple tasks are the same; when the number of target test instructions is the same as the number of the multiple tasks and the multiple target test instructions are different, the test instructions executed by the corresponding multiple tasks may be different, and when the number of target test instructions is less than the number of the multiple tasks and the number of target test instructions is greater than one, at least two tasks execute the same test instructions.
The corresponding task of each target virtual client can respectively execute corresponding target test instructions in a plurality of continuous execution periods, and corresponding behavior test data packets are generated in each execution period and sent to the server.
The method comprises the steps of simulating a scene that a plurality of clients communicate with a server at the same time by running tasks corresponding to a plurality of target virtual clients at the same time, and repeatedly executing target test instructions in a plurality of continuous execution periods for each task so as to realize pressure performance test on a target service program, so that a multi-task test scene is close to a real scene, and further, the accuracy of test results in the multi-task test scene can be improved.
In addition, in the unit test scenario, multiple target virtual clients may be invoked, each of which may execute a corresponding test case for a different unit, so that each of the target virtual clients may execute different target test instructions. The multiplexing of the virtual client program codes is realized in the unit test scene and the multitask test scene, so that the reusability of the codes is improved, and the verification test efficiency of the functions and the performances of the server program is improved.
Further, the target test instruction may be generated and the target virtual client invoked by responding to a software test request triggered based on a target test interface of a test simulator; the test simulator is generated based on a target framework adapted to the multi-type development platform. When the test client is a software program, the test client can be specifically a test simulator; when the test client is a terminal device, the test simulator may be a software program installed in the test client. The test simulator may have a target test interface that can be displayed and is convenient to operate, for example, the triggering of the preset execution item, and the selection of the target test case may be implemented based on the relevant functional area on the target test interface. The test simulator is generated based on a target framework adapting to multiple types of development platforms, so that the test simulator has the characteristic of cross-platform, and the universality of the test simulator is realized.
The following describes the implementation of the present application in a specific example, in which the virtual client may be a robot in particular, and the corresponding test simulator may comprise: UI interfaces, robot manager, scripting system, message processor, and data statistics module.
1) UI interface: the method mainly comprises the steps of receiving input of a user, and performing corresponding operation by the user according to a selected test mode as a visual graphical interface. The test simulator can run on a plurality of platform environments (Win, linux, mac) as a client program, and a Qt application development framework is selected for developing a UI interface in order to support the cross-platform characteristic. If under the Linux platform, the UI of the command line is supported.
2) Robot manager: the lifecycle of all robots is managed, including creation, initialization, lookup, destruction, etc.
3) Script system: the communication bridge of the C++ and the Lua script can execute the Lua script in the main thread, and can call the function or the object instance of the C++ in the Lua script; lua is a lightweight and compact scripting language.
4) Message processor: namely, the network data packet transceiver module comprises functions of filling data packets, sending the data packets, analyzing the data packets returned by the processing server and the like.
5) And a data statistics module: for statistically summarizing various data generated during the test.
When the test simulator is started, the 5 main modules can be initialized in sequence, and then user input of the UI interface is waited.
The test simulator can be used for testing three test scenes, the relation of the test modes corresponding to the three test scenes is shown in fig. 8, the virtual clients can be simulation robots, the number of the called virtual clients is one in the simulation robot mode, and the number of the called virtual clients is a plurality in the unit test scenes and the pressure test scenes.
1) Interactive test scene (simulation robot mode)
Referring to fig. 9, the test flow of the interactive test scenario may include:
s910, creating a virtual client from a robot manager.
And S920, the virtual client is connected with the server.
S930, sending an interaction protocol to the server.
S940, the message processor processes the packet.
S950, displaying the test result on a user interface.
2) Unit test scenario
Referring to fig. 10, the test flow of the unit test scenario may include:
s1010, loading the test cases by the script system and displaying the test cases on a user interface.
S1020, selecting test cases to be executed through a user interface.
S1030, executing the test case by the script system.
S1040, calling a robot manager, a message processor and a data statistics module to complete testing.
S1050, displaying the test result on a user interface.
S1060, judging whether the currently executed test case is the last test case or not; if yes, the test is ended, if not, step S1030 is executed.
3) Pressure test scenario
Referring to fig. 11, the test flow of the pressure test scenario may include:
s1110, loading the test cases by the script system and displaying the test cases on a user interface.
S1120, selecting test cases to be executed through a user interface, and configuring the number of virtual clients and the execution times.
S1130, according to the number of the virtual clients, the script system starts a target task consistent with the number of the virtual clients.
The target task may specifically be a created coroutine or thread, such that the number of coroutines is consistent with the number of virtual clients, or the number of threads is consistent with the number of virtual clients.
S1140, each cooperative program invokes the robot manager, the message processor and the data statistics module to complete the test, and each target task is executed for m times.
S1150, waiting for all target task tests to end.
S1160, displaying the test result on a user interface.
Therefore, in the development process of the project, a server developer rapidly realizes a corresponding test simulator according to corresponding business logic to finish the test of the server program under different test scenes, thereby improving the test efficiency of the server program and reducing the test cost. From the client perspective, the robot client is simulated, the behavior of the framework customized robot is provided, the robot is further assembled, and the robot is combined into a unit testing robot and a performance testing robot, so that the function verification, the unit testing and the performance testing of the server end can be completed in the development process. The whole process does not need any communication and cooperation cost, does not have code embedding risk, and can be tested by a server development engineer at any time.
Referring to fig. 12, the present embodiment further provides a software testing apparatus, including:
a software test request response module 1210, configured to generate a target test instruction and call a target virtual client in response to a software test request;
a behavioral data test packet sending module 1220, configured to control, based on the target test instruction, the target virtual client to send a behavioral data test packet to a server; the server processes the behavior data test packet through a target service program to obtain a data return packet; the behavior data test packet is generated for the target virtual client based on the target test instruction;
the test result determining module 1230 is configured to determine a software test result for the target service program based on the data packet sent by the server.
Further, the software test request comprises test execution information and a scene identifier of a test scene; the test execution information is associated with the test scenario;
the software test request response module 1210 includes:
the first generation module is used for responding to the software test request and generating the target test instruction based on the test execution information;
The calling module is used for calling the target virtual clients with the target number; the target number is determined based on the scene identification.
Further, when the test execution information is generated based on triggering of a preset execution item, the test execution information is an execution item identifier of the triggered preset execution item; the first generation module includes:
the target execution item determining module is used for determining a target execution item based on the execution item identification;
the target execution instruction acquisition module is used for acquiring a target execution instruction corresponding to the target execution item;
and the second generation module is used for generating the target test instruction based on the target execution instruction.
Further, when the test execution information is generated based on selection of a preset test case, the test execution information is a case identifier of the selected preset test case; the first generation module includes:
the target test case determining module is used for determining a target test case based on the case identification;
the target test case acquisition module is used for acquiring the target test case;
and the third generation module is used for generating the target test instruction based on the target test case.
Further, the target test instruction comprises a target behavior instruction and a data transmission instruction; the behavioral data test packet transmission module 1220 includes:
the first sending module is used for sending the target test instruction to the target virtual client; the target test instruction is configured to instruct the target virtual client to: and executing the target behavior instruction, generating the behavior data test packet, executing the data transmission instruction, and transmitting the behavior data test packet to the server.
Further, the behavioral data test packet transmission module 1220 includes:
the target task creation module is used for creating target tasks corresponding to the target virtual clients when the software test request corresponds to the multi-task test scene and the number of the called target virtual clients is multiple;
the second sending module is used for sending the target test instruction to a target virtual client corresponding to the target task when the target task is executed; the target test instruction is used for indicating the target virtual client to execute the target test instruction respectively in a plurality of execution periods, generating a behavior data test packet corresponding to each of the execution periods, and sending the behavior data test packet generated in each execution period to the server in each execution period.
Further, the software test request response module 1210 includes:
the trigger response module is used for responding to the software test request triggered by the target test interface based on the test simulator, generating the target test instruction and calling the target virtual client; the test simulator is generated based on a target framework adapted to the multi-type development platform.
The device provided in the above embodiment can execute the method provided in any embodiment of the present application, and has the corresponding functional modules and beneficial effects of executing the method. Technical details not described in detail in the above embodiments may be found in the methods provided by any of the embodiments of the present application.
The present embodiment also provides a computer readable storage medium having stored therein at least one instruction or at least one program, the at least one instruction or the at least one program loaded by a processor and executed by a method according to any of the above embodiments.
According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium and executes the computer instructions to cause the computer device to perform any of the methods described above.
Further, fig. 13 shows a schematic diagram of a hardware structure of an apparatus for implementing the method provided by the embodiment of the present application, where the apparatus may participate in forming or including the device provided by the embodiment of the present application. As shown in fig. 13, the apparatus 10 may include one or more processors 102 (shown as 102a, 102b, … …,102 n) which may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, the method may further include: a display, an input/output interface (I/O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of the I/O interface), a network interface, a power supply, and/or a camera. It will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 13 is merely illustrative and is not intended to limit the configuration of the electronic device described above. For example, the device 10 may also include more or fewer components than shown in fig. 13, or have a different configuration than shown in fig. 13.
It should be noted that the one or more processors 102 and/or other data processing circuits described above may be referred to generally herein as "data processing circuits. The data processing circuit may be embodied in whole or in part in software, hardware, firmware, or any other combination. Further, the data processing circuitry may be a single stand-alone processing module, or incorporated in whole or in part into any of the other elements in the device 10 (or mobile device). As referred to in embodiments of the application, the data processing circuit acts as a processor control (e.g., selection of the path of the variable resistor termination connected to the interface).
The memory 104 may be used to store software programs and modules of application software, and the processor 102 executes the software programs and modules stored in the memory 104 to perform various functional applications and data processing, i.e., to implement a player preloading method or a player operation method as described above, according to the program instructions/data storage device corresponding to the method in the embodiment of the present application. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory located remotely from processor 102, which may be connected to device 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means 106 is arranged to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communications provider of device 10. In one example, the transmission device 106 includes a network adapter (NetworkInterfaceController, NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a radio frequency (RadioFrequency, RF) module for communicating wirelessly with the internet.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the device 10 (or mobile device).
Any of the methods described above for this embodiment may be implemented based on the apparatus shown in fig. 13.
The present specification provides method operational steps as described in the examples or flowcharts, but may include more or fewer operational steps based on conventional or non-inventive labor. The steps and sequences recited in the embodiments are merely one manner of performing the sequence of steps and are not meant to be exclusive of the sequence of steps performed. In actual system or interrupt product execution, the methods illustrated in the embodiments or figures may be performed sequentially or in parallel (e.g., in the context of parallel processors or multi-threaded processing).
The structures shown in this embodiment are only partial structures related to the present application and do not constitute limitations of the apparatus to which the present application is applied, and a specific apparatus may include more or less components than those shown, or may combine some components, or may have different arrangements of components. It should be understood that the methods, apparatuses, etc. disclosed in the embodiments may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, and the division of the modules is merely a division of one logic function, and may be implemented in other manners, such as multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or unit modules.
Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-only memory (ROM), a random access memory (RAM, randomAccessMemory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A method of testing software, comprising:
responding to the software test request, generating a target test instruction and calling a target virtual client;
controlling the target virtual client to send a behavior data test packet to a server based on the target test instruction; the server processes the behavior data test packet through a target service program to obtain a data return packet; the behavior data test packet is generated for the target virtual client based on the target test instruction;
and determining a software test result of the target service program based on the data packet sent by the server.
2. The method of claim 1, wherein the software test request includes test execution information and a scenario identification of a test scenario; the test execution information is associated with the test scenario;
The responding to the software testing request, generating a target testing instruction and calling a target virtual client side, comprises the following steps:
responding to the software test request, and generating the target test instruction based on the test execution information;
invoking a target number of the target virtual clients; the target number is determined based on the scene identification.
3. The method of claim 2, wherein when the test execution information is generated based on triggering a preset execution item, the test execution information is an execution item identifier of the triggered preset execution item;
the generating the target test instruction based on the test execution information includes:
determining a target execution item based on the execution item identification;
acquiring a target execution instruction corresponding to the target execution item;
and generating the target test instruction based on the target execution instruction.
4. The method of claim 2, wherein when the test execution information is generated based on selection of a preset test case, the test execution information is a case identification of the selected preset test case;
the generating the target test instruction based on the test execution information includes:
Determining a target test case based on the case identification;
acquiring the target test case;
and generating the target test instruction based on the target test case.
5. The method of claim 1, wherein the target test instructions comprise target behavior instructions and data send instructions;
the controlling the target virtual client to send the behavior data test packet to the server based on the target test instruction includes:
sending the target test instruction to the target virtual client; the target test instruction is configured to instruct the target virtual client to: and executing the target behavior instruction, generating the behavior data test packet, executing the data transmission instruction, and transmitting the behavior data test packet to the server.
6. The method of claim 1, wherein controlling the target virtual client to send a behavior data test packet to a server based on the target test instruction comprises:
when the software test request corresponds to a multi-task test scene, creating target tasks corresponding to the target virtual clients when the number of the target virtual clients is multiple;
When the target task is executed, the target test instruction is sent to a target virtual client corresponding to the target task; the target test instruction is used for indicating the target virtual client to execute the target test instruction respectively in a plurality of execution periods, generating a behavior data test packet corresponding to each of the execution periods, and sending the behavior data test packet generated in each execution period to the server in each execution period.
7. The method of claim 1, wherein generating the target test instruction and invoking the target virtual client in response to the software test request comprises:
responding to the software test request triggered based on a target test interface of a test simulator, generating the target test instruction and calling the target virtual client; the test simulator is generated based on a target framework adapted to the multi-type development platform.
8. A software testing apparatus, comprising:
the software test request response module is used for responding to the software test request, generating a target test instruction and calling a target virtual client;
the behavior data test packet sending module is used for controlling the target virtual client to send a behavior data test packet to a server based on the target test instruction; the server processes the behavior data test packet through a target service program to obtain a data return packet; the behavior data test packet is generated for the target virtual client based on the target test instruction;
And the test result determining module is used for determining a software test result of the target service program based on the data packet sent by the server.
9. An electronic device comprising a processor and a memory, wherein the memory has stored therein at least one instruction or at least one program that is loaded and executed by the processor to implement the software testing method of any one of claims 1 to 7.
10. A computer storage medium having stored therein at least one instruction or at least one program, the at least one instruction or the at least one program being loaded by a processor and executing the software testing method according to any one of claims 1 to 7.
CN202210264792.8A 2022-03-17 2022-03-17 Software testing method and device, electronic equipment and storage medium Pending CN116795670A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210264792.8A CN116795670A (en) 2022-03-17 2022-03-17 Software testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210264792.8A CN116795670A (en) 2022-03-17 2022-03-17 Software testing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116795670A true CN116795670A (en) 2023-09-22

Family

ID=88035051

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210264792.8A Pending CN116795670A (en) 2022-03-17 2022-03-17 Software testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116795670A (en)

Similar Documents

Publication Publication Date Title
CN110442524B (en) Method and device for testing web service interface with authentication authorization
US10936371B2 (en) Method for resource allocation and related products
CN108228444B (en) Test method and device
CN111159049A (en) Automatic interface testing method and system
KR101229858B1 (en) Web-based system and method for sharing testing devices
CN110659198A (en) Application program test case execution method and device and software test system
CN103516851B (en) A kind of wireless product cloud test platform system
CN110597564A (en) Installation package construction and service component loading method, device and terminal equipment
CN112631590A (en) Component library generation method and device, electronic equipment and computer readable medium
CN110750453B (en) HTML 5-based intelligent mobile terminal testing method, system, server and storage medium
CN113691415B (en) Calling method, device and equipment of network tester and storage medium
CN113191114B (en) Method and apparatus for validating a system
CN113885971A (en) State management method and device based on self-adaptive platform system
CN105138373A (en) Vehicle diagnosis device firmware upgrading method and device
CN111258902B (en) Performance test method and performance test system based on SockJS server
CN103729258A (en) Automatic testing method, terminal and system
CN112241356B (en) Page test method, device, equipment and storage medium
CN111611065A (en) Calling method and device of machine learning algorithm, storage medium and electronic equipment
CN116795670A (en) Software testing method and device, electronic equipment and storage medium
CN115391219A (en) Test case generation method and device, electronic equipment and storage medium
CN107391354B (en) Method and system for automatically monitoring terminal performance and storage device
CN110971696B (en) System and method for realizing virtual electronic card communication
CN112433938A (en) Method and device for testing application of mobile terminal
CN111385837A (en) System and method for testing wireless public network communication unit
CN108628683B (en) Data transmission method and device

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