CN116795669A - Automatic testing method and system for client - Google Patents

Automatic testing method and system for client Download PDF

Info

Publication number
CN116795669A
CN116795669A CN202210260296.5A CN202210260296A CN116795669A CN 116795669 A CN116795669 A CN 116795669A CN 202210260296 A CN202210260296 A CN 202210260296A CN 116795669 A CN116795669 A CN 116795669A
Authority
CN
China
Prior art keywords
clients
test
client
remote procedure
procedure call
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
CN202210260296.5A
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 CN202210260296.5A priority Critical patent/CN116795669A/en
Publication of CN116795669A publication Critical patent/CN116795669A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a method and a system for automatically testing a client, wherein the method comprises the following steps: acquiring a test case; generating control instructions respectively corresponding to a plurality of clients according to the test cases, and sending the control instructions corresponding to the clients in a remote procedure call mode so as to control the behaviors of the clients, wherein the control instructions received by at least two clients in the plurality of clients are different; acquiring state information generated by each client based on the behaviors; and determining test results of the plurality of clients according to the state information. According to the scheme, the automatic test on a plurality of clients can be realized based on a single test case, so that the writing and maintenance of the test case are simpler, the test efficiency is obviously improved, and the test cost is reduced.

Description

Automatic testing method and system for client
Technical Field
The application relates to the technical field of software testing, in particular to an automatic testing method and system for a client.
Background
Software testing is one of the important means of ensuring software quality. In the Internet age, as software functions are more and more abundant, version iteration is more and more frequent, and higher requirements are put on software testing efficiency.
The existing software test scheme can only realize the test of a single client instance, and the test instances are mutually independent; moreover, the traditional test scheme is generally based on interface interaction for manual test, and once the software interface is modified, test cases need to be rewritten. Therefore, the test cases of the existing test schemes are difficult to maintain, the test efficiency is low, and the test cost is high.
Disclosure of Invention
The embodiment of the application provides a client automatic test method and a system, which can further effectively improve maintainability and test efficiency of test cases at least to a certain extent and reduce test cost.
Other features and advantages of the application will be apparent from the following detailed description, or may be learned by the practice of the application.
According to an aspect of an embodiment of the present application, there is provided a method for automatically testing a client, the method including: acquiring a test case; generating control instructions respectively corresponding to a plurality of clients according to the test cases, and sending the control instructions corresponding to the clients in a remote procedure call mode so as to control the behaviors of the clients, wherein the control instructions received by at least two clients in the plurality of clients are different; acquiring state information generated by each client based on the behaviors; and determining test results of the plurality of clients according to the state information.
According to an aspect of an embodiment of the present application, there is provided a client automatic test system, the system including: the generating tool is used for acquiring a remote procedure call instruction description file and generating a first interface code file and a second interface code file according to the remote procedure call instruction description file; a plurality of clients, the clients comprising the first interface code file; a background program for providing a server for the plurality of clients; the test control operation component comprises the second interface code file and a test case, and is used for executing the following operations according to the test case: generating control instructions respectively corresponding to the plurality of clients, and sending the control instructions corresponding to the clients in a remote procedure call mode so as to control the behaviors of the plurality of clients, wherein the control instructions received by at least two clients in the plurality of clients are different; acquiring state information generated by each client based on the behaviors; and determining test results of the plurality of clients according to the state information.
In some embodiments of the present application, based on the foregoing solution, the client includes a first remote procedure call server, where the first remote procedure call server is configured to obtain the control instruction in a remote procedure call manner; the test control operation component comprises a second remote procedure call server, and the second remote procedure call server is used for acquiring state information of each client.
According to an aspect of an embodiment of the present application, there is provided an automatic client testing apparatus, including: the first acquisition unit is used for acquiring test cases; the control unit is used for generating control instructions respectively corresponding to a plurality of clients according to the test cases, and sending the control instructions corresponding to the clients in a remote procedure call mode so as to control the behaviors of the clients, wherein the control instructions received by at least two clients in the plurality of clients are different; a second obtaining unit, configured to obtain status information generated by each client based on the behavior; and the determining unit is used for determining the test results of the plurality of clients according to the state information.
In some embodiments of the present application, based on the foregoing solution, before acquiring the test case, the first acquiring unit is further configured to: acquiring a remote procedure call instruction description file; generating an interface code file according to the remote procedure call instruction description file, and performing code embedding operation on a plurality of original clients according to the interface code file to obtain the plurality of clients, wherein the test case is written according to the interface code file.
In some embodiments of the application, based on the foregoing, the control unit is configured to: and sending control instructions corresponding to the clients by calling interfaces provided by the interface code files in the clients.
In some embodiments of the present application, based on the foregoing, the interface code file includes a remote procedure call protocol implementation file and a code frame file, and the first obtaining unit is configured to: and embedding the remote procedure call protocol realization file and the code frame file into a plurality of original clients respectively to obtain a plurality of clients so as to call the remote procedure call protocol realization file when the code frame file is executed in the clients.
In some embodiments of the application, based on the foregoing, the control unit is configured to: generating client starting instructions respectively corresponding to a plurality of clients according to the test cases; and respectively sending client starting instructions corresponding to the clients in a remote procedure call mode so as to start the clients.
In some embodiments of the application, based on the foregoing, the plurality of clients are a plurality of client instances of the same software product, and the client automatic test method is performed when version iterating the software product.
In some embodiments of the present application, based on the foregoing solution, the software product is internet software with interaction behavior between clients.
In some embodiments of the present application, based on the foregoing, after determining test results for the plurality of clients according to the state information, the determining unit is further configured to: obtaining a plurality of test results including the test result, wherein the plurality of test results are obtained by respectively testing the plurality of clients based on a plurality of test cases; and counting the plurality of test results, and generating a test report according to the counted results.
In some embodiments of the application, the state information is a client state or a client event based on the foregoing scheme.
According to an aspect of the embodiments of the present application, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a client automatic test method as described in the above embodiments.
According to an aspect of an embodiment of the present application, there is provided an electronic apparatus including: one or more processors; and a storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the client automatic test method as described in the above embodiments.
According to an aspect of an embodiment of the present application, there is provided a computer program product including computer instructions stored in a computer-readable storage medium, from which computer instructions a processor of a computer device reads, the processor executing the computer instructions, causing the computer device to perform the client automatic test method as described in the above embodiments.
In the technical scheme provided by some embodiments of the present application, after a test case is acquired, control instructions corresponding to a plurality of clients are generated according to the test case, and corresponding control instructions are sent to each client in a remote procedure call mode, so that parallel distributed control of each client is realized; based on the controlled client, the state information of the controlled clients can be obtained, and the corresponding test result can be analyzed according to the state information. Therefore, the scheme of the embodiment of the application can realize automatic test on a plurality of clients based on a single test case, and because the whole test scheme is irrelevant to the interface, even if the interface is modified, the test case does not need to be rewritten. Therefore, by adopting the scheme of the embodiment of the application, the writing and maintenance of the test case are simpler, the test efficiency is obviously improved, and the test cost is reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application. It is evident that the drawings in the following description are only some embodiments of the present application and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art. In the drawings:
FIG. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of an embodiment of the application may be applied;
FIG. 2 illustrates a block diagram of a client automatic test system in accordance with one embodiment of the present application;
FIG. 3 illustrates a block diagram of an RPC communication model according to one embodiment of the application;
FIG. 4 illustrates a block diagram of an RPC operation mechanism according to one embodiment of the application;
FIG. 5 shows a flow chart of a client automatic test method according to one embodiment of the application;
FIG. 6 shows a flowchart of the details of steps preceding step 530 and step 540 in FIG. 5, according to one embodiment of the application;
FIG. 7 shows a block diagram of a client automatic test equipment according to one embodiment of the present application;
fig. 8 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the application may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the application.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
Automated testing is an important means of improving test efficiency and coverage. In the Internet age, as software functions are more and more abundant, development period is shortened, version iteration speed is improved, and the degree of automation of testing is important. The proper automatic testing tool can greatly shorten the software development period on the premise of ensuring the software quality, and only needs to put into the establishment and development of a tool chain in the early stage, so that the labor investment is less.
In the related art, the test can be automatically completed based on an interface or a test script, and most of software functions can be covered during the test. However, in these schemes, the test cases are independent of each other, and only a single case or a single user scene can be covered, so that the test cases and scenes of multi-user interaction cannot be dealt with.
Specifically, conventional automation tools QTP, winRunner, phoenix Framework, etc., which mainly support interfacing software, can write test cases in a recorded manner and in a script manner. The main application scenarios of these schemes are automated testing of interfaced client software and Web applications, and then test cases are written by:
1. recording an operation sequence of an interface, wherein the recorded operation sequence can comprise mouse, keyboard, web control trigger and the like;
2. capturing screen output information, wherein the screen output information can comprise pixel color judgment results, control scanning results, DOM identification results and the like;
3. writing rules, and declaring expected results by using specific screen output as judgment conditions;
finally, the test case is run by: running the test case, and repeatedly executing the operation sequence; and judging whether the test passes or not according to the rule and the screen output information.
Therefore, the related technical schemes are all tested based on interface interaction of a single operation example, and have the following problems:
1. the test cases are complicated to write and maintain, and almost all the test cases are rewritten after the software interface is upgraded.
2. The testing is based on the recording of the sequence of operations and the capturing of the screen output, and the scene coverage is difficult and incomplete. For example, for test scenes logged in with different user identities, even the same operation sequence, the screen output is different, and thus, the test scenes are difficult to be covered.
3. The lack of communication means between running examples cannot realize multi-user interactive test, so that only low-efficiency manual test can be performed.
For this purpose, the application first provides a client automatic test system. The client automatic test system provided by the embodiment of the application can overcome the defects, the test cases are written at the control end based on remote operation control of the operation examples, the test process is independent of interfaces, the problems can be effectively solved, and the distributed automatic test can be realized for large-scale clients. RPC (Remote Procedure Call ) is a way to request services from a remote computer program over a network.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of an embodiment of the present application may be applied.
As shown in fig. 1, the system architecture 100 includes a control terminal 110, a first user terminal 120, a second user terminal 130, a third user terminal 140, and a server 150, where the control terminal 110 may be a desktop computer, and each user terminal may be a smart phone. The control terminal 110 is communicatively connected to each user terminal via a network, and each user terminal is communicatively connected to the server 150 via a network. The user terminals are provided with clients, the control terminal 110 is provided with a test control operation component, and the test control operation component can communicate with the clients in a remote procedure call mode; a background program for providing services to clients of the respective user terminals is deployed and run on the server 150.
The operation process of the system architecture is as follows: firstly, a tester compiles test cases for testing clients on all user terminals on a control terminal 110, and inputs the test cases into a test control operation component on the control terminal 110; then, the test control operation component generates control instructions respectively corresponding to the clients according to the test cases, and sends the control instructions to the corresponding clients in a remote procedure call mode through a network; then, the client executes the received control instruction, so that the behavior of the client is controlled by the test control running component, and in the process, the client may interact with a background program on the server 150; next, the test control operation component obtains the state information of each client through the network; and finally, the test control operation component obtains a corresponding test result according to the acquired state information of the client.
In one embodiment of the application, the clients on each user terminal are client instances of the same software product.
In one embodiment of the application, the software product is social software.
It should be understood that the number of user terminals and servers in fig. 1 is merely illustrative. There may be any number of user terminals and servers, as desired for implementation. For example, a greater number of user terminals may be provided, and the server 150 may be a server cluster formed by a plurality of servers.
It should be noted that, fig. 1 illustrates only one embodiment of the present application, while in the embodiment of fig. 1, the user terminal is a smart phone and the control terminal is a desktop computer, in other embodiments of the present application, both the control terminal and the user terminal may be various types of terminal devices, and the device types of the user terminals may be different; for example, the user terminal may also be a wearable device, and the control terminal may be a notebook computer or the like. Although in the embodiment of fig. 1, the clients are respectively running on different terminal devices, in other embodiments of the present application, the clients may also run on the same terminal device; although in the embodiment of fig. 1, the test control running component and each client are deployed on different terminal devices, in other embodiments of the present application, the test control running component and each client may be deployed on the same terminal device, e.g., the test control running component and each client may both run as different processes on a desktop computer. The embodiments of the present application should not be limited in any way, nor should the scope of the application be limited in any way.
As described above, the solution of the embodiment of the present application may be implemented by interaction of the terminal with the server. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), basic cloud computing services such as big data and artificial intelligent platforms, and the like. The terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the present application is not limited herein.
The embodiment of the application can be applied to the technical field of cloud computing, and particularly, a background program for providing services for a client can be deployed in a cloud server. Cloud computing (clouding) is a computing model that distributes computing tasks across a large pool of computers, enabling various application systems to acquire computing power, storage space, and information services as needed. The network that provides the resources is referred to as the "cloud". Resources in the cloud are infinitely expandable in the sense of users, and can be acquired at any time, used as needed, expanded at any time and paid for use as needed.
As a basic capability provider of cloud computing, a cloud computing resource pool (cloud platform is generally called IaaS (Infrastructure as a Service, infrastructure as a service)) platform is established, and multiple types of virtual resources are deployed in the resource pool for external clients to select for use. The cloud computing resource pool mainly comprises: computing devices (which are virtualized machines, including operating systems), storage devices, network devices.
According to the logic function division, a PaaS (Platform as a Service ) layer can be deployed on an IaaS (Infrastructure as a Service ) layer, and a SaaS (Software as a Service, software as a service) layer can be deployed above the PaaS layer, or the SaaS can be directly deployed on the IaaS. PaaS is a platform on which software runs, such as a database, web container, etc. SaaS is a wide variety of business software such as web portals, sms mass senders, etc. Generally, saaS and PaaS are upper layers relative to IaaS.
The implementation details of the technical scheme of the embodiment of the application are described in detail below:
the application provides a client automatic test system, which comprises: a plurality of clients, a daemon, and a test control running component.
FIG. 2 illustrates a block diagram of a client automatic test system in accordance with one embodiment of the present application. Referring to fig. 2, the automatic client testing system includes an App client A (App Client A), an App client B (App Client B), an App client C (App Client C), a Test control operation component (Test Runner), a Test Framework (Test Framework), and an App background (App background), where App client A, app client B and App client C are three App clients, and App background is a background program that provides a service for the three App clients, and the Test Framework and each App client are respectively set correspondingly and are referred to by the Test control operation component and each App client, so that the Test control operation component can communicate with each App client in a remote procedure call (Remote Procedure Call, RPC) manner; each App client can access a daemon. The test control running component and the App client are different processes, and can be located on the same machine or on different machines. The test control running component can remotely start each App client.
FIG. 3 illustrates a block diagram of an RPC communication model according to one embodiment of the application; fig. 4 illustrates a block diagram of an RPC operation mechanism according to one embodiment of the application. Referring to fig. 2 in combination with fig. 3 and fig. 4, it can be seen that the Test control operation assembly further includes a plurality of Test cases, where the Test cases are Test cases, and the Test control operation assembly is configured to execute the following operations according to the Test cases: generating control instructions respectively corresponding to a plurality of clients, and sending the control instructions corresponding to the clients in a remote procedure call mode so as to control the behaviors of the clients, wherein the control instructions received by at least two clients in the clients are different; acquiring state information generated by each client based on behaviors; and determining test results of the plurality of clients according to the state information.
These operations performed by the test control run component will be described in the following embodiments and will not be described in detail herein.
The test framework is the encapsulation of the App client and the interfaces and objects associated with rpc in the test control run component. When each App client communicates with the test control running component, an interface provided by the test framework is required to be used. Thus, the test framework can also be considered as an integral of the interface portion of the App client and the interface portion of the test control running component, i.e. the test framework can be located in the client and the test control running component, respectively. With continued reference to FIG. 4, the CalllsHandler.cpp, eventHandler.cpp, calls.rpc.h/. Cpp, and Event.rpc.h/. Cpp files located in the App client may be part of the test framework, and the Calls.rpc.py, eventCalls.rpc.py, and EventHandler.py files located in the test control runtime component may also be part of the test framework.
The client automatic test system further comprises a generating tool which is used for acquiring the remote procedure call instruction description file and generating a first interface code file and a second interface code file according to the remote procedure call instruction description file, wherein the first interface code file is positioned in the client, and the second interface code file is positioned in the test control operation component.
In the embodiment of fig. 4, the generation Tool, gen Tool, may be located on the same machine as the App client or on a different machine, the remote procedure call instruction description file, RPC Definition File, after being entered into the generation Tool, extends three arrows from the generation Tool, which point to interface code files generated by the generation Tool from the remote procedure call instruction description file. Wherein, two arrows point to files in the App client, which are the first interface code files; the other arrow points to the files in the test control running component, which are the second interface code files. I.e. callsHander. Cpp, eventHandler. Cpp, calls. Rpc.h/. Cpp, event. Rpc.h/. Cpp are the first interface code file, and calls. Rpc.py and EventCalls. Rpc.py are the second interface code file. And through the first interface code file and the second interface code file, communication between the App client and the test control operation component can be realized in a remote procedure call mode.
In one embodiment of the application, the client comprises a first remote procedure call server, and the first remote procedure call server is used for acquiring control instructions in a remote procedure call mode; the test control operation component comprises a second remote procedure call server, and the second remote procedure call server is used for acquiring state information of each client.
The number relation between the test control operation assembly and the App client is 1:N, and the test control operation assembly needs to send instructions to the App client at any time, so that when each App client is started, an RPC server side arranged in a test framework of the test control operation assembly can start and monitor RPC calls from the test control operation assembly.
In addition, because the App client needs to timely notify the test control operation component of the event or state of the App client as state information when the state of the App client changes or certain key events occur, the test control operation component also has a built-in RPC server for receiving notification of the App client.
Referring to fig. 3, a Built-in RPC Server (build-in RPC Server) in the test framework may be regarded as a first remote procedure call Server in the App client, and a Built-in RPC Server in the test control operation component is a second remote procedure call Server. In fig. 3, a test control operation component sends a Request to a built-in RPC server in a test framework, where the Request is an RPC call Request; the Notify Event received by the test control running component from the test framework is the status information of the notified Event.
With continued reference to fig. 4, the RPC server in the App client is a first remote procedure call server, the RPC server in the test control operation component is a second remote procedure call server, and it can be seen that the test control operation component sends an RPC call to the RPC server in the App client, where the RPC call is an RPC call request.
According to one aspect of the embodiment of the application, the application further provides an automatic testing method for the client. The client automatic test method can be executed by various devices with operation and processing functions, such as a notebook computer.
FIG. 5 shows a flow chart of a client automatic test method according to one embodiment of the application. Referring to fig. 5, the method for automatically testing a client includes at least the following steps:
in step 530, test cases are obtained.
The test cases are test case scripts, and can be written by developers or testers of the App client in FIG. 4, and can be added into the test control operation component.
In step 540, control instructions corresponding to the plurality of clients are generated according to the test case, and the control instructions corresponding to the clients are sent to the clients in a remote procedure call manner, so as to control the behaviors of the plurality of clients, wherein the control instructions received by at least two clients in the plurality of clients are different.
The number of clients included in the plurality of clients may be any integer not less than 2. When the test control operation component operates, the test cases in the test control operation component can be automatically operated.
For each client, a control instruction corresponding to the client can be generated according to the acquired test case, and then the generated control instruction can be sent to the corresponding client, so that independent control of each client is realized. The client executes the control instruction to generate corresponding behaviors which are equivalent to the operation behaviors of the user on the client. Because the control instruction is generated according to the test case, the control instruction acts on the client, and therefore, the behavior of the client is defined in the test case.
In one embodiment of the application, the plurality of clients are multiple client instances of the same software product, and the client automatic test method is performed when version iterations are performed on the software product.
Specifically, each of the plurality of clients is a client instance of a software product. For example, the plurality of clients may be WeChat Apps installed on the plurality of intelligent terminals. The test control run component of fig. 4 may be configured into a CI (Continuous Integration, continuously integrated) pipeline, and each time a version of the software product is iterated, full-automatic testing may be accomplished by performing the client-side automatic test method provided by embodiments of the present application.
In the embodiment of the application, the automatic testing method of the client is executed to complete the full-automatic testing when the version iteration is carried out on the software product with a plurality of client instances, so that the testing efficiency is greatly improved, and the version iteration time can be shortened on the premise of ensuring the quality of the software product.
In one embodiment of the application, the software product is internet software where there is interaction between clients.
The internet software can be internet software of various scenes such as mobile terminal App and PC software, and specifically can be software with a user interaction function. Specifically, the software product may be a game client, or may be software with social, community, payment or information functions, for example, may be instant messaging software such as WeChat, QQ, etc. By means of the interactive functions provided by the internet software, the user can use the clients to conduct interactive actions such as communication.
In the embodiment of the application, the multi-user interaction function among the clients can be tested by controlling the clients of a plurality of internet software based on the test cases, so that the automatic test of the multi-user interaction scene is completely realized.
The control instructions generated for each client according to the test cases are not exactly the same. In the internet software where interaction behavior exists between the clients, the control instructions generated for the different clients are also basically different due to different functions and user operation behaviors of the different clients, i.e. the control instructions received by at least two clients are different, which does not, of course, exclude the situation that the same control instructions are generated for several clients. By generating control instructions specific to each client, parallel testing of the clients can be achieved. The developer or tester of the App client can define the corresponding control instruction by writing the test case.
In one embodiment of the present application, generating control instructions corresponding to a plurality of clients according to test cases, and sending the control instructions corresponding to the clients in a remote procedure call manner, so as to control behaviors of the clients, including: generating client starting instructions respectively corresponding to the plurality of clients according to the test cases; and respectively sending client starting instructions corresponding to the clients in a remote procedure call mode so as to start the clients. In the embodiment of the application, the client starting instruction is also a control instruction generated according to the test case, and the test case can also be used for starting the client. In the embodiment shown in fig. 4, the test control operation component may remotely and automatically start any number of App clients according to the test cases, and establish RPC bidirectional channels with the App clients, and once the establishment of the RPC bidirectional channels is completed, may continue to execute the test cases, so as to test each App client. The App client does not need to be manually started.
Fig. 6 shows a flowchart of the details of steps preceding step 530 and step 540 in fig. 5, according to one embodiment of the application. Referring to fig. 6, before step 530, the method may further include the following steps:
In step 510, a remote procedure call instruction description file is obtained.
Referring to FIG. 4, a remote procedure call instruction description file is entered into the generation tool.
In step 520, an interface code file is generated according to the remote procedure call instruction description file, and code embedding operation is performed on the plurality of original clients according to the interface code file, so as to obtain a plurality of clients, wherein the test case is written according to the interface code file.
In order for the test control run component of fig. 4 to be able to communicate with the App client in a remote procedure call, the original client needs to be modified to meet the needs of RPC communication. Only if the test case is written according to the interface code file, the remote procedure call can be smoothly realized according to the test case.
With continued reference to fig. 4, the files pointed by the arrows extending from the generating tool into the App Client are interface code files generated by the generating tool according to the remote procedure call instruction description file, the App Client Core is the original Client, and the interface code files are embedded on the App Client Core, so that these interface code files become a part of the App Client.
In one embodiment of the present application, the interface code file includes a remote procedure call protocol implementation file and a code frame file, and the code embedding operation is performed on the plurality of original clients according to the interface code file, so as to obtain a plurality of clients, including: and embedding the remote procedure call protocol realization file and the code frame file into a plurality of original clients respectively to obtain a plurality of clients so as to call the remote procedure call protocol realization file when the code frame file is executed in the clients.
In order for each client to be able to communicate with the test control run component in a remote procedure call manner, each App client contains a corresponding interface code file. In fig. 4, callshandler. Cpp and eventhandler. Cpp located in the App client are code frame files, which are automatically generated according to the interface description information in the remote procedure call instruction description file; it can be seen that the generation tool also generates calls.rpc.h/. Cpp and event.rpc.h/. Cpp from the remote procedure call instruction description files, which are RPC protocol implementation files that are used to provide code framework files including calls handler.cpp and event handler.cpp for calls. The specific content of these RPC protocol implementation files is related to the selected RPC specification and technique and is not described in detail herein. EventHandler.cpp may be used to send status information to the test control runtime component.
Not only the client may include an interface code file, but also the test control execution component. With continued reference to fig. 4, the test control running component further includes calls.rpc.py and eventcalls.rpc.py generated by the generating tool according to the remote procedure call instruction description file, where these files are RPC protocol implementation files and are libraries for the test case writer to call.
All of the interface code files described above may be built based on any scripting language.
With continued reference to fig. 6, step 540 may specifically include the steps of:
in step 540', control instructions corresponding to each client are sent to each client by invoking an interface provided by the interface code file in the client.
The test control operation component communicates with the client based on the RPC remote call mode by calling an interface provided by an interface code file in the client.
With continued reference to fig. 5, in step 550, status information generated by each client based on the behavior is obtained.
When the client operates according to the corresponding behavior, corresponding state information is generated.
In one embodiment of the application, the state information is a client state or a client event.
The Notify Event received by the test control running component is state information of the client Event type in the embodiment of fig. 3.
In step 560, test results for the plurality of clients are determined based on the status information.
And analyzing and processing the state information of a certain client to obtain the test result of the client. Specifically, whether the client passes the test can be judged according to the state information of the client, and the judgment result is used as a test result of the client.
In one embodiment of the application, the test case includes the following parts: initializing a client; starting a client; calling RPC interface to control the behavior of multiple clients; acquiring a client state or capturing a client event; and judging whether the test is passed or not according to the state of the client or the event of the client.
Therefore, according to the present embodiment, not only step 540 needs to be performed according to the test case, but also steps 550 and 560 need to be performed based on the test case.
In one embodiment of the present application, after determining test results for a plurality of clients according to the status information, the client automatic test method further includes: obtaining a plurality of test results including the test result, wherein the plurality of test results are obtained by respectively testing a plurality of clients based on a plurality of test cases; and counting the plurality of test results, and generating a test report according to the counted results.
Each of the plurality of test results is obtained by executing the client automatic test method according to the embodiment of the application to test a plurality of clients according to the acquired test case.
As shown in FIG. 4, by setting a plurality of test cases in the test control operation assembly, the test control operation assembly is operated, all the test cases in the test control operation assembly are automatically operated, and each test case is operated to obtain a corresponding test result; after all the test cases are run, corresponding test reports can be obtained by carrying out statistics and analysis on the test results. Finally, the test report may be output in a pop-up window, page, etc. for presentation to a developer or tester.
In summary, according to the automatic testing scheme of the client provided by the embodiment of the application, a tester is allowed to start any number of remote clients in a single test case script, the behaviors of the clients are defined in the test case script, parallel distributed automatic testing is realized on large-scale software clients with mutual interaction relationship, and the testing requirement of a multi-user interaction scene is met; because the whole scheme is irrelevant to the interface, and the test case can control a plurality of client instances to carry out interactive test, the writing and maintenance cost of the test case is greatly reduced, the test efficiency is obviously improved, and the test cost is reduced.
Taking a version of social software for testing as an example, the scheme of the application can generate at least the following benefits:
(1) Test period: the manual test takes 2 to 3 days; based on the scheme of the application, the test control operation assembly is used for automatically testing, so that the test time is shortened to 1 hour.
(2) Human input: the manual test needs to be put into 3-5 days; according to the scheme of the application, the test control operation component is deployed in the CI environment for testing, only 0 person is needed, and project management personnel can directly check the test report.
(3) Software iteration cycle: the whole is reduced by 2 to 3 days.
(4) Test case maintainability: the method changes from manually writing the case document into writing the test case by codes.
(5) Input after interface modification: when in manual test, the interface is changed and then the test is carried out, so that test cases need to be rewritten; after the scheme of the application is used, the test case does not need to be rewritten.
The following describes an embodiment of the apparatus of the present application, which may be used to perform the client automatic test method in the above embodiment of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method for automatically testing a client according to the present application.
FIG. 7 shows a block diagram of a client automatic test equipment in accordance with one embodiment of the present application.
Referring to fig. 7, a client automatic test equipment 700 according to an embodiment of the present application includes: a first acquisition unit 710, a control unit 720, a second acquisition unit 730, and a determination unit 740. The first obtaining unit 710 is configured to obtain a test case; the control unit 720 is configured to generate control instructions corresponding to a plurality of clients according to the test case, and send the control instructions corresponding to the clients in a remote procedure call manner, so as to control behaviors of the clients, where control instructions received by at least two clients in the plurality of clients are different; a second obtaining unit 730, configured to obtain status information generated by each of the clients based on the behaviors; the determining unit 740 is configured to determine test results for the plurality of clients according to the status information.
In some embodiments of the present application, based on the foregoing solution, before acquiring the test case, the first acquiring unit 710 is further configured to: acquiring a remote procedure call instruction description file; generating an interface code file according to the remote procedure call instruction description file, and performing code embedding operation on a plurality of original clients according to the interface code file to obtain the plurality of clients, wherein the test case is written according to the interface code file.
In some embodiments of the present application, based on the foregoing scheme, the control unit 720 is configured to: and sending control instructions corresponding to the clients by calling interfaces provided by the interface code files in the clients.
In some embodiments of the present application, based on the foregoing, the interface code file includes a remote procedure call protocol implementation file and a code frame file, and the first obtaining unit 710 is configured to: and embedding the remote procedure call protocol realization file and the code frame file into a plurality of original clients respectively to obtain a plurality of clients so as to call the remote procedure call protocol realization file when the code frame file is executed in the clients.
In some embodiments of the present application, based on the foregoing scheme, the control unit 720 is configured to: generating client starting instructions respectively corresponding to a plurality of clients according to the test cases; and respectively sending client starting instructions corresponding to the clients in a remote procedure call mode so as to start the clients.
In some embodiments of the application, based on the foregoing, the plurality of clients are a plurality of client instances of the same software product, and the client automatic test method is performed when version iterating the software product.
In some embodiments of the present application, based on the foregoing solution, the software product is internet software with interaction behavior between clients.
In some embodiments of the present application, based on the foregoing solution, after determining the test results for the plurality of clients according to the status information, the determining unit 740 is further configured to: obtaining a plurality of test results including the test result, wherein the plurality of test results are obtained by respectively testing the plurality of clients based on a plurality of test cases; and counting the plurality of test results, and generating a test report according to the counted results.
In some embodiments of the application, the state information is a client state or a client event based on the foregoing scheme.
Fig. 8 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
It should be noted that, the computer system 800 of the electronic device shown in fig. 8 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present application.
As shown in fig. 8, the computer system 800 includes a central processing unit (Central Processing Unit, CPU) 801 that can perform various appropriate actions and processes, such as performing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 802 or a program loaded from a storage section 808 into a random access Memory (Random Access Memory, RAM) 803. In the RAM 803, various programs and data required for system operation are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other by a bus 804. An Input/Output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, mouse, etc.; an output portion 807 including a Cathode Ray Tube (CRT), a liquid crystal display (Liquid Crystal Display, LCD), and the like, and a speaker, and the like; a storage section 808 including a hard disk or the like; and a communication section 809 including a network interface card such as a LAN (Local Area Network ) card, modem, or the like. The communication section 809 performs communication processing via a network such as the internet. The drive 810 is also connected to the I/O interface 805 as needed. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as needed so that a computer program read out therefrom is mounted into the storage section 808 as needed.
In particular, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 809, and/or installed from the removable media 811. When executed by a Central Processing Unit (CPU) 801, performs the various functions defined in the system of the present application.
It should be noted that, the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-Only Memory (ROM), an erasable programmable read-Only Memory (Erasable Programmable Read Only Memory, EPROM), flash Memory, an optical fiber, a portable compact disc read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Where each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be provided in a processor. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
As an aspect, the present application also provides a computer-readable medium that may be contained in the electronic device described in the above embodiment; or may exist alone without being incorporated into the electronic device. The computer-readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to implement the methods described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, a touch terminal, or a network device, etc.) to perform the method according to the embodiments of the present application.
It will be appreciated that in particular embodiments of the present application, where data relating to video processing is involved, user approval or consent is required when the above embodiments of the present application are applied to particular products or technologies, and the collection, use and processing of the relevant data is required to comply with relevant legal regulations and standards in the relevant countries and regions.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (11)

1. A method for automatically testing a client, the method comprising:
acquiring a test case;
generating control instructions respectively corresponding to a plurality of clients according to the test cases, and sending the control instructions corresponding to the clients in a remote procedure call mode so as to control the behaviors of the clients, wherein the control instructions received by at least two clients in the plurality of clients are different;
Acquiring state information generated by each client based on the behaviors;
and determining test results of the plurality of clients according to the state information.
2. The method for automatically testing a client according to claim 1, wherein before obtaining the test case, the method further comprises:
acquiring a remote procedure call instruction description file;
generating an interface code file according to the remote procedure call instruction description file, and performing code embedding operation on a plurality of original clients according to the interface code file to obtain the plurality of clients, wherein the test case is written according to the interface code file.
3. The method for automatically testing clients according to claim 2, wherein the sending the control instruction corresponding to each client in a remote procedure call manner includes:
and sending control instructions corresponding to the clients by calling interfaces provided by the interface code files in the clients.
4. The method for automatically testing a client according to claim 2, wherein the interface code file includes a remote procedure call protocol implementation file and a code frame file, and the performing code embedding operation on a plurality of original clients according to the interface code file to obtain the plurality of clients includes:
And embedding the remote procedure call protocol realization file and the code frame file into a plurality of original clients respectively to obtain a plurality of clients so as to call the remote procedure call protocol realization file when the code frame file is executed in the clients.
5. The method for automatically testing a client according to claim 1, wherein the generating control instructions corresponding to the plurality of clients according to the test case and sending the control instructions corresponding to the clients in a remote procedure call manner to control behaviors of the plurality of clients includes:
generating client starting instructions respectively corresponding to a plurality of clients according to the test cases;
and respectively sending client starting instructions corresponding to the clients in a remote procedure call mode so as to start the clients.
6. The client automatic test method of claim 1, wherein the plurality of clients are a plurality of client instances of a same software product, the client automatic test method being performed while iterating through versions of the software product.
7. The method for automatically testing clients according to claim 6, wherein the software product is internet software having interactive behavior between clients.
8. The method for automatically testing clients according to claim 1, wherein after determining the test results for the plurality of clients according to the status information, the method further comprises:
obtaining a plurality of test results including the test result, wherein the plurality of test results are obtained by respectively testing the plurality of clients based on a plurality of test cases;
and counting the plurality of test results, and generating a test report according to the counted results.
9. The method according to any one of claims 1-8, wherein the status information is a client status or a client event.
10. A client automatic test system, the system comprising:
the generating tool is used for acquiring a remote procedure call instruction description file and generating a first interface code file and a second interface code file according to the remote procedure call instruction description file;
a plurality of clients, the clients comprising the first interface code file;
A background program for providing a server for the plurality of clients;
the test control operation component comprises the second interface code file and a test case, and is used for executing the following operations according to the test case: generating control instructions respectively corresponding to the plurality of clients, and sending the control instructions corresponding to the clients in a remote procedure call mode so as to control the behaviors of the plurality of clients, wherein the control instructions received by at least two clients in the plurality of clients are different; acquiring state information generated by each client based on the behaviors; and determining test results of the plurality of clients according to the state information.
11. The client automatic test system of claim 10, wherein the client comprises a first remote procedure call server for obtaining the control instruction in a remote procedure call manner; the test control operation component comprises a second remote procedure call server, and the second remote procedure call server is used for acquiring state information of each client.
CN202210260296.5A 2022-03-16 2022-03-16 Automatic testing method and system for client Pending CN116795669A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210260296.5A CN116795669A (en) 2022-03-16 2022-03-16 Automatic testing method and system for client

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210260296.5A CN116795669A (en) 2022-03-16 2022-03-16 Automatic testing method and system for client

Publications (1)

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

Family

ID=88048503

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210260296.5A Pending CN116795669A (en) 2022-03-16 2022-03-16 Automatic testing method and system for client

Country Status (1)

Country Link
CN (1) CN116795669A (en)

Similar Documents

Publication Publication Date Title
US9286040B2 (en) Software builder
US8898643B2 (en) Application trace replay and simulation systems and methods
US8516451B2 (en) System and method for creating virtual callback objects
CN110013672B (en) Method, device, apparatus and computer-readable storage medium for automated testing of machine-run games
US20220107882A1 (en) Rendering engine component abstraction system
CN110727575B (en) Information processing method, system, device and storage medium
CN111338925A (en) Applet test method, device and system, electronic equipment and storage medium
Tuovenen et al. MAuto: Automatic mobile game testing tool using image-matching based approach
CN114297056A (en) Automatic testing method and system
CN111666199A (en) Debugging method executed on intelligent terminal and software debugger
CN112988588A (en) Client software debugging method and device, storage medium and electronic equipment
CN113238739A (en) Plug-in development and data acquisition method, device, electronic equipment and medium
CN112306857A (en) Method and apparatus for testing applications
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN110795330A (en) Monkey pressure testing method and device
CN116795669A (en) Automatic testing method and system for client
CN114816672A (en) Virtual machine creation method and device, electronic equipment and storage medium
US11030087B2 (en) Systems and methods for automated invocation of accessibility validations in accessibility scripts
CN111427770A (en) Resource testing method and related equipment
Vyas et al. AppAmigo: An Efficient Middleware to Record and Control Remote Users' Interactions with Their Smartphone Apps
WO2022237826A1 (en) User interface testing method and system, cluster, medium, and program product
CN116382718A (en) Code offline deployment method and device, computer equipment and storage medium
CN115543807A (en) Automatic regression testing method and device, computer equipment and storage medium
CN116909928A (en) Test case generation method, interface test method, system, equipment and medium
Bonner et al. Modernizing Applications with IBM CICS

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