CN114398286A - Automatic testing method and device, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN114398286A
CN114398286A CN202210059715.9A CN202210059715A CN114398286A CN 114398286 A CN114398286 A CN 114398286A CN 202210059715 A CN202210059715 A CN 202210059715A CN 114398286 A CN114398286 A CN 114398286A
Authority
CN
China
Prior art keywords
target
test
tested
client
behavior tree
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
CN202210059715.9A
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 CN202210059715.9A priority Critical patent/CN114398286A/en
Publication of CN114398286A publication Critical patent/CN114398286A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/368Test management for test version control, e.g. updating test cases to a new software version
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to the technical field of automatic testing, in particular to an automatic testing method, an automatic testing device, electronic equipment and a storage medium, wherein the method comprises the following steps: receiving a test trigger request sent by a client to be tested; the test trigger request comprises the current running state information of the client to be tested; performing operation decision based on the target behavior tree test case to obtain target operation matched with the current running state information; returning an operation instruction containing the target operation to the client to be tested; the operation instruction is used for instructing the client to be tested to execute the target operation based on the current running state information to obtain a target test result corresponding to the current running state information. The method and the device can improve the flexibility of the behavior tree test case and improve the updating efficiency of the target behavior tree test case.

Description

Automatic testing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of automated testing technologies, and in particular, to an automated testing method and apparatus, an electronic device, and a storage medium.
Background
The game scene has complex context, meanwhile, the iteration period of the game project is short, the content is changed frequently, and the maintenance difficulty of the automatic test case is greatly improved.
In the prior art, the test case based on the game scene cannot effectively cope with frequent content changes, and the modification of the test case needs to depend on the construction of the game project version, so that the flexibility of the test case is low, and the modification cost is high.
Disclosure of Invention
The technical problem to be solved by the present application is to provide an automated testing method, an automated testing device, an electronic device, and a storage medium, which can improve the flexibility of a test case and reduce the modification cost of the test case.
In order to solve the above technical problem, in one aspect, an automated testing method is provided, including:
receiving a test trigger request sent by a client to be tested; the test trigger request comprises the current running state information of the client to be tested;
performing operation decision based on the target behavior tree test case to obtain target operation matched with the current running state information; the target behavior tree test case is determined based on target execution logic of the client to be tested, and the target execution logic is matched with a test target of the client to be tested;
returning an operation instruction containing the target operation to the client to be tested; the operation instruction is used for instructing the client to be tested to execute the target operation based on the current running state information to obtain a target test result corresponding to the current running state information.
In another aspect, an automated testing apparatus is provided, comprising:
the test trigger request receiving module is used for receiving a test trigger request sent by a client to be tested; the test trigger request comprises the current running state information of the client to be tested;
the target operation determining module is used for making an operation decision based on the target behavior tree test case to obtain target operation matched with the current running state information; the target behavior tree test case is determined based on target execution logic of the client to be tested, and the target execution logic is matched with a test target of the client to be tested;
the operation instruction returning module is used for returning an operation instruction containing the target operation to the client to be tested; the operation instruction is used for instructing the client to be tested to execute the target operation based on the current running state information to obtain a target test result corresponding to the current running state information.
In another aspect, the present application provides an electronic device, which includes a processor and a memory, where at least one instruction or at least one program is stored in the memory, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the automated testing method as described above.
In another aspect, the present application provides a computer storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or the at least one program is loaded by a processor and executes the automated testing method as described above.
The embodiment of the application has the following beneficial effects:
the method comprises the steps of receiving a test trigger request sent by a client to be tested, wherein the test trigger request comprises current running state information of the client to be tested, and then performing operation decision based on a target behavior tree test case according to the current running state information to obtain target operation matched with the current running state information; returning an operation instruction containing target operation to the client to be tested; the operation instruction can be used for instructing the client to be tested to execute target operation in the current running state so as to obtain a corresponding target test result. The target behavior tree test case is determined based on the target execution logic of the client to be tested, the target execution logic is matched with the test target of the client to be tested, so that the target behavior tree test case can be used for testing the client to be tested, and the behavior tree is an artificial intelligent component, so that the behavior tree-based test case has strong flexibility and applicability and can adapt to various complex scenes; furthermore, the target behavior tree test case is independent of the client to be tested, so that the target behavior tree test case does not need to depend on the client to be tested, the client to be tested does not need to be packaged again when the target behavior tree test case is modified, testing and development separation are facilitated, flexibility of the target behavior tree test case is improved, modification cost of the target behavior tree test case is reduced, updating efficiency of the target behavior tree test case is improved, and updating of the target behavior tree test case in a thermal updating mode is achieved.
Drawings
In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application;
FIG. 2 is a flow chart of an automated testing method provided by an embodiment of the present application;
FIG. 3 is a flowchart of a method for determining a target operation in a multi-user scenario according to an embodiment of the present disclosure;
FIG. 4 is a flowchart of a target operation determination method provided by an embodiment of the present application;
FIG. 5 is a flow chart of another method for determining target operations provided by an embodiment of the present application;
FIG. 6 is a timing diagram of tick in a game scenario provided by an embodiment of the present application;
FIG. 7 is a flowchart of a target operation data processing method provided by an embodiment of the present application;
FIG. 8 is a flow chart illustrating the execution of a behavior tree according to an embodiment of the present disclosure;
FIG. 9 is a flowchart of an operation instruction generating method according to an embodiment of the present application;
FIG. 10 is a flowchart of a method for generating a target behavior tree test case according to an embodiment of the present application;
FIG. 11 is a flow diagram of an asynchronous branching function provided by an embodiment of the present application;
FIG. 12 is a schematic diagram of an automated testing apparatus according to an embodiment of the present disclosure;
fig. 13 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, the present application will be further described in detail with reference to the accompanying drawings. It is to be understood that the described embodiments are merely a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, the following explanations are made with respect to the terms involved in the embodiments of the present specification:
behavior tree: an AI component for controlling decision-making behavior, whose data structure is generally a tree structure containing hierarchical nodes, is widely used in AI implementation of various games.
Unity: the game development engine is a mainstream game development engine at present, and can run on platforms such as windows, mac, iPhone, windows phone 8 and Android in a cross-platform manner.
Referring to fig. 1, a schematic diagram of an implementation environment provided by an embodiment of the present application is shown, where the implementation environment may include: at least one client terminal to be tested 110 and a test execution terminal 120, wherein the client terminal to be tested 110 and the test execution terminal 120 can perform data communication through a network.
Specifically, the client 110 to be tested may send a test trigger request to the test execution end 120; when receiving the test trigger request, the test execution end 120 performs an operation decision by using the target behavior tree test case to obtain a target operation; then returning the target operation to the client terminal 110 to be tested; the client 110 to be tested executes the target operation to obtain a corresponding target test result.
The Client 110 to be tested may communicate with the test executor 120 based on a Browser/Server (B/S) mode or a Client/Server (C/S) mode. The client under test 110 may include: the physical devices may also include software running in the physical devices, such as application programs and the like. The operating system running on the client under test 110 in the embodiment of the present application may include, but is not limited to, an android system, an IOS system, linux, windows, and the like.
The test execution end 120 and the client to be tested 110 may establish a communication connection through a wired or wireless connection, and the test execution end 120 may include an independently operating server, or a distributed server, or a server cluster composed of a plurality of servers, where the server may be a cloud server.
In order to solve the problems of low flexibility and high modification cost of the test case in the prior art, an embodiment of the present application provides an automated testing method, where an execution main body of the automated testing method may be the test execution end, please refer to fig. 2, and the method may include:
s210, receiving a test trigger request sent by a client to be tested; the test trigger request comprises the current running state information of the client to be tested.
Compared with the client to be tested, the test execution end is a remote end, namely the client to be tested and the test execution end can be different terminals; in the testing process, the client to be tested initiates a testing trigger request, and the testing execution end calls a corresponding target behavior tree test case to make an operation decision based on the testing trigger request, so that the testing work of the client to be tested is realized through the information interaction between the client to be tested and the testing execution end.
Furthermore, the running process of the client to be tested can comprise a plurality of running nodes, and when the client to be tested runs to each running node, the client to be tested can automatically trigger to generate a corresponding test triggering request so as to realize the automatic test of each running node. When the test trigger request is sent for the first time, the test trigger request may include current running state information of the client to be tested, and the current running state information may include node data information of a current execution node of the client to be tested, current global information, and the like. Taking a UI (User Interface) type client to be tested as an example, the node data information of the current execution node may specifically be execution UI node data, and the current global information may be Interface data information related currently. When the test trigger request is not sent for the first time, the test trigger request can also comprise a target test result corresponding to the previous test trigger request, and the previous target test result is sent to the test execution end together, so that the test execution end can conveniently perform operation decision based on the received previous target test result, the current global information and the like, perform operation decision based on comprehensive data information, and improve the accuracy of the operation decision.
In addition, a tool kit SDK may be further integrated in the client to be tested, and the tool kit SDK may drive the client to be tested to send a test trigger request at a preset time interval through the client to be tested, where sending the test trigger request each time is equivalent to sending a tick, each second may include multiple ticks, and a tick may be a time interaction between the client to be tested and the test execution end. The SDK can start a single thread to be responsible for interacting with a remote testing execution end and drive an uplink packet of a client tick to be tested, wherein the uplink packet refers to a protocol packet which is sent to the testing execution end by the client to be tested in each tick and receives an operation command from the testing execution end, and the operation commands are executed in a main thread; and meanwhile, packing the execution result and the subscription data in a next tick, and sending the tick to a test execution end through an uplink packet. The SDK determines whether to start driving and driving frequency according to configuration items, and in a specific implementation process, configuration of relevant driving parameters can be performed through configuration items built in the items.
S220, performing operation decision based on the target behavior tree test case to obtain target operation matched with the current running state information; and the target behavior tree test case is determined based on the target execution logic of the client to be tested, and the target execution logic is matched with the test target of the client to be tested.
The target behavior tree test case can comprise condition judgment logic, execution logic under corresponding conditions and the like, so that the target behavior tree test case can determine the conditions which are met according to the current state information and make corresponding operation decisions, namely the obtained target operation is matched with the current running state information. The target operation may specifically be a UI operation, a click operation, a function execution operation, and the like. For example, the current running state information is state information 1, and the decision operation made by the corresponding target behavior tree test case is operation 1; the current running state information is state information 2, and the decision operation made by the corresponding target behavior tree test case is operation 2.
Different clients to be tested have different execution logics, so that a target behavior tree test case corresponding to the execution logic can be created based on the execution logics. When a target behavior tree test case is created, based on the working principle of a behavior tree, the case is compiled in a behavior tree editor, and the method mainly comprises the steps of pulling nodes, filling node parameters, linking nodes and the like, and exporting the behavior tree into a resource file for use in the test process. The test execution end integrates an analyzer of the behavior tree, can analyze the logic of the behavior tree, and determines corresponding target operation by combining the test trigger request so as to indicate the client to be tested to execute.
And the behavior tree node types can be created, and new self-defined node types are allowed to be added to enrich the capability of the behavior tree through the provided behavior tree editor and the provided behavior tree component. The behavior tree node types are divided into combination nodes, decoration nodes, behavior nodes and condition nodes, new nodes need to be added in a node list of an editor when the new node types are created, node names, types, comments, parameters and the like are configured, and then the functions of the new nodes need to be realized in the behavior tree component. At present, nodes such as basic flow, asynchronous branch, weight random, cycle, timer, mathematics, UI operation, error processing, subtree, character string operation, robot data access, custom interface calling and the like are integrated.
Introduction of node types:
combined node (Comosite)
Used for managing and organizing the child nodes, and determining the remaining execution content and the number of the child nodes of the execution result according to the return result of the child nodes, wherein the number of the child nodes is 1-N
The nodes return Success, Failure, Error and Running
Modified node (Decorator)
The number of child nodes is 1
The nodes return Success, Failure, Error and Running
Condition node (Condition)
0 node child node number as judgment condition
The node returns Success and Failure
Behavior node (Action)
Executing nodes, wherein the life cycle can span a plurality of ticks, returning Running represents that the node is still executing, and the next tick can continue to execute the node child node number of 0
And the nodes return Success, Failure, Error and Running.
S230, returning an operation instruction containing the target operation to the client to be tested; the operation instruction is used for instructing the client to be tested to execute the target operation based on the current running state information to obtain a target test result corresponding to the current running state information.
The test execution end can perform further processing operation on the target operation obtained by decision, for example, packaging operation, compression operation or simultaneous packaging and compression operation; the target operation is packaged to obtain the corresponding operation instruction, so that the loss of the operation data of the target operation can be avoided, the client to be tested is ensured to receive the accurate target operation data, and the accuracy of data transmission is improved. The target operation is compressed, so that network bandwidth resources occupied by target operation data in a network transmission process can be reduced, and the data transmission efficiency can be improved.
Since the target behavior tree test case is determined based on the execution logic of the client to be tested in the present application, thereby the target behavior tree test case can be used for testing the client to be tested, further, the target behavior tree test case is independent of the client to be tested, thereby the target behavior tree test case does not need to depend on the client to be tested, namely, the target behavior tree test case is decoupled from the client to be tested, the client to be tested does not need to be packaged again when the target behavior tree test case is modified, the test is convenient to develop and separate, therefore, the flexibility of the target behavior tree test case is improved, the modification cost of the target behavior tree test case is reduced, the updating efficiency of the target behavior tree test case is improved, and the test case is updated in a hot updating mode.
Furthermore, the test execution end can simultaneously receive test trigger requests sent by a plurality of clients to be tested, and each test trigger request can correspond to one client to be tested; the test trigger request can also comprise an object identifier, wherein the object identifier can be specifically a user identifier and can be determined by logging in user account information of the clients to be tested, so that in a multi-user cooperation scene, a target behavior tree test case can be used for carrying out joint operation decision based on current running state information of a plurality of clients to be tested; referring to fig. 3, a method for determining a target operation in a multi-user scenario is shown, which may include:
s310, traversing the test trigger requests sent by the plurality of clients to be tested respectively.
S320, determining an associated trigger request of the current test trigger request; the object identification of the current test trigger request and the object identification of the association trigger request have an association relation; the associated trigger request is at least one test trigger request except the current test trigger request in the test trigger requests sent by the multiple clients to be tested.
S330, performing a joint operation decision based on the target behavior tree test case, the current running state information of the current test trigger request and the current running state information of the associated trigger request to obtain a target operation corresponding to the current test trigger request.
The test execution end can traverse a plurality of test trigger requests received at the same time and determine the associated trigger request of each test trigger request, the association relationship between the object identifier in the current test trigger request and the object identifier of the associated trigger request can be a cooperation relationship or a competition relationship, and the object corresponding to the object identifier with the association relationship is an associated object.
Taking the collaboration relation as an example for explanation, the object corresponding to the current test trigger request and the object corresponding to the association trigger request are collaboration objects participating in the same activity scene, and the operation of each object may affect the operation results of other collaboration objects, so that the target behavior tree test case may perform a joint operation decision with the current execution state information in the association trigger request based on the current execution state information in the current test trigger request, and obtain the target operation corresponding to the current test trigger request. Therefore, when each associated trigger request is traversed, the target operation corresponding to each test trigger request can be determined. The description of the competitive relationship is similar to the cooperative relationship, and is not repeated here.
Further, when the client to be tested sends the test trigger request to the test execution end, the test trigger request may further include an object identifier of the associated object, so that the test execution end may determine the associated trigger request based on the object identifier of the associated object in the plurality of test trigger requests, thereby improving convenience and efficiency of determining the associated trigger request.
Further, when the client to be tested sends the test trigger request to the test execution end, the test trigger request may further include a scene identifier where each object is currently located, so that the test execution end may determine the test trigger request with the same scene identifier as the associated trigger request based on the scene identifiers in the multiple test trigger requests.
Therefore, when the operation decision is made based on the current test trigger request, the associated trigger request can be further considered, because the operation determined based on the associated trigger request may have an influence on the operation determined based on the current test trigger request, the joint decision is made through the multi-party test trigger request to obtain the target operation corresponding to each test trigger request, and the accuracy of the determination of the target operation can be improved.
Referring to fig. 4, a method for determining a target operation is shown, which may include:
s410, obtaining node execution cache information corresponding to the target behavior tree test case; the node execution cache information comprises a first interrupt node for running the target behavior tree test case last time; the first interrupt node is any behavior tree node in the target behavior tree test case.
S420, starting to execute the target behavior tree test case from the first interrupt node to obtain the target operation.
The node execution cache information specifically comprises context information of the target behavior tree test case in the execution process and interrupt node information during execution interrupt, so that in the process of continuously executing the target behavior tree test case, the context information of the target behavior tree test case executed last time and the terminal node information restore the environment information of the last execution end, the execution can be continuously executed from the interrupt node directly based on the environment information of the last execution end, the behavior tree does not need to be executed again from the root node of the target behavior tree test case, and the execution efficiency of the target behavior tree test case is improved on the basis of ensuring the correct operation of the target behavior tree test case.
Further, in order to improve the data acquisition efficiency, the test execution end may store the node execution cache information of the preset number of times into the local memory, and may directly acquire the node execution cache information from the local memory when the node execution cache information is needed.
Further, the test trigger request may further include a trigger serial number, where the trigger serial number may be generated and sent by the client to be tested, and the trigger serial number may specifically be a self-increasing integer; for example, the trigger sequence number carried by the last test trigger request is 19, the trigger sequence number carried by the test trigger request sent this time may be 20, the trigger sequence number carried by the test trigger request sent next time may be 21, and so on. Accordingly, referring to FIG. 5, another method of target operation determination is illustrated that may include:
and S510, under the condition that the trigger serial number of the currently received test trigger request is consistent with the trigger serial number of the last received test trigger request, determining the last trigger serial number of the currently received trigger serial number.
S520, obtaining node execution cache information corresponding to the last trigger sequence number from a public cache area, and determining a second interrupt node from the node execution cache information; and the second interrupt node is any behavior tree node in the target behavior tree test case.
S530, starting to execute the target behavior tree test case from the second interrupt node to obtain the target operation.
When the trigger sequence number of the currently received test trigger request is consistent with the trigger sequence number of the last received test trigger request, it indicates that packet loss may occur at this time. Under the condition of packet loss, the test execution end returns a corresponding operation instruction based on the last received test trigger request, but because the network connection is unstable or the to-be-tested client fails, the to-be-tested client does not receive the operation instruction, so the to-be-tested client starts a retry mechanism, that is, the same test trigger request as the last time is sent again, the trigger sequence number of the test trigger request is also the same as the trigger sequence number of the last test trigger request, at this time, the last trigger sequence number of the current trigger sequence number can be determined, and the last trigger sequence number can be obtained after the current trigger sequence number is subtracted by one.
Because the test trigger request carrying the previous trigger sequence number is processed, the corresponding node execution cache information can be acquired from the public cache region to recover the environment information when the test trigger request carrying the previous trigger sequence number is executed. The execution can be continued from the interrupt node directly based on the environmental information when the last execution is finished, and the behavior tree does not need to be run again from the root node of the target behavior tree test case, so that the execution efficiency of the target behavior tree test case is improved on the basis of ensuring the correct running of the target behavior tree test case. In addition, the accuracy and adaptability of the test result are improved through a retry mechanism. For example, the probe execution end executes tick20, but the client to be tested does not receive the tick because of a network problem, then the next time the upstream packet has a retry mechanism, the tick sequence number is still 20, the probe execution end knows that the tick20 packet is lost, and then the node execution information is restored to tick19 and the target behavioral tree test case is executed again.
Furthermore, the test execution end can support distributed deployment, that is, the test execution end can be a distributed cluster, which includes a plurality of test servers, and each test server can deploy the same target behavior tree test case, thereby improving the concurrency capability during automated testing. The node execution cache information is stored through the public cache region, so that different test servers in the distributed cluster can acquire the corresponding node execution cache information from the public cache region. Specifically, referring to fig. 6, taking a game scene as an example, the distributed cluster includes a tool server 1 and a tool server 2, which show a tick timing chart in the game scene, where a public cache region caches node execution cache information and a tick serial number, when the tick serial number in an uplink packet of a client to be tested is different from a currently expected tick serial number, that is, the currently expected tick serial number is tick serial number +1 in a memory, if the tick serial number is expected, it is not necessary to obtain data in the public cache region, the node execution cache information may be serialized and then stored in the public cache region, and when the tick serial number is taken out for use, deserialization processing is required. The specific implementation process may include:
1. the game client sends a request instruction seq.
2. The tool service 1 executes a behavior tree.
3. The context of the sequence seq is cached.
4. And the game client re-requests the command seq, and the network exception causes packet loss.
5. The context of sequence seq-1 is restored.
6. The facility service 1 executes the behavior tree based on the restored context environment.
7. The context of the sequence seq is cached.
8. The game client sends a request command seq +1, the tool server 1 goes wrong or busy, and the request is routed to the tool server 2.
9. The tool server 2 restores the context of the seq.
10. The tool server 2 executes the behavior tree based on the context of the seq.
In addition, the tool server provides a heartbeat mechanism to maintain the connection status of the client, and the timeout may be generally caused by the client crashing.
Referring to fig. 7, a method for processing target operation data is shown, which may include:
and S710, in the process of executing the target behavior tree test case, determining a target node in a target state.
S720, determining the preset operation corresponding to the target node as the target operation.
And S730, caching the node execution information of the target node into a public cache region.
Caching the node execution information into a public cache region so that each test server in the distributed cluster can be called; in the application, a target behavior tree test case runs at a remote test execution end, an uplink packet of a client to be tested drives the running of the target behavior tree, each uplink packet triggers one tick, when a behavior node returns to running state, the current tick execution is finished, the behavior tree can store the current execution context for the next tick to use, the execution steps of the behavior node are serialized and transmitted to the client to be tested, and the client to be tested becomes a test interface through reflection to call. For example, the code of Unity is written in C #, so that the information such as function name, parameter, etc. can be reflected as a specific function call (UI operation is actually a function call, but is a function defined by SDK); the unlua assembly also has the same reflective capability. Thus, a test interface does not need to be written for each client behavior, and the developed code functions can be directly used to help complete the execution of the test steps. Specifically, for the execution flow of the behavior tree, refer to fig. 8, where an op instruction is an abbreviation of an execution step, and includes information such as an executed instruction tag, an instruction parameter, and a global parameter list that needs to be subscribed, and for an error state, an error may cause the behavior tree to fail to execute (unless an exception handling node is defined, like an exception handling in code); for the fail state, the fail determines whether the behavior tree can continue to execute down based on the processing logic of its parent node (e.g., some loop nodes utilize the fail state to abort loops).
Further, before returning the operation instruction to the client to be tested, the target operation may also be processed, please refer to fig. 9, which shows an operation instruction generating method, which may include:
and S910, carrying out serialization processing on the target operation to obtain serialization operation information.
And S920, generating the operation instruction based on the serialized operation information.
Target operation obtained based on the target behavior tree test case may not be suitable for direct network transmission, so that the target operation can be serialized to obtain serialized operation information; specifically, the target operation may be serialized into jason data, and then an instruction for instructing the client to be tested to execute the operation is added on the basis of the serialized operation information, so that an operation instruction may be generated. When the client to be tested receives the operation instruction, the client to be tested can firstly perform deserialization operation and then perform corresponding operation based on the deserialized operation data. When data transmission is carried out, firstly, serialization processing is carried out on target operation data, so that the processed data are suitable for network transmission, and the transmission efficiency of the data can be improved.
To further improve the flexibility and robustness of the behavioral tree test case and to implement the asynchronous branch function of the behavioral tree test case, referring to fig. 10, a method for generating a target behavioral tree test case may include:
s1010, a plurality of testing subtrees corresponding to the testing functions are created in advance.
S1020, selecting a target sub-tree from the plurality of test sub-trees based on the test target of the client to be tested.
And S1030, generating the target behavior tree test case based on the target subtree.
Different test subtrees can realize different functions, the test subtrees with different functions can be preset, and the test subtrees can be used as minimum functional units in the target behavior tree test case, namely the minimum functional units can realize specific functions. In the specific application process, the corresponding function to be tested can be determined according to the test target of the client to be tested, the test subtrees with the corresponding functions are selected from the plurality of test subtrees, and then the test subtrees are combined based on the implementation logic to obtain the corresponding target behavior tree test case.
The asynchronous branch function of the behavior tree can be realized through the function of the test subtree, and the asynchronous branch function is similar to a coroutine mechanism and provides the capability of multithreading transaction processing in the behavior tree. When the behavior tree executes the asynchronous node, the behavior tree has the concept of a primary branch and a secondary branch, and the secondary branch can trigger a conditional interrupt mechanism of the primary branch by modifying a blackboard value so as to change the execution path of the primary branch. The secondary branch is generally used for monitoring some abnormal conditions (the execution frequency is reduced by using a timer node), the main branch performs core logic processing, and the primary branch and the secondary branch are matched to realize the asynchronous processing capability of the behavior tree, so that the flexibility of the use case is improved. For example, a user can uniformly place abnormal boxes in a game to a secondary branch (packaged by a subtree function) for processing, so that all use cases can have consistent abnormal processing capacity only by referring to the subtree. With the asynchronous capability, a large string of logic similar to the ifelse does not need to be written when the test case is written, the main branch processes the main logic, and some abnormal conditions (such as error box popping) are processed by the asynchronous branch, so that the flexibility is greatly improved. With the existence of the subtree function, as with function encapsulation, repeated general logic does not need to be rewritten, and general branches can be abstracted into subtrees to be applied to all use cases. Here, an example of a gunfight game is given: if a role is to be realized in a scene that the gun is always opened and the gun is continuously opened after the bullet is used up and is changed, the continuous gun opening can be held to be put into the main branch, a state is used for controlling the switch, and the number of the bullets is judged by using the asynchronous branch A, the gun opening switch is closed and the bullet change is executed; the advantage of doing so is when newly increased demand: when the role has no blood, the role uses the blood bag to open the gun again, and can be directly processed by a new asynchronous branch B, the branches A and B do not interfere with each other, and the use case of the main branch does not need to be modified. See figure 11 for a flow chart of the asynchronous branching function.
Furthermore, the function of a subtree with strong reusability can be realized, the behavior tree can be specifically allowed to establish the data private domain of the subtree, and the subtree can access local variables belonging to the subtree; meanwhile, the subtrees have a parameter transmission function, and the reusability of the subtrees is improved.
In addition, the embodiment of the application provides rich UI node fuzzy matching capability (path prefix, middle suffix, traversal according with rules, UI text content matching and the like), the rules can be customized according to the requirements of the users, and the use case maintenance cost caused by game UI change is effectively reduced. Specifically, the developer is helped to write more flexible use cases through capabilities like wildcards, cyclic processing of child nodes and the like, for example, 5 buttons are arranged under one page, the next button needs to be clicked in sequence, originally 5 button paths need to be obtained and clicked 5 times, and all the button child nodes are directly clicked after optimization. In addition, positioning the UI by a fuzzy path (wildcard) is also a very important function, and helps to cope with a case where the UI path is frequently changed. For example, the UI node data to be uploaded from the client to be tested needs to use the absolute path of the UI node, and positioning to the UI node using the relative path, or positioning the UI node according to the text content of the UI, or the capability of operating the UI node in batch can be realized by fuzzy matching; because the UI node path is changed frequently, the UI node fuzzy matching method is adopted when the test case is written, the UI node is positioned by using the relative path or the text content, the test case can be prevented from being modified when the UI node path is changed every time, and the robustness of the test case can be improved.
By adopting the method of remote control test, the problem of thermal update of the test case is effectively solved, so that the update of the test case is decoupled from the client; the target behavior tree test case has node concurrency capability and is more suitable for automation scenes with complex contexts (such as abnormal interruption, multi-terminal cooperation, conditional interruption and the like) like games; the frequency of the tick depends on the frequency of the uplink packet of the client, so that the frequency of the uplink packet can be flexibly adjusted according to the condition of server resources, and the waste of the server resources is avoided.
The present embodiment further provides an automatic testing apparatus, referring to fig. 12, the apparatus may include:
a test trigger request receiving module 1210, configured to receive a test trigger request sent by a client to be tested; the test trigger request comprises the current running state information of the client to be tested;
a target operation determining module 1220, configured to make an operation decision based on the target behavior tree test case, so as to obtain a target operation matched with the current running state information; the target behavior tree test case is determined based on target execution logic of the client to be tested, and the target execution logic is matched with a test target of the client to be tested;
an operation instruction returning module 1230, configured to return an operation instruction including the target operation to the client to be tested; the operation instruction is used for instructing the client to be tested to execute the target operation based on the current running state information to obtain a target test result corresponding to the current running state information.
Further, the test trigger request is a test trigger request sent by each of the plurality of clients to be tested; the test trigger requests sent by the multiple clients to be tested also carry object identifiers;
the target operation determination module 1220 includes:
the traversal module is used for traversing the test trigger requests sent by the multiple clients to be tested respectively;
the relevant trigger request determining module is used for determining the relevant trigger request of the current test trigger request; the object identification of the current test trigger request and the object identification of the association trigger request have an association relation; the associated trigger request is at least one test trigger request except the current test trigger request in the test trigger requests sent by the multiple clients to be tested respectively;
and the joint decision module is used for carrying out joint operation decision based on the target behavior tree test case, the current running state information of the current test trigger request and the current running state information of the associated trigger request to obtain the target operation corresponding to the current test trigger request.
Further, the apparatus further comprises:
the first obtaining module is used for obtaining node execution cache information corresponding to the target behavior tree test case; the node execution cache information comprises a first interrupt node for running the target behavior tree test case last time; the first interrupt node is any behavior tree node in the target behavior tree test case;
the target operation determination module 1220 includes:
and the first execution module is used for executing the target behavior tree test case from the first interrupt node to obtain the target operation.
Further, the test trigger request comprises a trigger sequence number;
the device further comprises:
the first determining module is used for determining the last trigger serial number of the current trigger serial number under the condition that the trigger serial number of the currently received test trigger request is consistent with the trigger serial number of the last received test trigger request;
a second obtaining module, configured to obtain, from a public cache area, node execution cache information corresponding to the previous trigger sequence number, and determine a second interrupt node from the node execution cache information; the second interrupt node is any behavior tree node in the target behavior tree test case;
the target operation determination module 1220 includes:
and the second execution module is used for executing the target behavior tree test case from the second interrupt node to obtain the target operation.
Further, the target operation determination module 1220 includes:
the target node determining module is used for determining a target node in a target state in the process of executing the target behavior tree test case;
the second determining module is used for determining a preset operation corresponding to the target node as the target operation;
the device further comprises:
and the information caching module is used for caching the node execution information of the target node into a public cache region.
Further, the apparatus further comprises:
the serialization processing module is used for carrying out serialization processing on the target operation to obtain serialization operation information;
and the operation instruction generating module is used for generating the operation instruction based on the serialized operation information.
Further, the apparatus further comprises:
the test sub-tree creating module is used for creating a plurality of test sub-trees corresponding to the plurality of test functions in advance;
the target sub-tree selection module is used for selecting a target sub-tree from the plurality of test sub-trees based on a test target of the client to be tested;
and the case generating module is used for generating the target behavior tree test case based on the target subtree.
The device provided in the above embodiments can execute the method provided in any embodiment of the present application, and has corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in the above embodiments may be referred to a method provided in any of the embodiments of the present application.
The present embodiment also provides a computer-readable storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or the at least one program is loaded by a processor and executes any one of the methods described in the present embodiment.
According to an aspect of the application, a computer program product or computer program is provided, comprising computer instructions, the computer instructions being stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform any of the methods described above.
Referring to fig. 13, the apparatus 1300 may include one or more Central Processing Units (CPUs) 1322 (e.g., one or more processors) and a memory 1332, and one or more storage media 1330 (e.g., one or more mass storage devices) storing applications 1342 or data 1344. Memory 1332 and storage media 1330 may be, for example, transitory or persistent storage. The program stored on the storage medium 1330 may include one or more modules (not shown), each of which may include a sequence of instructions operating on a device. Still further, central processor 1322 may be provided in communication with storage medium 1330 for performing a series of instruction operations on storage medium 1330 on device 1300. The apparatus 1300 may also include one or more power supplies 1326, one or more wired or wirelessA wired network interface 1350, one or more input-output interfaces 1358, and/or one or more operating systems 1341, such as Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTMAnd so on. Any of the methods described above in this embodiment can be implemented based on the apparatus shown in fig. 13.
The present specification provides method steps as described in the examples or flowcharts, but may include more or fewer steps based on routine or non-inventive labor. The steps and sequences recited in the embodiments are but one manner of performing the steps in a multitude of sequences and do not represent a unique order of performance. In the actual system or interrupted product execution, it may be performed sequentially or in parallel (e.g., in the context of parallel processors or multi-threaded processing) according to the embodiments or methods shown in the figures.
The configurations shown in the present embodiment are only partial configurations related to the present application, and do not constitute a limitation on the devices to which the present application is applied, and a specific device may include more or less components than those shown, or combine some components, or have an arrangement of different components. It should be understood that the methods, apparatuses, and the like disclosed in the embodiments may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a division of one logic function, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or unit modules.
Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. An automated testing method, comprising:
receiving a test trigger request sent by a client to be tested; the test trigger request comprises the current running state information of the client to be tested;
performing operation decision based on the target behavior tree test case to obtain target operation matched with the current running state information; the target behavior tree test case is determined based on target execution logic of the client to be tested, and the target execution logic is matched with a test target of the client to be tested;
returning an operation instruction containing the target operation to the client to be tested; the operation instruction is used for instructing the client to be tested to execute the target operation based on the current running state information to obtain a target test result corresponding to the current running state information.
2. The method according to claim 1, wherein the test trigger request is a test trigger request sent by each of a plurality of clients to be tested; the test trigger requests sent by the multiple clients to be tested also carry object identifiers;
the operation decision is carried out based on the target behavior tree test case to obtain the target operation matched with the current running state information, and the method comprises the following steps:
traversing the test trigger requests sent by the plurality of clients to be tested respectively;
determining an associated trigger request of the current test trigger request; the object identification of the current test trigger request and the object identification of the association trigger request have an association relation; the associated trigger request is at least one test trigger request except the current test trigger request in the test trigger requests sent by the multiple clients to be tested respectively;
and performing a joint operation decision based on the target behavior tree test case, the current running state information of the current test trigger request and the current running state information of the associated trigger request to obtain a target operation corresponding to the current test trigger request.
3. The method of claim 1, wherein the performing an operation decision based on the target behavior tree test case to obtain a target operation matched with the current running state information further comprises:
acquiring node execution cache information corresponding to the target behavior tree test case; the node execution cache information comprises a first interrupt node for running the target behavior tree test case last time; the first interrupt node is any behavior tree node in the target behavior tree test case;
the operation decision is carried out based on the target behavior tree test case to obtain the target operation matched with the current running state information, and the method comprises the following steps:
and starting to execute the target behavior tree test case from the first interrupt node to obtain the target operation.
4. The method of claim 1, wherein the test trigger request comprises a trigger sequence number;
the method further comprises the following steps:
under the condition that the trigger serial number of the currently received test trigger request is consistent with the trigger serial number of the last received test trigger request, determining the last trigger serial number of the currently received trigger serial number;
acquiring node execution cache information corresponding to the last trigger sequence number from a public cache region, and determining a second interrupt node from the node execution cache information; the second interrupt node is any behavior tree node in the target behavior tree test case;
the operation decision is carried out based on the target behavior tree test case to obtain the target operation matched with the current running state information, and the method comprises the following steps:
and starting to execute the target behavior tree test case from the second interrupt node to obtain the target operation.
5. The method of claim 1, wherein the performing an operation decision by the target behavior tree test case to obtain a target operation matched with the current running state information comprises:
determining a target node in a target state in the process of executing the target behavior tree test case;
determining a preset operation corresponding to the target node as the target operation;
the target behavior tree test case makes an operation decision to obtain a target operation matched with the current running state information, and then the method further comprises the following steps:
and caching the node execution information of the target node into a public cache region.
6. The method of claim 1, wherein returning an operation instruction containing the target operation to the client to be tested further comprises:
carrying out serialization processing on the target operation to obtain serialization operation information;
and generating the operation instruction based on the serialized operation information.
7. The method according to any one of claims 1-6, further comprising:
pre-creating a plurality of test subtrees corresponding to the plurality of test functions;
selecting a target subtree from the plurality of test subtrees based on a test target of the client to be tested;
and generating the target behavior tree test case based on the target subtree.
8. An automated testing apparatus, comprising:
the test trigger request receiving module is used for receiving a test trigger request sent by a client to be tested; the test trigger request comprises the current running state information of the client to be tested;
the target operation determining module is used for making an operation decision based on the target behavior tree test case to obtain target operation matched with the current running state information; the target behavior tree test case is determined based on target execution logic of the client to be tested, and the target execution logic is matched with a test target of the client to be tested;
the operation instruction returning module is used for returning an operation instruction containing the target operation to the client to be tested; the operation instruction is used for instructing the client to be tested to execute the target operation based on the current running state information to obtain a target test result corresponding to the current running state information.
9. An electronic device, comprising a processor and a memory, wherein at least one instruction or at least one program is stored in the memory, and wherein the at least one instruction or the at least one program is loaded and executed by the processor to implement the automated testing method according to any one of claims 1 to 7.
10. A computer storage medium having stored therein at least one instruction or at least one program, the at least one instruction or the at least one program being loaded by a processor and executing the automated testing method of any of claims 1 to 7.
CN202210059715.9A 2022-01-19 2022-01-19 Automatic testing method and device, electronic equipment and storage medium Pending CN114398286A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210059715.9A CN114398286A (en) 2022-01-19 2022-01-19 Automatic testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210059715.9A CN114398286A (en) 2022-01-19 2022-01-19 Automatic testing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114398286A true CN114398286A (en) 2022-04-26

Family

ID=81230676

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210059715.9A Pending CN114398286A (en) 2022-01-19 2022-01-19 Automatic testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114398286A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116227395A (en) * 2022-12-26 2023-06-06 爱芯元智半导体(上海)有限公司 Simulation test method and device for digital chip and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116227395A (en) * 2022-12-26 2023-06-06 爱芯元智半导体(上海)有限公司 Simulation test method and device for digital chip and electronic equipment
CN116227395B (en) * 2022-12-26 2023-09-29 爱芯元智半导体(上海)有限公司 Simulation test method and device for digital chip and electronic equipment

Similar Documents

Publication Publication Date Title
CN110389900B (en) Distributed database cluster testing method and device and storage medium
US10255102B2 (en) Transaction control arrangement for device management system
CN111651352B (en) Warehouse code merging method and device
CN110781576B (en) Simulation node scheduling method, device and equipment
CN110297640A (en) Method, apparatus, storage medium and the electronic equipment of model deployment
CN111930466A (en) Kubernetes-based data synchronization environment deployment method and device
CN116737130B (en) Method, system, equipment and storage medium for compiling modal-oriented intermediate representation
CN114398286A (en) Automatic testing method and device, electronic equipment and storage medium
CN115543315A (en) Method and system for controlling page interaction by using data model
CN117539459B (en) API interface configuration method, system and equipment
CN112799959A (en) Interface test method, device, storage medium and electronic device
CN114168252A (en) Information processing system and method, network scheme recommendation component and method
US7437705B1 (en) System and method for building an application on a computing device which includes an environment-controlling process
CN114090211A (en) Method and device for coordinating single-task master-slave program and related multi-server system
US8265789B2 (en) Network-based robot system and method for action execution of robot
CN113296809A (en) Declarative universal Kubernetes tuning method
CN112667375A (en) Task scheduling method and system based on big data service
CN113011507B (en) Method for establishing synchronous time prediction model, data synchronization method and corresponding device
CN114924919B (en) Node management test method, system and storage medium
CN110147247B (en) Method for realizing management software multitask based on C language
CN115480786A (en) Method, system, device and storage medium for deploying model
CN107562525B (en) Cooperative scheduling method between remote sensing image processing heterogeneous platforms
WO2007096591A2 (en) Configuring devices in a telecommunications network to provide a service
CN113946337A (en) Compile backlog method, compile backlog device, electronic device, and storage medium
CN113839820A (en) Method and system for searching optimal network updating node during service updating

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