Program testing method, device, electronic device and computer readable storage medium

By encapsulating the functions of game operations in a preset packet protocol and using the editor of Unreal Engine to parse and call these functions, the problem of recompilation in the existing technology is solved, and the convenience and efficiency of no compilation testing is achieved.

CN114185773BActive Publication Date: 2025-04-15TENCENT DIGITAL TIANJIN
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111399342.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-19
Publication Date
2025-04-15
Estimated Expiration
2041-11-19

AI Technical Summary

Technical Problem

The existing technology needs to add code and compile it in the test tool when testing new functions of the game, resulting in recompilation every time the function is added, which is more troublesome.

Method used

By obtaining the functions of the game operations, encapsulating them into the preset packet protocol, and parsing and calling these functions through the editor of Unreal Engine, performing the game operations to determine the test results, avoiding the compilation steps.

Benefits of technology

It realizes the function of testing game programs without compilation, improving testing efficiency and convenience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114185773B_ABST
    Figure CN114185773B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a program testing method, device, electronic device and computer-readable storage medium; in the embodiment of the present application, a game operation is obtained, and a function for implementing the game operation is encapsulated into a preset data packet protocol, and the function of the game operation is a function of the attribute system of the Unreal Engine on the terminal; when the game program is run through the editor of the Unreal Engine based on the test instruction, the preset data packet protocol is sent to the editor; the preset data packet protocol is parsed by the editor to obtain the function of the game operation; the function of the game operation is called by the editor, the game operation is executed, and the operation result is obtained; the test result for the game program is determined based on the operation result. The embodiment of the present application does not need to be recompiled, which is more convenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a program testing method, device, electronic device and computer-readable storage medium. Background Art

[0002] In order to ensure the normal operation of the game, the game is generally tested. At present, the game is usually tested using a testing tool.

[0003] When using a test tool to test a game, if you need to test a new function of the game, you need to add code to the test tool and compile it. This means that every time a new function is added to the game, it needs to be recompiled, which is troublesome. Summary of the invention

[0004] The embodiments of the present application provide a program testing method, device, electronic device and computer-readable storage medium, which can solve the technical problem of requiring recompilation and being relatively troublesome.

[0005] A program testing method, comprising:

[0006] Obtaining a game operation, and encapsulating a function for implementing the game operation into a preset data packet protocol, wherein the function for the game operation is a function of an attribute system of the Unreal Engine on the terminal;

[0007] When the game program is run through the editor of the Unreal Engine based on the test instruction, the preset data packet protocol is sent to the editor;

[0008] Parsing the preset data packet protocol through the editor to obtain the function of the game operation;

[0009] Call the function of the game operation through the editor, execute the game operation, and obtain the operation result;

[0010] A test result for the game program is determined based on the operation result.

[0011] Accordingly, an embodiment of the present application provides a program testing device, comprising:

[0012] An acquisition module, used for acquiring game operations, and encapsulating functions for implementing the game operations into a preset data packet protocol, wherein the functions for the game operations are functions of the attribute system of the Unreal Engine on the terminal;

[0013] A sending module, used for sending the preset data packet protocol to the editor when the game program is run through the editor of the Unreal Engine based on the test instruction;

[0014] A parsing module, used for parsing the preset data packet protocol through the editor to obtain the function of the game operation;

[0015] A calling module, used to call the function of the game operation through the editor, execute the game operation, and obtain the operation result;

[0016] The determination module is used to determine the test result for the game program based on the operation result.

[0017] Optionally, the preset data packet protocol includes a first field and a second field;

[0018] Accordingly, the acquisition module is specifically used to execute:

[0019] Storing the name of the function of the game operation in the first field;

[0020] The result of calling the function of the game operation is stored in the second field.

[0021] Optionally, the acquisition module is specifically used to execute:

[0022] If the game operation function is a static function, the name of the game operation function, the class name corresponding to the game operation function, the package name of the class corresponding to the game operation function and the input value of the game operation function are stored in the first field.

[0023] Optionally, the acquisition module is specifically used to execute:

[0024] If the game operation function is a non-static function, the name of the game operation function, the object name of the game operation function and the input value of the game operation function are stored in the first field.

[0025] Optionally, the first field is an array;

[0026] Accordingly, the calling module is specifically used to execute:

[0027] If the game operation function includes at least two functions, the game operation functions are called in sequence by the editor according to the storage order of the game operation functions in the array, and the game operation is executed to obtain the operation result.

[0028] Optionally, the sending module is specifically used to execute:

[0029] When the game program is run through the editor of the Unreal Engine based on the test instruction, the target command field and the preset data packet protocol are sent to the editor;

[0030] Accordingly, the parsing module is specifically used to perform:

[0031] If the target command field is received, the preset data packet protocol is parsed by the editor to obtain the function of the game operation.

[0032] Optionally, the program testing device further comprises:

[0033] A marking module, used for marking the function of the game operation using a preset macro if the property system of the Unreal Engine does not include the function of the game operation;

[0034] The storage module is used to store the marked game operation functions into the property system of the Unreal Engine.

[0035] In addition, an embodiment of the present application also provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor is used to run the computer program in the memory to implement the program testing method provided in the embodiment of the present application.

[0036] In addition, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. The computer program is suitable for loading by a processor to execute any program testing method provided in the embodiment of the present application.

[0037] In addition, an embodiment of the present application also provides a computer program product, including a computer program, and when the above computer program is executed by a processor, any one of the program testing methods provided in the embodiment of the present application is implemented.

[0038] In an embodiment of the present application, the game operation is first obtained, and the function for implementing the game operation is encapsulated into a preset data packet protocol, where the function for the game operation is a function of the attribute system of the Unreal Engine on the terminal. Then, when the game program is run through the editor of the Unreal Engine based on the test instruction, the preset data packet protocol is sent to the editor. The preset data packet protocol is then parsed by the editor to obtain the function for the game operation. Secondly, the function for the game operation is called by the editor, the game operation is executed, and the operation result is obtained. Finally, the test result for the game program is determined based on the operation result.

[0039] That is, in this embodiment, due to the reflection function of the Unreal Engine's attribute system, the Unreal Engine editor can directly call the Unreal Engine's attribute system function, and the game operation function is the Unreal Engine's attribute system function. Therefore, if the game program needs to be tested, the game operation function of the game program can be directly encapsulated in the preset data packet protocol. Then when the editor parses the preset data packet protocol to obtain the game operation function, the game operation function can be directly called from the Unreal Engine's attribute system, the game operation is performed, and the operation result is obtained. Finally, the test result of the game program is determined based on the operation result, without the need for compilation, which is more convenient. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0041] Figure 1 It is a schematic diagram of a scenario of a program testing process provided by an embodiment of the present application;

[0042] Figure 2 It is a flowchart of a program testing method provided in an embodiment of the present application;

[0043] Figure 3 is a schematic diagram of a preset data packet protocol provided in an embodiment of the present application;

[0044] Figure 4 is a schematic diagram of another preset data packet protocol provided in an embodiment of the present application;

[0045] Figure 5 It is a flowchart of another program testing method provided in an embodiment of the present application;

[0046] Figure 6 is a schematic diagram of a control click control provided in an embodiment of the present application;

[0047] Figure 7 is a schematic diagram of the test results provided in the embodiments of the present application;

[0048] Figure 8 is a schematic diagram of a test report provided in an embodiment of the present application;

[0049] Fig. 9 It is a flowchart of another program testing method provided in an embodiment of the present application;

[0050] Fig.10This is a schematic diagram of the interaction between a Python client in a terminal and an editor in the terminal provided by an embodiment of the present application;

[0051] Fig.11 is a schematic diagram of the structure of a program testing device provided in an embodiment of the present application;

[0052] Fig.12 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0054] The embodiment of the present application provides a program testing method, device, electronic device and computer readable storage medium. The program testing device can be integrated in an electronic device, which can be a server, a terminal or other device.

[0055] Among them, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms.

[0056] Furthermore, multiple servers can form a blockchain, and the servers are nodes on the blockchain.

[0057] The terminal may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart home appliance, a vehicle-mounted terminal, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, and this application does not limit this.

[0058] The embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.

[0059] For example, see Figure 1Taking the program testing device integrated in the terminal as an example, the terminal can obtain the game operation, and encapsulate the function of implementing the game operation into a preset data packet protocol. The function of the game operation is the function of the attribute system of the Unreal Engine on the terminal; when the game program is run through the editor of the Unreal Engine based on the test instruction, the preset data packet protocol is sent to the editor; the preset data packet protocol is parsed by the editor to obtain the function of the game operation; the function of the game operation is called by the editor, the game operation is executed, and the operation result is obtained; the test result for the game program is determined based on the operation result.

[0060] In addition, the term "plurality" in the embodiments of the present application refers to two or more than two. The terms "first" and "second" in the embodiments of the present application are used to distinguish descriptions and should not be understood as implying relative importance.

[0061] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0062] In this embodiment, the description will be made from the perspective of a program testing device, which can be specifically integrated in a server or terminal and other equipment. To facilitate the description of the program testing method of the present application, the following will provide a detailed description of the program testing device being integrated in a terminal, i.e., the terminal will be used as the execution subject for a detailed description.

[0063] See also Figure 2 , Figure 2 : is a flowchart of a program testing method provided by an embodiment of the present application. The program testing method may include:

[0064] S201, obtaining game operations, and encapsulating functions for implementing game operations into a preset data packet protocol, wherein the functions for implementing game operations are functions of an attribute system of an Unreal Engine on a terminal.

[0065] Game operations include but are not limited to the movement, shooting, and jumping of characters in the game program. The functions that implement game operations and the number of functions for game operations can be set according to actual conditions. For example, if the game operation is to obtain the position of the target character, the functions for obtaining the position of the target character may include OpGetWorld, GetPlayerCharacter, and K2_GetActorLocation.

[0066] Unreal Engine is a cross-platform game engine that can be used to develop stand-alone games for Windows, MacOS, and Linux platforms, or games for iOS and Android mobile devices. The version of Unreal Engine can be selected according to actual conditions, for example, Unreal Engine 4 (UE4) is selected as the Unreal Engine in this embodiment.

[0067] If the property system of the Unreal Engine does not include the function of the game operation, the game operation function can be marked by using a preset macro, and the marked game operation function is stored in the property system of the Unreal Engine.

[0068] When the Unreal Engine is Unreal Engine 4, the preset macro may be UFUNCTION. Using the preset macro to mark the function of the game operation refers to adding the preset macro in front of the function of the game operation.

[0069] Encapsulating the function that implements the game operation into the preset data packet protocol means encapsulating the attribute information of the function that implements the game operation into the preset data packet protocol. The attribute information of the function includes the name of the function, the name of the class corresponding to the function, the input value of the function, and the object name of the function.

[0070] In addition, the terminal can obtain game operations through the scripting language client, and encapsulate the functions that implement the game operations into a preset data packet protocol through the scripting language client. For the specific type of the scripting language client, the user can set it according to the actual situation, for example, select Python client or Java client as the scripting language client in this embodiment, which is not limited in this embodiment.

[0071] In some embodiments, the preset data packet protocol includes a first field and a second field. Accordingly, the function for implementing the game operation is encapsulated into the preset data packet protocol, including:

[0072] The name of the function of the game operation is stored in the first field;

[0073] The result of calling the function of the game operation is stored in the second field.

[0074] For example, the first field may be ops, and the second field may be out. That is, at this time, the format of the preset data packet protocol may be JSON format.

[0075] Optionally, if the game operation function is a static function, the name of the game operation function, the class name corresponding to the game operation function, the package name of the class corresponding to the game operation function, and the input value of the game operation function are stored in the first field.

[0076] The class name corresponding to the game operation function refers to the name of the class to which the game operation function belongs. The package name of the class corresponding to the game operation function refers to the class path of the game operation function. That is, the first field may include various first subfields, and each first subfield is used to store the name of the game operation function, the class name corresponding to the game operation function, the package name of the class corresponding to the game operation function, and the input value of the function for operating the game.

[0077] For example, the first field includes a first subfield static, a first subfield package, a first subfield class, a first subfield function, and a first subfield parms. The first subfield static is used to store true, which indicates that the function of the game operation is a static function, the first subfield class is used to store the class name corresponding to the function of the game operation, the first subfield function is used to store the name of the function of the game operation, and the first subfield parms is used to store the input value of the function of the game operation.

[0078] Optionally, if the game operation function is a non-static function, the name of the game operation function, the object name of the game operation function, and the input value of the game operation function are stored in the first field.

[0079] For example, the first field may include a first subfield static, a first subfield object, a first subfield function, and a first subfield parms. The first subfield static is used to store false, which indicates that the function of the game operation is a non-static function, the first subfield object is used to store the object name of the function of the game operation, the first subfield function is used to store the name of the function of the game operation, and the first subfield parms is used to store the input value of the function of the game operation.

[0080] It should be noted that when the function of the game operation includes multiple functions, the first field can store the names of the functions of each game operation at the same time, that is, at this time, for the same game operation, only one first field can be used in the preset data packet protocol to store the function of the game operation. And at this time, the second field only stores the result of calling the function of the last game operation.

[0081] The following describes in detail the process of encapsulating the functions that implement game operations into the preset data packet protocol.

[0082] For example, the game operation is to obtain the location information of the target character. The functions that implement the game operation include OpGetWorld, GetPlayerCharacter, and K2_GetActorLocation. OpGetWorld is used to obtain the world information of the game program where the target character is located. The world information of the game program includes the map information of the game program, the character information of the game program, and the equipment information of the game program. GetPlayerCharacter is used to obtain the target character, and K2_GetActorLocation is used to obtain the location information of the target character.

[0083] Among them, OpGetWorld and GetPlayerCharacter are both static functions, and K2_GetActorLocation is a non-static function. At this time, the preset data packet protocol can be as follows Figure 3 At this time, the first field ops also includes a first subfield name, and the first subfield name is used to store the name of the information obtained by the game operation function, for example, the name of the world information obtained by OpGetWorld is world, and the name of the information obtained by GetPlayerCharacte is character.

[0084] Furthermore, since there are three functions for the game operation, the execution result of the previous game operation function can be used as the input value of the subsequent game operation function. Figure 3 As shown, the first subfield parms in GetPlayerCharacter stores the execution result "#world" of OpGetWorld.

[0085] For another example, the game operation is to control the target character to jump, and the functions to implement the game operation include OpGetWorld, GetPlayerCharacter and Jump. At this time, the preset data packet protocol can be as follows Figure 4 shown.

[0086] S202: When the game program is run through the editor of the Unreal Engine based on the test instruction, the preset data packet protocol is sent to the editor.

[0087] After the terminal encapsulates the function for implementing the game operation into the preset data packet protocol, when the terminal receives the test instruction, it can first start the editor of the Unreal Engine based on the test instruction, and then run the game program through the editor of the Unreal Engine. Finally, during the running of the game program, the preset data packet protocol is sent to the editor.

[0088] Optionally, the terminal may first obtain a test case for the game program through a scripting language client, the test case including an editor command for starting the Unreal Engine, a command for running the game program, a login command, a preset data packet protocol, and test results for storing the game program.

[0089] Then when the terminal receives the test instruction, the test case is run in the script language client. During the running of the test case, the editor is started through the script language client, the game program is run in the editor, and the preset data packet protocol is sent to the editor.

[0090] At this time, two command lines can be added to the editor's test tool, one command line is used to run the game program when receiving the command to run the game program, and the other command line is used to start the detection function, that is, to start the Socket port so that the preset data packet protocol can be detected through the Socket port. Optionally, the preset data packet protocol can be detected through the test tool based on the Socket port.

[0091] The testing tool can be GAutomator or Poco. GAutomator or Poco is a mobile game client automation testing framework.

[0092] It should be noted that since the editor will pause running the game program when other pop-up windows are displayed, you can set a preset time interval to keep the editor window on top or keep the editor window on top continuously. In addition, you can keep the editor window on top by running the window-keeping program.

[0093] For example, Figure 5 As shown, the editor is started through the script language client, and then the editor starts the detection function, runs the game program, and runs the window top program, and continuously tops the editor window. When the game program is running, the map in the game program is played, and the game operation is tested to obtain the test results, and a test report is generated based on the test results.

[0094] S203, parsing the preset data packet protocol through the editor to obtain a function for game operation.

[0095] After the terminal sends the preset data packet protocol to the editor, the editor parses the preset data packet protocol so that the editor can obtain the function of the game operation.

[0096] Since some game operations can be implemented through controls on the interface of the operation editor, it is not necessary to implement them through game operation functions. For example, when the game operation is a click operation or a long press operation, it can be implemented through controls on the interface. Therefore, in some embodiments, sending the preset data packet protocol to the editor includes:

[0097] Send the target command field and preset packet protocol to the editor;

[0098] Accordingly, the preset data packet protocol is parsed through the editor to obtain the game operation functions, including:

[0099] If the target command field is received, the preset data packet protocol is parsed through the editor to obtain the function of the game operation.

[0100] In this embodiment, when the target command field is received through the editor, it indicates that the preset data packet protocol is received, and the game operation is implemented by calling the game operation function in the preset data packet protocol, so the preset data packet protocol needs to be parsed.

[0101] If the initial command field is received through the editor, it means that the game operation is realized through the controls on the editor interface (when the game program is run on the editor, the editor interface is the interface of the game program), and there is no need to implement the game operation through functions. The editor can be used to find the control corresponding to the initial command field on the interface, and then the control can be operated through the interactive interface of the interface to realize the game operation.

[0102] In this embodiment, the editor can not only test the interface of the game program, but also other game operations in the game program. This allows the game program to be smoke tested in the editor stage, verify the game operation of the game program, and find problems in the game program so that testers can solve the problems, thereby improving the testing efficiency of the game program and increasing the success rate of exporting the installation package of the game program.

[0103] In addition, when implementing game operations through game operation functions, it is sometimes necessary to implement game operations through controls on the editor interface at the same time, that is, implementing game operations through game operation functions and controls on the interface at the same time.

[0104] The process of realizing the game operation through the game operation function and the control on the interface can be: the terminal calls the response function corresponding to the control through the editor during the process of calling the game operation function, thereby controlling the control to realize the game operation.

[0105] For example, Figure 6 As shown, when the game operation is to control the target character to jump, in the process of calling the jump function (Jump), the response function of the control is called, so as to control the click control to realize the jump of the target character.

[0106] Furthermore, in the related art, every time a game operation is added, a field corresponding to the game operation needs to be set so as to determine which code in the test tool to call through the field, so that the more game operations are added, the more fields are added.

[0107] In the present embodiment, only one target command field needs to be set, and then the preset data packet protocol is parsed when the target command field is received. That is, when the target command field is received, the parsing function module in the test tool is called to parse the preset data packet protocol. Even if the game operation functions in the preset data packet protocol are different, since the parsing process is the same, only one target command field can be used.

[0108] S204: Call the game operation function through the editor, execute the game operation, and obtain the operation result.

[0109] After the editor obtains the function of the game operation, it calls the function of the game operation through the editor to execute the game operation and obtain the operation result.

[0110] Optionally, the function of the game operation can be called through the test tool in the editor. And after the operation result is obtained through the editor, the operation result can be sent to the script language client.

[0111] In some embodiments, if the function of the game operation includes multiple functions, the first field may be an array. Accordingly, the function of the game operation is called through the editor to perform the game operation and obtain the operation result, including:

[0112] If the game operation function includes at least two functions, the game operation functions are called in sequence by the editor according to the storage order of the game operation functions in the array, the game operation is executed, and the operation result is obtained.

[0113] For example, Figure 3 As shown in the figure, the functions of game operations are OpGetWorld, GetPlayerCharacter and K2_GetActorLocation. In the array ops, the storage order of OpGetWorld is earlier than that of GetPlayerCharacter, and the storage order of GetPlayerCharacter is earlier than that of K2_GetActorLocation. Therefore, when calling the functions of game operations through the editor, OpGetWorld is called first, then GetPlayerCharacter is called, and finally K2_GetActorLocation is called.

[0114] Furthermore, the execution result of the function storing the game operation in the previous order can be used as the input value of the function storing the game operation in the later order.

[0115] S205: Determine a test result for the game program based on the operation result.

[0116] After obtaining the operation result, the terminal determines the test result of the game program based on the operation result. It should be noted that after obtaining the operation results of all game operations of the game program, the terminal can determine the test result of the game program based on the operation results of all game operations. Finally, a test report can be generated based on the test result.

[0117] For example, the test results can be Figure 7 As shown in Figure 1, 19 game operations were successfully executed, 1 game operation failed, and 2 game operations were not executed. The test report can be as follows: Figure 8 As shown, the test report includes the game operation, the start time of the game operation, the time spent on the game operation, the execution result of the game operation and the link corresponding to the game operation.

[0118] As can be seen from the above, in the embodiment of the present application, the game operation is first obtained, and the function for implementing the game operation is encapsulated into a preset data packet protocol, and the function of the game operation is a function of the attribute system of the Unreal Engine on the terminal. Then, when the game program is run through the editor of the Unreal Engine based on the test instruction, the preset data packet protocol is sent to the editor. Then, the preset data packet protocol is parsed by the editor to obtain the function of the game operation. Secondly, the function of the game operation is called by the editor, the game operation is executed, and the operation result is obtained. Finally, the test result for the game program is determined based on the operation result.

[0119] That is, in this embodiment, due to the reflection function of the Unreal Engine's attribute system, the Unreal Engine editor can directly call the Unreal Engine's attribute system function, and the game operation function is the Unreal Engine's attribute system function. Therefore, if the game program needs to be tested, the game operation function of the game program can be directly encapsulated in the preset data packet protocol. Then when the editor parses the preset data packet protocol to obtain the game operation function, the game operation function can be directly called from the Unreal Engine's attribute system, the game operation is performed, and the operation result is obtained. Finally, the test result of the game program is determined based on the operation result, without the need for compilation, which is more convenient.

[0120] The method described in the above embodiment is further described in detail below with examples.

[0121] In this embodiment, the program test device is integrated into the terminal as an example. Fig. 9 , Fig. 9 A flowchart of a program testing method provided in an embodiment of the present application. The program testing method flow may include:

[0122] S901. The terminal obtains the game operation through the Python client. If the attribute system of the Unreal Engine 4 does not include the function of the game operation, the UFUNCTION is used to mark the function of the game operation; and the marked game operation function is stored in the attribute system of the Unreal Engine 4.

[0123] Game operations include but are not limited to the movement, shooting, and jumping of characters in the game program. The functions that implement game operations and the number of functions for game operations can be set according to actual conditions. For example, if the game operation is to obtain the position of the target character, the functions for obtaining the position of the target character may include OpGetWorld, GetPlayerCharacter, and K2_GetActorLocation.

[0124] Using UFUNCTION to mark the game operation function means adding UFUNCTION in front of the game operation function.

[0125] S902. If the game operation function is a static function, the terminal stores the name of the game operation function, the class name corresponding to the game operation function, the package name of the class corresponding to the game operation function, and the input value of the game operation function in the first field of the preset data packet protocol through the Python client.

[0126] The class name corresponding to the game operation function refers to the name of the class to which the game operation function belongs. The package name of the class corresponding to the game operation function refers to the class path of the game operation function. That is, the first field may include various first subfields, and each first subfield is used to store the name of the game operation function, the class name corresponding to the game operation function, the package name of the class corresponding to the game operation function, and the input value of the function for operating the game.

[0127] For example, the first field includes a first subfield static, a first subfield package, a first subfield class, a first subfield function, and a first subfield parms. The first subfield static is used to store true, which indicates that the function of the game operation is a static function, the first subfield class is used to store the class name corresponding to the function of the game operation, the first subfield function is used to store the name of the function of the game operation, and the first subfield parms is used to store the input value of the function of the game operation.

[0128] S903. If the game operation function is a non-static function, the terminal stores the name of the game operation function, the object name of the game operation function, and the input value of the game operation function in the first field of the preset data packet protocol through the Python client.

[0129] For example, the first field may include a first subfield static, a first subfield object, a first subfield function, and a first subfield parms. The first subfield static is used to store false, which indicates that the function of the game operation is a non-static function, the first subfield object is used to store the object name of the function of the game operation, the first subfield function is used to store the name of the function of the game operation, and the first subfield parms is used to store the input value of the function of the game operation.

[0130] It should be noted that when the function of the game operation includes multiple functions, the first field can store the names of the functions of each game operation at the same time, that is, at this time, for the same game operation, only one first field can be used in the preset data packet protocol to store the function of the game operation. And at this time, the second field only stores the result of calling the function of the last game operation.

[0131] S904: The terminal stores the result of calling the function of the game operation in the second field of the preset data packet protocol through the Python client.

[0132] That is, at this time, the format of the preset data packet protocol may be a JSON format, and the preset data packet protocol includes a first field and a second field, the first field may be ops, and the second field may be out.

[0133] S905. The terminal obtains a test case of the game program through the Python client, and runs the test case on the Python client when a test instruction is received.

[0134] The test cases include editor startup instructions, game program running instructions, login instructions, preset data packet protocols, target command fields, initial command fields, and test results for storing game programs.

[0135] S906. During the running of the test case, the terminal sends the editor startup instruction in the test case to the editor based on the Socket port through the Python client, and starts the editor based on the editor startup instruction.

[0136] S907. The terminal sends the start instruction of the game program in the test case to the editor through the Python client based on the Socket port, and runs the game program through the editor based on the start instruction of the game program.

[0137] S908. The terminal sends the target command field and the preset data packet protocol to the editor through the Python client based on the Socket port. The terminal parses the preset data packet protocol through the test tool in the editor to obtain the function of the game operation.

[0138] S909: The terminal calls the function of the game operation through the test tool of the editor, executes the game operation, and obtains the operation result.

[0139] If the game operation function includes multiple functions, the first field may be an array. The terminal uses the test tool of the editor to sequentially call the game operation functions according to the storage order of the game operation functions in the array, execute the game operation, and obtain the operation result.

[0140] For example, Figure 3 As shown in the figure, the functions of game operations are OpGetWorld, GetPlayerCharacter and K2_GetActorLocation. In the array ops, the storage order of OpGetWorld is earlier than that of GetPlayerCharacter, and the storage order of GetPlayerCharacter is earlier than that of K2_GetActorLocation. Therefore, when calling the functions of game operations through the editor, OpGetWorld is called first, then GetPlayerCharacter is called, and finally K2_GetActorLocation is called.

[0141] Furthermore, the execution result of the function storing the game operation in the previous order can be used as the input value of the function storing the game operation in the later order.

[0142] S9010. The terminal serializes the operation result through the editor and returns the serialized operation result to the Python client.

[0143] S9011. The terminal sends the initial command field to the editor through the Python client based on the Socket port, and the terminal searches for the control corresponding to the initial command field on the interface through the editor.

[0144] S9012. The terminal operates the control corresponding to the initial command field through the interactive interface of the editor interface to implement the game operation, obtain the operation result, and return the operation result to the Python client.

[0145] S9013. The terminal determines the test result of the game program based on the operation result through the Python client, and generates a test report based on the test result.

[0146] In this embodiment, during the running of the test case, the startup instruction of the editor, the startup instruction of the game program, the target command field, the initial command field and the preset data packet protocol in the test case are sent to the editor of Unreal Engine 4 through the Python client. Fig.10 As shown. Through the Python client, based on the Socket port, the editor startup instruction, game program startup instruction, target command field, initial command field and preset data packet protocol in the test case are sent to the editor of Unreal Engine 4.

[0147] Optionally, the terminal can detect instructions, command fields, and preset data packet protocols in the test case through a test tool in an editor of Unreal Engine 4.

[0148] It should be noted that before detecting the instructions, command fields, and preset data packet protocols in the test case through the test tool in the editor of Unreal Engine 4, you can first add two command lines in the test tool of the editor, one command line is used to run the game program when the command to run the game program is received, and the other command line is used to start the detection function so that the instructions, command fields, and preset data packet protocols in the test case can be detected through the detection function.

[0149] The testing tool can be Gautomator or Poco. It should be noted that since the editor will pause running the game program when other pop-up windows are popped up by the system, you can set a preset time interval to keep the editor window on top or keep the editor window on top continuously. In addition, you can keep the editor window on top by running the window top program.

[0150] In this embodiment, due to the reflection function of the attribute system of Unreal Engine 4, the editor of Unreal Engine 4 can directly call the function of the attribute system of Unreal Engine 4, and the function of the game operation is the function of the attribute system of Unreal Engine 4. Therefore, if the game program needs to be tested, the function of the game operation of the game program can be directly encapsulated in the preset data packet protocol. Then when the editor parses the preset data packet protocol to obtain the function of the game operation, the function of the game operation can be directly called from the attribute system of Unreal Engine 4, the game operation can be performed, and the operation result can be obtained. Finally, the test result of the game program is determined based on the operation result, without the need for compilation, which is more convenient.

[0151] Furthermore, in the related art, every time a game operation is added, a field corresponding to the game operation needs to be set so as to determine which code to call through the field, so that the more game operations are added, the more fields are added.

[0152] In the present embodiment, only one target command field needs to be set, and then the preset data packet protocol is parsed when the target command field is received. That is, when the target command field is received, the parsing function module in the test tool is called to parse the preset data packet protocol. Even if the game operation functions in the preset data packet protocol are different, since the parsing process is the same, only one target command field can be used.

[0153] Furthermore, in this embodiment, the editor can not only test the interface of the game program, but also other game operations in the game program, so that the game program can be smoke tested in the editor stage, the game operation of the game program can be verified, and problems of the game program can be found so that the tester can solve the problem, thereby improving the testing efficiency of the game program and improving the success rate of exporting the installation package of the game program.

[0154] In order to better implement the program testing method provided in the embodiment of the present application, the embodiment of the present application also provides a device based on the above program testing method. The meanings of the terms are the same as those in the above program testing method, and the specific implementation details can refer to the description in the method embodiment.

[0155] For example, Fig.11 As shown, the program test device may include:

[0156] The acquisition module 1101 is used to acquire the game operation and encapsulate the function for implementing the game operation into a preset data packet protocol. The function for the game operation is a function of the attribute system of the Unreal Engine on the terminal.

[0157] The sending module 1102 is used to send a preset data packet protocol to the editor when the game program is run through the editor of the Unreal Engine based on the test instruction;

[0158] The parsing module 1103 is used to parse the preset data packet protocol through the editor to obtain the function of the game operation;

[0159] The calling module 1104 is used to call the game operation function through the editor, execute the game operation, and obtain the operation result;

[0160] The determination module 1105 is used to determine the test result for the game program based on the operation result.

[0161] Optionally, the preset data packet protocol includes a first field and a second field;

[0162] Accordingly, the acquisition module 1101 is specifically used to execute:

[0163] The name of the function of the game operation is stored in the first field;

[0164] The result of calling the function of the game operation is stored in the second field.

[0165] Optionally, the acquisition module 1101 is specifically configured to execute:

[0166] If the game operation function is a static function, the name of the game operation function, the class name corresponding to the game operation function, the package name of the class corresponding to the game operation function, and the input value of the game operation function are stored in the first field.

[0167] Optionally, the acquisition module 1101 is specifically configured to execute:

[0168] If the game operation function is a non-static function, the name of the game operation function, the object name of the game operation function, and the input value of the game operation function are stored in the first field.

[0169] Optionally, the first field is an array.

[0170] Accordingly, the calling module 1104 is specifically used to execute:

[0171] If the game operation function includes at least two functions, the game operation functions are called in sequence by the editor according to the storage order of the game operation functions in the array, the game operation is executed, and the operation result is obtained.

[0172] Optionally, the sending module 1102 is specifically configured to execute:

[0173] When the game program is run through the Unreal Engine editor based on the test instructions, the target command field and the preset data packet protocol are sent to the editor;

[0174] Accordingly, the parsing module 1103 is specifically used to execute:

[0175] If the target command field is received, the preset data packet protocol is parsed through the editor to obtain the function of the game operation.

[0176] Optionally, the program testing device further comprises:

[0177] A marking module, used for marking the game operation function using a preset macro if the Unreal Engine's property system does not include the game operation function;

[0178] The storage module is used to store the marked game operation functions into the property system of the Unreal Engine.

[0179] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined and implemented as the same or several entities. The specific implementation methods and corresponding beneficial effects of the above modules can be found in the previous method embodiments, which will not be repeated here.

[0180] The present application also provides an electronic device, which may be a server or a terminal, etc. Fig.12As shown, it shows a schematic diagram of the structure of the electronic device involved in the embodiment of the present application, specifically:

[0181] The electronic device may include components such as a processor 1201 with one or more processing cores, a memory 1202 with one or more computer-readable storage media, a power supply 1203, and an input unit 1204. Those skilled in the art will appreciate that Fig.12 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0182] The processor 1201 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing computer programs and / or modules stored in the memory 1202, and calling data stored in the memory 1202, it performs various functions of the electronic device and processes data, thereby controlling the electronic device as a whole. Optionally, the processor 1201 may include one or more processing cores; preferably, the processor 1201 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1201.

[0183] The memory 1202 can be used to store computer programs and modules. The processor 1201 executes various functional applications and data processing by running the computer programs and modules stored in the memory 1202. The memory 1202 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 1202 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 1202 may also include a memory controller to provide the processor 1201 with access to the memory 1202.

[0184] The electronic device also includes a power supply 1203 for supplying power to each component. Preferably, the power supply 1203 can be logically connected to the processor 1201 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 1203 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0185] The electronic device may further include an input unit 1204, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0186] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 1201 in the electronic device will load the executable files corresponding to the processes of one or more computer programs into the memory 1202 according to the following instructions, and the processor 1201 will run the computer programs stored in the memory 1202, thereby realizing various functions, such as:

[0187] Obtaining game operations, encapsulating functions for implementing game operations into a preset data packet protocol, where the functions for implementing game operations are functions of the property system of the Unreal Engine on the terminal;

[0188] When the game program is run through the editor of the Unreal Engine based on the test instructions, the preset data packet protocol is sent to the editor;

[0189] Parse the preset data packet protocol through the editor to obtain the game operation function;

[0190] Call the game operation function through the editor, execute the game operation, and get the operation result;

[0191] A test result for the game program is determined based on the operation result.

[0192] The specific implementation methods and corresponding beneficial effects of the above operations can be found in the detailed description of the image processing method above, which will not be elaborated here.

[0193] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0194] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored, and the computer program can be loaded by a processor to execute the steps in any program testing method provided in the embodiment of the present application. For example, the computer program can execute the following steps:

[0195] Obtaining game operations, encapsulating functions for implementing game operations into a preset data packet protocol, where the functions for implementing game operations are functions of the property system of the Unreal Engine on the terminal;

[0196] When the game program is run through the editor of the Unreal Engine based on the test instructions, the preset data packet protocol is sent to the editor;

[0197] Parse the preset data packet protocol through the editor to obtain the game operation function;

[0198] Call the game operation function through the editor, execute the game operation, and get the operation result;

[0199] A test result for the game program is determined based on the operation result.

[0200] The specific implementation methods and corresponding beneficial effects of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0201] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0202] Since the computer program stored in the computer-readable storage medium can execute the steps in any one of the program testing methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the program testing methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0203] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above-mentioned program testing method.

[0204] The above is a detailed introduction to a program testing method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A program testing method, characterized in that: Applied to terminals, including: Acquire a game operation, and encapsulate a function for implementing the game operation into a preset data packet protocol, wherein the function for the game operation is a function of an attribute system of the Unreal Engine on the terminal; When the game program is run through the editor of the Unreal Engine based on the test instruction, the preset data packet protocol is sent to the editor; Parsing the preset data packet protocol through the editor to obtain the function of the game operation; If the property system of the Unreal Engine does not include the function of the game operation, a preset macro is used to mark the function of the game operation; Storing the marked game operation function into the property system of the Unreal Engine; Calling the function of the game operation through the editor, executing the game operation, and obtaining the operation result; A test result for the game program is determined based on the operation result.

2. The program testing method according to claim 1, characterized in that: The preset data packet protocol includes a first field and a second field; Accordingly, the function for implementing the game operation is encapsulated into a preset data packet protocol, including: Storing the name of the function of the game operation in the first field; The result of calling the function of the game operation is stored in the second field.

3. The program testing method according to claim 2, characterized in that: The storing the name of the function of the game operation in the first field comprises: If the game operation function is a static function, the name of the game operation function, the class name corresponding to the game operation function, the package name of the class corresponding to the game operation function, and the input value of the game operation function are stored in the first field.

4. The program testing method according to claim 2, characterized in that: The storing the name of the function of the game operation in the first field comprises: If the game operation function is a non-static function, the name of the game operation function, the object name of the game operation function, and the input value of the game operation function are stored in the first field.

5. The program testing method according to claim 2, characterized in that: The first field is an array; Correspondingly, calling the function of the game operation through the editor, executing the game operation, and obtaining the operation result includes: If the game operation function includes at least two functions, the editor calls the game operation functions in sequence according to the storage order of the game operation functions in the array, executes the game operation, and obtains the operation result.

6. The program testing method according to claim 1, characterized in that: When the game program is run through the editor of the Unreal Engine based on the test instruction, the preset data packet protocol is sent to the editor, including: When the game program is run through the editor of the Unreal Engine based on the test instruction, the target command field and the preset data packet protocol are sent to the editor; Accordingly, the editor parses the preset data packet protocol to obtain the function of the game operation, including: If the target command field is received, the preset data packet protocol is parsed by the editor to obtain the function of the game operation.

7. A program testing device, characterized in that: Applied to terminals, including: An acquisition module, used for acquiring game operations, and encapsulating a function for implementing the game operations into a preset data packet protocol, wherein the function for the game operations is a function of an attribute system of the Unreal Engine on the terminal; A sending module, used for sending the preset data packet protocol to the editor when the game program is run through the editor of the Unreal Engine based on the test instruction; A parsing module, used for parsing the preset data packet protocol through the editor to obtain the function of the game operation; A marking module, used for marking the function of the game operation by using a preset macro if the attribute system of the Unreal Engine does not include the function of the game operation; A storage module, used for storing the marked game operation function into the attribute system of the Unreal Engine; A calling module, used to call the function of the game operation through the editor, execute the game operation, and obtain the operation result; A determination module is used to determine a test result for the game program based on the operation result.

8. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the program testing method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the program testing method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product stores a computer program, and the computer program is suitable for being loaded by a processor to execute the program testing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Game API realization method and apparatus, interface server and readable storage medium

    CN108170537A

  • Application testing method and device, computer equipment and storage medium

    CN113468069A