Virtual scene testing methods, devices, equipment and storage media
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-23
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]以小游戏场景为例,由于场景元素类型、样式更为丰富,动态性更强,相关技术中,根据机器学习模型的输出结果来判断应用场景是否相同,或者以两个游戏场景截屏为输入,并通过计算图片相似度的方式判断两个游戏场景是否相同,而上述方式均较难判断测试操作是否产生了有效的场景跳转,判别场景是否发生跳转和变化的准确率低
Smart Images

Figure CN113760743B_ABST
Abstract
Description
Technical Field
[0001] This application relates to artificial intelligence technology, and more particularly to a method, apparatus, device, and computer-readable storage medium for testing virtual scenes. Background Technology
[0002] Artificial intelligence (AI) is the theory, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0003] With the development of computer technology, electronic devices can realize richer and more vivid virtual scenes. The requirements for scene testing of virtual scenes are becoming increasingly higher. When conducting scene testing of virtual scenes, it is usually necessary to identify the similarities and differences between scenes during operation, determine whether the scene changes as the test progresses, and help the test decision-maker make better operational decisions as much as possible, so that the test process can cover more game scenes.
[0004] Taking mini-game scenarios as an example, since the types and styles of scene elements are richer and more dynamic, related technologies use the output of machine learning models to determine whether the application scenarios are the same, or take screenshots of two game scenarios as input and calculate the similarity of the images to determine whether the two game scenarios are the same. However, the above methods are difficult to determine whether the test operation has produced a valid scene jump, and the accuracy of judging whether the scene has jumped and changed is low. Summary of the Invention
[0005] This application provides a method, apparatus, device, and computer-readable storage medium for testing virtual scenes, which can effectively identify whether the scene has changed, accurately divide different scenes and merge the same scenes, and improve the coverage of test scenes.
[0006] The technical solution of this application embodiment is implemented as follows: This application provides a method for testing virtual scenes, including: Obtain the first set of operable elements corresponding to the first scene in the virtual scene, and the second set of operable elements corresponding to the second scene in the virtual scene; Determine the element similarity between each first operable element in the first operable element set and each second operable element in the second operable element set; Based on the element similarity, the scene similarity between the first scene and the second scene is determined, and when the scene similarity reaches a similarity threshold, the first scene and the second scene are merged to obtain a merged scene; Scenario testing is performed on the merged scenario instead of performing scenario testing on the first scenario and the second scenario.
[0007] This application provides a scene testing device for a virtual scene, comprising: The acquisition module is used to acquire the first set of operable elements corresponding to the first scene in the virtual scene, and the second set of operable elements corresponding to the second scene in the virtual scene; The determination module is used to determine the element similarity between each first operable element in the first operable element set and each second operable element in the second operable element set; The merging module is used to determine the scene similarity between the first scene and the second scene based on the element similarity, and merge the first scene and the second scene when the scene similarity reaches a similarity threshold to obtain a merged scene; The testing module is used to perform scenario testing on the merged scenario instead of performing scenario testing on the first scenario and the second scenario.
[0008] In the above scheme, the acquisition module is further used to acquire multiple scene elements in the first scene; Operable element identification is performed on the plurality of scene elements to determine the operable elements in the first scene; Based on the determined operable elements in the first scenario, a first set of operable elements corresponding to the first scenario is constructed.
[0009] In the above scheme, when performing operable element identification on the multiple scene elements, the acquisition module is further configured to perform the following operations for each scene element in the first scene: Obtain the attribute value corresponding to each of the multiple attributes of the scene element; Based on the obtained attribute values of the scene elements, the feature vector of the scene elements is determined; The feature vectors of the scene elements are input into a classification model for classification, and the classification results are used to indicate whether the scene elements are operable elements.
[0010] In the above scheme, the determining module is further configured to construct a first scene tree using scene elements of the first scene as nodes, and construct a second scene tree using scene elements of the second scene as nodes; Obtain the first node chain of the first operable element in the first scene tree, and the second node chain of the second operable element in the second scene tree; Based on the first node chain and the second node chain, determine the element similarity between the first operable element and the second operable element.
[0011] In the above scheme, the determining module is further used to obtain the first chain length corresponding to the first node chain and the second chain length corresponding to the second node chain; The lengths of the first chain and the second chain are compared to obtain the comparison result; When the comparison result indicates that the length of the first chain is equal to the length of the second chain, the information difference score between the first node chain and the second node chain is determined; Based on the information difference score, the element similarity between the first operable element and the second operable element is determined.
[0012] In the above scheme, the determining module is further configured to determine that the element similarity between the first operable element and the second operable element is lower than the element similarity threshold when the comparison result indicates that the length of the first chain and the length of the second chain are not equal, so as to indicate that the first operable element and the second operable element are different elements.
[0013] In the above scheme, the merging module is further used to mark the first operable element and the second operable element when the element similarity reaches the similarity threshold, so as to indicate that the first operable element and the second operable element are similar elements; Determine the number of marked operable elements in the first set of operable elements and the second set of operable elements; Based on the number of marked operable elements, the scene similarity between the first scene and the second scene is determined.
[0014] In the above scheme, the merging module is also used to obtain the total number of operable elements in the first scene and the second scene; The ratio of the number of marked operable elements to the total number is determined, and the determined ratio is used as the scene similarity between the first scene and the second scene.
[0015] In the above scheme, the merging module is further used to merge the first set of operable elements and the second set of operable elements to obtain the union of operable elements; Accordingly, the testing module is also used to perform scenario testing on each operable element in the set of operable elements, instead of performing scenario testing on the first scenario and the second scenario.
[0016] This application provides an electronic device, including: Memory, used to store executable instructions; The processor, when executing executable instructions stored in the memory, implements the scene testing method for the virtual scene provided in the embodiments of this application.
[0017] This application provides a computer-readable storage medium storing executable instructions for inducing a processor to execute, thereby implementing the virtual scene testing method provided in this application.
[0018] The embodiments of this application have the following beneficial effects: This application embodiment obtains a first set of operable elements corresponding to a first scene in a virtual scene, and a second set of operable elements corresponding to a second scene in the virtual scene; determines the element similarity between each first operable element in the first set of operable elements and each second operable element in the second set of operable elements; based on the element similarity, determines the scene similarity between the first scene and the second scene, and when the scene similarity reaches a similarity threshold, merges the first scene and the second scene to obtain a merged scene; performs scene testing on the merged scene instead of performing scene testing on the first scene and the second scene; thus, in the scene testing of the virtual scene, the scene similarity is determined based on the element similarity between operable elements in different scenes, thereby realizing the merging of scenes whose scene similarity reaches a similarity threshold, which can effectively identify whether the scene has changed, achieve accurate division of different scenes and merging of the same scenes, and improve the test scene coverage. Attached Figure Description
[0019] Figure 1 This is an optional architecture diagram of the virtual scene testing system provided in the embodiments of this application; Figure 2 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application; Figure 3 This is an optional flowchart illustrating a virtual scene testing method provided in an embodiment of this application. Figures 4A-4B This is a schematic diagram of the virtual scene interface provided in the embodiments of this application; Figure 5This is a schematic diagram of the tree structure data and element attributes corresponding to the scenario provided in the embodiments of this application; Figure 6 This is a schematic diagram of the process for determining operable elements in the scenario provided in the embodiments of this application; Figure 7 This is a schematic diagram of the scene tree corresponding to the scene provided in the embodiments of this application; Figure 8 This is a schematic diagram of the operable element similarity matching algorithm provided in the embodiments of this application; Figure 9 This is an optional flowchart illustrating a virtual scene testing method provided in an embodiment of this application. Figure 10 This is an optional flowchart illustrating a virtual scene testing method provided in an embodiment of this application. Figure 11 This is an optional schematic diagram of a virtual scene testing method provided in an embodiment of this application; Figure 12 This is a schematic diagram illustrating the total number of scenarios covered by the two Monkey tests provided in this application embodiment. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0021] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0022] If the application documents contain similar descriptions such as "first / second", the following explanation shall be added: In the following description, the terms "first / second / third" are used only to distinguish similar objects and do not represent a specific order of objects. It is understood that "first / second / third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0023] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0024] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0025] 1) A virtual scene is a virtual scene displayed (or provided) by an application when it runs on a terminal. This virtual scene can be a simulation of the real world, a semi-simulated / semi-fictional virtual environment, or a purely fictional virtual environment. A virtual scene can be any of a two-dimensional, 2.5-dimensional, or three-dimensional virtual scene; this application does not limit the dimension of the virtual scene. For example, a virtual scene may include the sky, land, ocean, etc., and the land may include environmental elements such as deserts and cities. Users can control virtual objects to move within this virtual scene.
[0026] In some embodiments, the above application can be set up on the terminal as an independent client, or loaded and run through the parent application as a sub-application, such as a mini-game loaded and run through an instant messaging client; Here, mini-games refer to game products implemented using JavaScript that are embedded in instant messaging clients, social networking clients, and other clients. They can be created and compiled using engines such as Cocos, Laya, and Egret, and are usually small in size, require no installation, and can be played immediately.
[0027] 2) Monkey testing: refers to a standardized automated testing tool that can automatically explore the operation mode of the application under test without human intervention, performing different clicks, swipes and other operations, thereby achieving coverage of the interface of the application under test in different scenarios.
[0028] The inventors discovered that when testing related virtual scenarios, especially mini-game scenarios, because all game content is organized on a single page and lacks clear scenario and page identifiers as in traditional client application testing, it is difficult to determine whether the test operation has resulted in a valid scenario transition.
[0029] In related technologies, one method to determine whether plagiarism exists between games is to compare the cost of modifying scenes between different games, i.e., to compare the similarity between mini-game scenes. This method is applied to different games to judge whether the scenes are similar or plagiarized based on the differences in scene modifications between different games. However, within the same game, scenes themselves have a high degree of similarity, and the differences in modification between them are inherently low, such as the difference of adding or removing a pop-up in the same scene. Therefore, using this method will produce more false positives, easily classifying different scenes within the same game as the same scene.
[0030] Meanwhile, client application testing also has a similar need to compare whether the interface changes during application operation. In some embodiments, a twinned long short-term memory neural network is used to vectorize the interface information of two client applications and input it into the neural network model. The model output is then used to determine whether the application interfaces are the same. However, this method is suitable for Android application testing scenarios. In mini-game scenarios, due to the richer types and styles of scene elements and the greater dynamism, this method is not suitable for determining the similarities and differences between mini-game scenes.
[0031] In other embodiments, methods are also used to determine whether two game scene screenshots are the same scene by using image similarity as input. For example, image similarity processing algorithms can be used. This method is quite sensitive to image resolution; the accuracy of determining scene similarity is low when comparing game images from phones with different resolutions. Furthermore, within the same game, scenes inherently have high similarity, with minimal differences in modifications—for example, the difference might be the presence or absence of a pop-up window within the same scene. Therefore, this method can lead to numerous false positives, easily classifying different scenes within the same game as the same scene.
[0032] Based on this, embodiments of this application provide a method, apparatus, electronic device, and computer-readable storage medium for testing virtual scenes, which can effectively identify whether the scene has changed and realize the division of different scenes and the merging of the same scene.
[0033] First, the virtual scene testing system provided in the embodiments of this application will be described, see [link to relevant documentation]. Figure 1 , Figure 1 This is an optional architecture diagram of a virtual scene testing system 100 provided in this application embodiment. In order to realize a scene testing application that supports a virtual scene, terminal 400 (terminal 400-1 and terminal 400-2 are shown as examples) connects to server 200 through network 300.
[0034] In some embodiments, terminal 400 may be a laptop, tablet, desktop computer, smartphone, dedicated messaging device, portable gaming device, smart speaker, smartwatch, etc., but is not limited thereto. In actual implementation, terminal 400 has an application 410 installed and running for performing scene testing for virtual scenarios (applications 410-1 and 410-2 are shown as examples), based on which scene testing for virtual scenarios can be implemented.
[0035] Server 200 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Network 300 can be a wide area network (WAN), a local area network (LAN), or a combination of both. Terminal 400 and server 200 can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.
[0036] Terminal 400 (e.g., terminal 400-1) is used to send test instructions for scene testing of the virtual scene to server 200; in actual applications, the test instructions carry the identifier of the virtual scene. Server 200 is used to receive test instructions sent by terminal 400, and based on the test instructions, obtain a first set of operable elements corresponding to a first scene in the virtual scene, and a second set of operable elements corresponding to a second scene in the virtual scene; determine the element similarity between each first operable element in the first set of operable elements and each second operable element in the second set of operable elements; based on the element similarity, determine the scene similarity between the first scene and the second scene, and when the scene similarity reaches a similarity threshold, merge the first scene and the second scene to obtain a merged scene; perform scene testing on the merged scene instead of performing scene testing on the first scene and the second scene. Server 200 is also used to return scenario test results to terminal 400; Terminal 400 is also used to receive and present scenario test results sent by server 200.
[0037] The electronic device used for implementing the above-described virtual scene testing method, as provided in the embodiments of this application, will be described next. See [link to relevant documentation]. Figure 2 , Figure 2 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. In practical applications, the electronic device 500 can be implemented as follows: Figure 1 Terminal 400 or server 200 in the middle, with electronic devices as Figure 1 Taking the server 200 shown as an example, the electronic device that implements the scene testing method of the virtual scene in the embodiments of this application will be described. Figure 2The illustrated electronic device 500 includes at least one processor 510, a memory 550, at least one network interface 520, and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to implement communication between these components. In addition to a data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 2 The general labeled all buses as Bus System 540.
[0038] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0039] User interface 530 includes one or more output devices 531 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0040] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 550 may optionally include one or more storage devices physically located away from the processor 510.
[0041] The memory 550 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 550 described in this application embodiment is intended to include any suitable type of memory.
[0042] In some embodiments, memory 550 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0043] Operating system 551 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks; The network communication module 552 is used to reach other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc. Presentation module 553 is used to enable the presentation of information (e.g., user interface for operating peripheral devices and displaying content and information) via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with user interface 530. The input processing module 554 is used to detect and translate one or more user inputs or interactions from one or more input devices 532.
[0044] In some embodiments, the virtual scene testing device provided in this application can be implemented in software. Figure 2 A scene testing apparatus 555, which stores a virtual scene in memory 550, is shown. This apparatus can be software in the form of programs and plugins, and includes the following software modules: an acquisition module 5551, a determination module 5552, a merging module 5553, and a testing module 5554. These modules are logically connected and can therefore be arbitrarily combined or further separated according to their implemented functions. The functions of each module will be described below.
[0045] In other embodiments, the virtual scene testing device provided in this application can be implemented in hardware. As an example, the virtual scene testing device provided in this application can be a processor in the form of a hardware decoding processor, which is programmed to execute the virtual scene testing method provided in this application. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0046] In some embodiments, the virtual scene testing method provided in this application can be implemented by a server or a terminal alone, or by a server and a terminal working together. The following description uses server implementation as an example to illustrate the virtual scene testing method provided in this application. See also Figure 3 , Figure 3 This is an optional flowchart illustrating a virtual scene testing method provided in an embodiment of this application, which will be combined with... Figure 3 The steps shown are explained.
[0047] In step 101, the server obtains the first set of operable elements corresponding to the first scene in the virtual scene, and the second set of operable elements corresponding to the second scene in the virtual scene.
[0048] Here, we'll use a virtual scene as an example to illustrate the concept of a game. A game consists of multiple scenes, and each scene contains multiple elements and associated attribute information. Elements can be characters, screen buttons, etc. Among these, operable elements refer to clickable scene elements, and whether a scene element is clickable can be represented by its corresponding attribute values.
[0049] The process of obtaining the first scene is explained below. Obtaining the first scene actually involves obtaining the first scene data. Taking game scene data as an example, this is typically done using a game engine scene data interface (such as Cocos, Laya, Egret, etc.) to obtain the tree-structured data corresponding to the scene. This tree-structured data is then further encapsulated to construct object notation (JSON, JavaScript Object Notation) format data that maintains the tree structure. This JSON format data is used as the scene data in this embodiment. Different engine interfaces have different acquisition methods. The data extracted from the engine interface is often a complex object in memory. To facilitate the acquisition of physical data, the object's attributes are extracted one by one and re-encapsulated into a tree-structured scene data.
[0050] The process of obtaining a first set of operable elements corresponding to a first scene in a virtual scene is described below. In some embodiments, scene elements in the scene include operable elements and non-operable elements. Operable elements are identified, and a set of operable elements is constructed. This set of operable elements is used as input information for subsequent determination of the element similarity of operable elements. Specifically, multiple scene elements in the first scene are obtained; operable elements are identified from the multiple scene elements to determine the operable elements in the first scene; based on the determined operable elements in the first scene, a first set of operable elements corresponding to the first scene is constructed.
[0051] For example, see Figures 4A-4B , Figures 4A-4B This is a schematic diagram of a virtual scene interface provided in an embodiment of this application. As can be seen from the diagram, the scene elements in the game scene include at least operable elements (e.g., number 1), non-operable elements (e.g., number 2), and some operable areas (e.g., number 3). Figure 4ABy identifying operable elements within the scene elements, we can obtain... Figure 4B A list of operable elements.
[0052] The following explains how to identify operable elements in the 4A framework. In some embodiments, whether a scene element is operable is determined by a set of attributes associated with it. Specifically, for each scene element in the scene, the following operations are performed: obtain the attribute values corresponding to each of the multiple attributes of the scene element; determine the feature vector of the scene element based on the obtained attribute values; input the feature vector of the scene element into a classification model for classification to obtain a classification result, which is used to indicate whether the scene element is operable.
[0053] In practical implementation, taking a game scene as an example, for the same scene data, the attributes of each element obtained through different game engine interfaces are different. To ensure compatibility with the different attributes provided by different game engine interfaces, a common attribute set is set when processing scene data uniformly. This common attribute set is compatible with the attributes of elements in all different game engines, as well as custom attributes. The attribute sets associated with scene elements are processed uniformly to ensure that the attribute set corresponding to each scene element is a subset of the common attribute set. The attributes in the common attribute set include, but are not limited to, the following: Element identifier (id, Identification) is the element's number or other index information; element name refers to the element's designation in the scene; element tag characters refer to the string associated with the object's tag; element type (type) refers to the type corresponding to the element, such as button type. The class name corresponding to the element instance (name) refers to the name of the category to which the software code instance corresponding to the object belongs; element mask information (maskinfo) refers to whether the element is visible or invisible; element animation information (animationInfo) refers to how the element appears in the scene; element position (position) refers to the element's position in the world coordinate system; element visibility attribute (visible): visible or invisible; element event response attribute (hasEventListener): for example, whether a button responds to user clicks; element event list attribute (eventList), which refers to multiple corresponding events displayed in a list format; element scrollRect information: refers to the scroll bar information; position array (position: Array), the element's position in the engine's world coordinate system; action information related to the element (action_info: The `object` property contains information related to element event listeners, such as: a list of respondable events (`eventList`), whether the event listener is available (`listenerEnable`), and whether the listener has a mask, etc.; element-related features (`feature: object`), which is an aggregation of the element's feature attributes; a component collection (`components: Array`), which is a list of components attached to the element, including the name, type, availability, and other specific information of each component; an element type string (`nodeType: String`), a custom element type, which is formed by concatenating the element's `className` and component type (`className + "_" + component type, with component types separated by ";`); whether the element is displayed in the screen area (`show: Boolean`); and whether the element is valid (`enable: Boolean`), etc.
[0054] For example, see Figure 5 , Figure 5This is a schematic diagram of the tree structure data and element attributes corresponding to the scene provided in this application embodiment. In the diagram, the scene data information of the mini-game scene (number 1) is obtained through the game engine interface, and the tree structure of the scene data (number 2) is retained. Each node in the tree structure data corresponding to the scene represents a scene element in scene number 1. Each scene element has corresponding attribute information. For example, the attribute set listed in number 3 is the attribute set corresponding to the boxgress element in number 2. This application embodiment only lists some attributes as an example.
[0055] In some embodiments, the feature vector corresponding to the scene element is obtained by normalizing the attribute values of the scene element. Specifically, the attribute set corresponding to each scene element is obtained, the attribute value of each attribute in the attribute set is numericalized, and the numericalized attribute value is concatenated to obtain the attribute vector corresponding to that scene element.
[0056] For example, see Figure 6 , Figure 6 This is a schematic diagram illustrating the judgment process for operable elements in a scene provided in this application embodiment. The relevant attributes (number 1) corresponding to each scene element are extracted. These attributes include: enable (validity), visible (visibility), touchstart (start touch), touchend (end touch), touchcancel (cancel touch), touchmove (move touch), hasEventListener (respond to events), covered (covered), if_in_screen (in screen), etc. The attribute values of each attribute are then converted to numerical values, i.e., non-numeric attribute values are uniformly converted to numeric types. If the attribute type is already numeric, it is directly converted to a floating-point number; if it is a Boolean binary type, True is set to 1.0 and False to 0.0. These attribute values are then concatenated to construct an attribute vector (number 2, also called a feature vector) corresponding one-to-one with the scene element. The attribute value of each attribute in this vector is a numeric type (floating-point type).
[0057] It should be noted that, for ease of calculation, the attribute vectors concatenated from all scene elements have the same dimension. If a scene element's attribute set does not contain information for a certain dimension, but the attribute exists in the common attribute set, the information for that attribute in the scene element is set to a default value. For example, if the common attribute set contains 30 attributes, and the attribute set of scene element A only contains 20 attributes with values, the remaining 10 attributes are concatenated using the default values from the common attribute set to ensure that all attribute vectors have a dimension of 30.
[0058] Next, the feature vectors corresponding to the scene elements are input into a trained classification model (such as the XGBoost model) for classification. The output of this model (number 4) determines the clickability of each scene element represented by its feature vector; a 1 is output if the scene element is operable, and a 0 is output if it is not. It should be noted that the training process of this binary classification model (number 3) uses a large number of sampled attribute vectors (with the same dimension) from a portion of the game scenes as training samples. These training samples are then labeled (labeled as clickable or non-clickable), and the model is trained through multiple rounds based on these labeled training samples. Finally, based on the output of the classification model, the scene element corresponding to the feature vector with an output of 1 is obtained; this scene element is considered operable. By sequentially judging each scene element within the scene, a set of operable elements within that scene can be obtained as the operable element set of the scene.
[0059] In step 102, the element similarity between each first operable element in the first operable element set and each second operable element in the second operable element set is determined.
[0060] For the first scenario and the second scenario, after obtaining the set of operable elements corresponding to each scenario in step 101, the similarity between the first scenario and the second scenario is further measured by judging the element similarity between each operable element.
[0061] The calculation of element similarity between two operable elements is explained below. Calculating the element similarity between two operable elements cannot simply compare whether their attributes are the same; it is also necessary to compare the structural information of the operable elements (such as related elements, their position in the scene data structure, etc.). All of these factors must be considered during the comparison operation; otherwise, errors will occur. As described above, the scene data is a tree-structured data, preserving the hierarchical relationships between elements. Therefore, when comparing the element similarity between operable element A and operable element B individually, it is necessary to obtain other scene elements related to operable elements A and B. Given that the tree structure can reflect the relationships between nodes, based on this, the method of constructing the scene tree containing the scene element and obtaining the node chain corresponding to the operable element from the scene tree is used to determine the element similarity between two operable elements. Specifically, a first scene tree is constructed using scene elements of the first scene as nodes, and a second scene tree is constructed using scene elements of the second scene as nodes; a first node chain of the first operable element in the first scene tree and a second node chain of the second operable element in the second scene tree are obtained; based on the first node chain and the second node chain, the element similarity between the first operable element and the second operable element is determined.
[0062] In practice, a scene tree is constructed, with all scene elements treated as nodes, each corresponding to a specific scene. The attributes of each node are identical to those of its corresponding scene element. The node chain of the operable element being compared is then retrieved from the scene tree; this chain consists of all nodes along the path from the root node of the scene tree to the leaf node of that operable element. Comparing the element similarity between two operable elements is then transformed into comparing the element similarity of all nodes along the node chain of the operable element within the scene tree.
[0063] For example, see Figure 7 , Figure 7 This is a schematic diagram of the scene tree corresponding to the scene provided in the embodiments of this application. The first scene tree is constructed based on the scene elements in the first scene, and the second scene tree is constructed based on the scene elements in the second scene. The first scene and the second scene come from the same virtual scene (such as two different scenes from the same game). When comparing the element similarity between operable element A4 in the first scene and operable element B4 in the second scene, the node chain from root node A1 to A4, i.e., node chain A1->A2->A3->A4, is extracted in the first scene tree, and the node chain from root node B1 to B4, i.e., node chain B1->B2->B3->B4, is extracted in the second scene tree. The element similarity between A4 and B4 is determined by the information difference score between these two node chains. If comparing the element similarity between operable element A4 and B6, it is equivalent to comparing the information difference score between node chain A1->A2->A3->A4 and node chain B1->B5->B7.
[0064] In some embodiments, to reduce computational load, for operable elements with unequal node chain lengths, such as... Figure 7 In this process, A4 and B7 are directly identified as dissimilar, as are A8 and B6, and A8 and B7. Specifically, the length of the first chain corresponding to the first node chain and the length of the second chain corresponding to the second node chain are obtained; the lengths of the first chain and the second chain are compared to obtain a comparison result; when the comparison result indicates that the lengths of the first chain and the second chain are not equal, it is determined that the element similarity between the first operable element and the second operable element is lower than the element similarity threshold, indicating that the first operable element and the second operable element are different elements.
[0065] Only when the chain lengths of the node chains corresponding to two operable elements are equal will the similarity of the operable elements be further determined based on the information difference score between the two node chains. For example, when judging the element similarity between A4 and B4, and between A4 and B6, it is necessary to further calculate the information difference score between the corresponding node chains.
[0066] Next, the method of obtaining the similarity of operable elements based on node chains will be explained. In some embodiments, obtaining the similarity of operable elements based on node chains actually involves determining the element similarity of operable elements based on the information difference score between the two node chains when the chain lengths corresponding to the two operable elements being compared are equal. Specifically, the first chain length corresponding to the first node chain and the second chain length corresponding to the second node chain are obtained; the first chain length and the second chain length are compared to obtain a comparison result; when the comparison result indicates that the first chain length and the second chain length are equal, the information difference score between the first node chain and the second node chain is determined; based on the information difference score, the element similarity between the first operable element and the second operable element is determined.
[0067] The calculation of the information difference score is explained below. In some embodiments, obtaining the information difference score between two node chains is actually based on the difference in attribute values of the same attribute between two nodes of equal length in the two node chains. Specifically, based on the first node chain and the second node chain, a set of node pairs is determined. The node pairs include a first node in the first node chain and a second node in the second node chain with the same node length as the first node. Based on the difference in attribute values of the same attribute between the first node and the second node, the information difference score between the first node chain and the second node chain is determined.
[0068] The method for calculating information difference scores using attribute differences between nodes in a node pair is explained. In some embodiments, the information difference score is determined by comparing the attribute value differences between nodes related to the node to be identified. Specifically, the attribute value differences between the same attributes of the first node and the second node in each node pair are compared sequentially to obtain a first difference; the first differences are summed to obtain a second difference between the first node and the second node; the sums of the second differences are averaged to obtain an average difference, which is used as the information difference score between the first node chain and the second node chain.
[0069] In actual implementation, firstly, for two operable elements, extract the node chain from the root node to itself in the tree data structure. The similarity between elements is judged based on the information difference score of these two node chains. The information difference score is calculated as follows: First, determine whether the lengths of the two node chains are equal. If the lengths are not equal, the information difference score is directly set to 1000. If the lengths are equal, the attributes of corresponding nodes on the two chains are compared sequentially. Specifically, the values of the attributes `enable`, `visible`, `position`, `nodetype`, `action_info`, `components`, and `name` are compared. Each set of attributes is compared to a floating-point value between 0 and 1, which is used as the first difference for each attribute set. The larger the attribute difference, the larger the floating-point value. The sum of the first differences for all attribute sets corresponding to the two nodes in the node pair (the sum of all attribute scores) is recorded as the difference X between the two nodes. This difference X is used as the second difference. It can be understood that the number of corresponding node pairs in the two chains is equal to the number of second differences. The average of all second differences is then calculated. The information difference score between the two node chains (i.e., the sum of the second differences / the number of second differences) = Finally, the information difference score is determined. If the score is greater than 1, the two elements corresponding to the two node chains are considered to have low similarity and cannot be matched. If the score is less than 1, the two elements corresponding to the two node chains are considered to have high similarity and are matched as the same element.
[0070] For example, see Figure 8 , Figure 8This is a schematic diagram of the operable element similarity matching algorithm provided in this application embodiment. It compares the element similarity between operable element A4 in the first scene and operable element B4 in the second scene, constructing a scene tree for the first scene (i.e., the first scene tree) and a scene tree for the second scene (i.e., the second scene tree). It extracts the first node chain A1->A2->A3->A4 corresponding to operable element A4 from the first scene tree, and extracts the second node chain B1->B2->B3->B4 corresponding to operable element B4 from the second scene tree. It compares the lengths of the two node chains, finding them equal, and obtains the corresponding node pairs on each of the two node chains (i.e., obtaining the node pairs).<A1,B1> ,<A2,B2> ,<A3,B3> ,<A4,B4> Compare the differences in attribute values for the same attribute between each pair of nodes sequentially, such as comparing node pairs.<A1,B1> Differences in attribute values between them<A1,B1> The comparison involves comparing the values of identical attributes. For example, if the attributes `enable` of A1 and `enable` of B1 form an attribute group {A-enable, B-enable}, the value of `enable` is generally a boolean type, i.e., true or false. For boolean types (such as the attribute `enable`), the rule for obtaining the attribute difference is that if the attribute values are the same, the comparison result is 0; if they are different, the comparison result is 1. For string types (such as the attribute `name`), the rule for obtaining the attribute difference is to compare whether the strings are the same; if they are the same, the comparison result is 0; if they are different, the comparison result is 1. For collection types (such as the attribute `components`), the rule for obtaining the attribute difference is to divide the intersection of the collections by the union of the collections to obtain the comparison result `result`. The more similar the two collections are, the larger the intersection of the collections will be, and the larger the `result` will be. Then, subtracting `result` from 1 gives `D`. The meaning of `D` is that the more similar the two collections are, the smaller the value of `D`; the greater the difference between the two collections, the larger the value of `D`. The comparison result of a set of attributes corresponding to a collection type is a floating-point number between 0 and 1.
[0071] The results of the comparison<A1,B1> The summation of the attribute value differences (i.e., the first difference) of each attribute group yields the result.<A1,B1> The difference X1 between the two nodes (i.e., the second difference) is calculated sequentially.<A2,B2> ,<A3,B3> ,<A4,B4> For each node pair, the corresponding second differences X2, X3, and X4 are summed (X1+X2+X3+X4), and divided by the number of node pairs (4) to obtain the average value (X1+X2+X3+X4) / 4. This average value is used as the information difference score between the two node chains. The obtained information difference score is compared with a score threshold. When the information difference score reaches the score threshold, it indicates that operable element A4 and operable element B4 are dissimilar; when the information difference score does not reach the score threshold, it indicates that operable element A4 and operable element B4 are similar.
[0072] In practice, there exists a difference in information scores between two node chains. This indicates a situation where two operable elements are similar, but a pair of nodes on two node chains are very different, i.e., the first difference is large. In this case, a difference threshold is set for the first difference. When the first difference corresponding to a pair of nodes exceeds the difference threshold, it is determined that the two operable elements of the node chain are not similar.
[0073] For example, see Figure 8 The similarity between operable element A7 and operable element B4 is compared. The node chain corresponding to A8 is A1->A5->A6->A7, and the node chain corresponding to B4 is B1->B2->B3->B4. When comparing the attribute value differences between the node pairs, it is found that the first difference between A5 and B2 exceeds the preset difference threshold. Therefore, it is directly determined that A7 and B4 are not similar, and subsequent steps are not executed.
[0074] See also Figure 8 Compare the element similarity between operable element A7 and operable element B7. Since the chain length of node chain A1->A5->A6->A7 to which A7 belongs is not equal to the two lengths of node chain B1->B5->B7 to which B7 belongs, the information difference score corresponding to A7 and B7 is directly set to 1000, and it is concluded that A7 and B7 are not similar and cannot be matched.
[0075] In step 103, the scene similarity between the first scene and the second scene is determined based on element similarity, and when the scene similarity reaches the similarity threshold, the first scene and the second scene are merged to obtain a merged scene.
[0076] The method for determining scene similarity based on element similarity is described below. In some embodiments, based on the above method for determining element similarity between operable elements, each operable element A in the first operable element set in the first scene is traversed. i Search for A in the second set of operable options in the second scenario. i All similar operable elements B j and for operable element A i All similar operable elements are marked. It should be noted that an A... i There may be multiple Bs jThis aligns with how people perceive scene similarity in a game scenario. For example, when the levels are the same, a scene with one monster and another with three monsters are similar; the single monster element can match all three monster elements in the other scene. Specifically, when the element similarity reaches a similarity threshold, the first operable element and the second operable element are marked to indicate that they are similar elements; the number of marked operable elements in the first and second operable element sets is determined; and based on the number of marked operable elements, the scene similarity between the first scene and the second scene is determined.
[0077] The method of determining scene similarity by the number of marked operable elements is described below. In some embodiments, the number of all marked operable elements in the first set of operable elements and the second set of operable elements, as well as the total number of the first set of operable elements and the second set of operable elements, are counted. The ratio of the number of marked operable elements to the total number is obtained, and the scene similarity between the first scene and the second scene is determined based on this ratio. Specifically, the total number of operable elements in the first scene and the second scene is obtained; the ratio of the number of marked operable elements to the total number is determined, and the determined ratio is used as the scene similarity between the first scene and the second scene.
[0078] In actual implementation, the total number of operable elements in the first operable element set in the first scenario and the second operable element set in the second scenario is obtained, and the number of marked operable elements is obtained. The ratio of the number of marked operable elements to the total number is calculated, and this ratio is used as the matching element score. When the matching element score exceeds the score number threshold, it is determined that the scenario similarity between the first scenario and the second scenario has reached the similarity threshold, and the first scenario and the second scenario are indicated as similar scenarios.
[0079] In some embodiments, the total number of all unmarked operable elements in the first operable set and the second operable set can be counted and denoted as the mismatch element score. If the mismatch element score is greater than a mismatch element score threshold, or exceeds a percentage threshold of the total number of operable elements in the two scenes, then the first scene corresponding to the first operable set and the second scene corresponding to the second operable set are classified as different mini-game scenes. Conversely, the first scene and the second scene are considered similar and can be merged into the same scene.
[0080] For example, the virtual scene segmentation and merging algorithm provided in steps 101 to 103 is used, which can achieve a similar discrimination effect to human scene similarity discrimination standards, especially for various scenes in mini-games, with high discrimination accuracy. For example, its effectiveness is verified through an experiment on a set of manually labeled scene data. The experiment collected 5530 scenes from 20 mini-games running on 45 mobile phones. These scenes may include the same scene obtained from the same game running on different phones. A Cartesian product was performed on these 5530 scenes (creating scene pairs containing two independent scenes, randomly selecting two to ensure pairwise combination), resulting in 50,000 scene pairs, each containing two scenes. These 50,000 scene pairs were then manually labeled: scenes that belong to the same scene were labeled 1, and scenes that belong to different scenes were labeled 0. Finally, the methods shown in steps 101 to 103 are executed to determine whether these 50,000 scene pairs belong to the same scene, and the algorithm's judgment is compared with the manually labeled results. The results are as follows: The following comparison data will illustrate this point.
[0081] Table 1: Performance in labeled data testing
[0082] As can be seen from the data in Table 1 above, the method shown in steps 101 to 103 achieves an average precision of 0.8895 and a recall of 0.891 on both positive and negative samples, with an overall accuracy of 88.97%, demonstrating a very good discrimination effect.
[0083] In step 104, scenario testing is performed on the merged scenario instead of performing scenario testing on the first and second scenarios.
[0084] Here, taking the game scene of the same game as an example, the first set of operable elements is obtained by identifying operable elements in the first scene, and the second set of operable elements is obtained by identifying operable elements in the second scene. The element similarity between each operable element in the first set of operable elements and each operable element in the second set of operable elements is compared. Based on the element similarity, the scene similarity is further determined. Based on the scene similarity, it is determined whether the first scene and the second scene are similar scenes. When the first scene and the second scene are similar scenes, the first scene and the second scene are merged to obtain the merged scene.
[0085] The method of scene merging is explained below. In some embodiments, scene merging can be understood as merging operable elements in two similar scenes. Specifically, the first set of operable elements and the second set of operable elements are merged to obtain a union of operable elements. Correspondingly, the step of performing scene testing on the merged scene instead of performing scene testing on the first scene and the second scene includes: performing scene testing on each operable element in the union of operable elements respectively instead of performing scene testing on the first scene and the second scene.
[0086] For example, see Figure 9 , Figure 9 This is an optional flowchart illustrating a virtual scene testing method provided in an embodiment of this application. Two scene data points (numbered 1) that are actually similar scenes to be identified are used as input. Steps 101 to 103 of the virtual scene testing method (number 3) are executed. It is determined that the two scenes to be identified (numbered 1) are the same scene (similar scenes, consistent with the actual judgment result), resulting in result number 4. This indicates that the scene coverage remains unchanged during the statistical testing process, providing the decision-maker executing the testing operation with information that the scene has not changed. Alternatively, two scene data points (numbered 2) that are manually determined to be different scenes are used as input. Steps 101 to 103 (number 3) are executed. It is determined that the two scenes to be identified (numbered 2) are different scenes (consistent with the actual judgment result). During the merged testing, result number 5 is obtained, indicating that the scene coverage increases during the statistical testing process, providing the decision-maker executing the testing operation with information that the scene has changed.
[0087] In summary, this application's embodiments, by identifying operable elements in a virtual scene, determine the element similarity between operable elements in two different scenes. Based on this element similarity, it judges the matching of operable elements in the two scenes to determine scene similarity, and uses scene similarity to determine the similarities and differences between different scenes. This allows for accurate determination of whether a scene has changed during virtual scene testing, enabling the division of different scenes and the merging of identical scenes. Furthermore, the information on scene changes generated by this application's embodiments can help the decision-maker executing the test operation make better operational decisions, prioritizing the operation of elements that cause scene changes. This allows the testing process to more efficiently cover more game scenes, significantly improving the test scene coverage.
[0088] In some embodiments, the virtual scene testing method provided in this application can be implemented by a server or a terminal alone, or by a server and a terminal working together. The following describes the virtual scene testing method provided in this application using a server and terminal working together as an example. See also Figure 10 , Figure 10 This is an optional flowchart illustrating a virtual scene testing method provided in an embodiment of this application. Taking a mini-game scene as an example, combined with... Figure 10 The steps shown are explained.
[0089] Step 201: The terminal sends a test command for the virtual scene test to the server.
[0090] In practical applications, this test instruction includes an identifier for a virtual scenario.
[0091] Step 202: The server receives the test instruction and, based on the test instruction, obtains the first scene data.
[0092] Step 203: Construct the feature vector corresponding to each scene element in the first scene data.
[0093] Step 204: Classify the feature vectors to obtain the classification results.
[0094] Here, a pre-trained binary classification model (such as the XGBOOST machine learning model) is deployed on the server. The received feature vector is input into this binary classification model to obtain the classification result. The classification result indicates whether the scene element corresponding to the feature vector is an operable element.
[0095] In actual implementation, steps 203 to 204 are executed sequentially for each scene element in the first scene to determine whether each scene element in the first scene is an operable element.
[0096] Step 205: Based on the classification results of each scene element in the first scene, obtain the set of operable elements corresponding to the first scene.
[0097] Step 206: Obtain the set of operable elements corresponding to the second scene.
[0098] Here, click operations are performed on the operable elements in the first scene, and steps 202 to 205 are executed to obtain the set of operable elements corresponding to the second scene.
[0099] Step 207: Determine the element similarity between each first operable element in the first operable element set and each second operable element in the second operable element set.
[0100] Step 208: Determine the scene similarity between the first scene and the second scene based on element similarity.
[0101] Step 209: When the scene similarity reaches the similarity threshold, merge the first scene and the second scene to obtain the merged scene.
[0102] Step 210: Perform scenario testing on the merged scenario instead of performing scenario testing for the first and second scenarios.
[0103] Step 211: The server returns the scenario test results to the terminal.
[0104] Step 212: The terminal receives and presents the scenario test results sent by the server.
[0105] The embodiments of this application can help mini-games accurately determine whether the scene has changed during testing, thereby effectively calculating the scene coverage of the test. Simultaneously, the information on scene changes generated by the determination in these embodiments can provide better operational decisions during testing, prioritizing operations on elements where scene changes are likely to occur, thus enabling the testing process to more efficiently cover more game scenes.
[0106] The following describes an exemplary application of this application's embodiments in a real-world scenario: automated Monkey testing of WeChat mini-games. During mini-game testing, because all game content is organized on a single page, lacking the clear scene and page markers found in traditional app testing, it's difficult to determine whether Monkey testing operations have resulted in effective scene transitions. A scene segmentation algorithm based on operable elements is proposed. This algorithm effectively helps distinguish different game scenes and merges similar game scenes.
[0107] See Figure 11 , Figure 11 This is an optional schematic diagram of the scene testing method for a virtual scene provided in this application embodiment. The method can be divided into the following three steps: 1. Identification of operable elements in the scene; 2. Calculation of operable element similarity matching; 3. Calculation of scene similarity. Each of these three steps is implemented based on the output result of the previous step. The specific implementation methods of these three steps will be described in detail below.
[0108] First, let's explain the operable elements in the scene that need to be identified. Any scene in a game often contains multiple operable elements. For example, the operable elements present in a certain scene (see...) Figure 4A Number 1) and its operating area are both in Figure 4B Extracting and displaying elements from the scene. The location and characteristics of operable elements are a very important way to depict game scenes in mini-games. Therefore, it is necessary to first identify the operable elements in the scene to provide a basis for subsequent scene division and merging.
[0109] The data structure of the game scene built in the engine is extracted and used as the core for operation. This data structure can be obtained by the mini-game engine through an interface during game execution, and is a tree structure similar to HTML, XML, or other page description languages (see...). Figure 5 (Number 2 in the middle). The elements in the scene are composed of nodes in various tree structures, and each node has its own multiple attributes (see...). Figure 5 The number 3 in the middle represents information such as the node's location, visibility, and event response.
[0110] Whether an element within a scene is clickable can be represented by certain attribute values of the tree node corresponding to that element. In this application, a machine learning approach is used to determine clickable elements within the scene. First, the relevant attributes are extracted from the tree node corresponding to each scene element (see...). Figure 6 (Number 1). Next, each attribute value is converted to a numerical value. If it is already a numerical value, it is converted to a floating-point number; if it is a boolean binary type, True is set to 1.0 and False to 0.0. These attribute values are then concatenated to construct the feature vector corresponding to the node (see...). Figure 6 Number 2). Next, the feature vectors corresponding to all nodes in the scene are input into a binary classification XGBoost[5] model. The model can determine the clickability of each node represented by each feature vector. If it is operable, output 1; if it is not operable, output 0 (see Figure 6 (Number 4). This XGBoost model is created by manually annotating the clickability of nodes from a sampled portion of the game scene (see [link]). Figure 6 (Number 3), and then trained. Finally, based on the output of the model, the feature vector with an output of 1 is mapped back to the elements in the original scene to obtain a set of operable elements in the scene.
[0111] Next, the process of calculating the similarity of operable elements will be explained in detail. For two scenarios to be judged, operable elements are extracted from each scenario. The similarity between the operable elements is used to measure the similarity between the two scenarios. The embodiments of this application provide the following method for calculating the similarity of operable elements.
[0112] First, for two operable elements (see...) Figure 8 Extract the node chain from the root node to itself in the tree data structure (see A4 and B4, A7 and B7). Figure 8In the example, A4 corresponds to the node chain A1->A2->A3->A4, and B4 corresponds to the node chain B1->B2->B3->B4. The similarity between elements is determined based on the information difference score between these two node chains. The information difference score is calculated as follows: First, determine if the lengths of the two node chains are equal. If the lengths are not equal, set the information difference score to 1000. If the lengths are equal, then compare the attributes of corresponding nodes in each chain sequentially (see...). Figure 8 middle<A1,B1> ,<A2,B2> ,<A3,B3> ,<A4,B4> This section compares the values of the following attributes in each node: enable, visible, position, nodetype, action_info, components, and name. Each attribute is compared to a floating-point value between 0 and 1; the greater the difference, the larger the floating-point value. The sum of the scores is denoted as the difference X between the two nodes. For all nodes in both chains, the average of all differences is calculated. The information difference score is used as the information difference score between the two node chains. Finally, the information difference score is judged. If the score is greater than 1, the two elements corresponding to the two node chains are considered to have low similarity and cannot be matched. If the score is less than 1, the two elements corresponding to the two node chains are considered to have high similarity and match as the same element.
[0113] Next, the specific process of calculating scene similarity is explained. Scene similarity is calculated based on the similarity matching between the operable elements mentioned above. For the set of operable elements S(A) in scene A and the set of operable elements S(B) in scene B, each operable element SAi in S(A) is traversed. In S(B), it is searched for a highly similar matching node SBj. If there is one, SAi and all matched SBj are marked as matched. (It is worth noting that an SAi may have multiple SBj that can match it. This is consistent with the human perception of scene similarity in a game scene. For example, when the levels are the same, a scene with one monster and another scene with three monsters are similar. According to the above algorithm, this one monster element can match all three monster elements in the other scene.) After the traversal is completed, the total number of operable elements in S(A) and S(B) that are not marked as matched is counted and recorded as the mismatch element score. At this point, if the number of mismatched elements is greater than 2, or exceeds 25% of the total number of operable elements in both scenes, then the two scenes are considered dissimilar and should be classified as different mini-game scenes. Conversely, if the number of mismatched elements is less than 2, then the two game scenes are considered similar and can be merged into the same mini-game scene.
[0114] As can be seen from the data in Table 1 above, the scene segmentation and merging method proposed in this application achieves an average precision of 0.8895 and a recall of 0.891 on both positive and negative samples, with an overall accuracy of 88.97%, demonstrating a very good discrimination effect.
[0115] Furthermore, the scene segmentation and merging algorithm proposed in this application embodiment helps determine whether the game scene has changed during the Monkey testing tool for mini-games. This helps Monkey testing better decide on operation methods and execute more operations that change the game scene, thereby improving the overall scene coverage of the game. Here, a comparison is made between using the Monkey test provided in this application embodiment and not using the Monkey test provided in this application embodiment. Eighteen of the top-ranked mini-games in terms of daily active users were selected as test subjects. An eight-minute Monkey test was conducted on each game on six mobile phones, and then the total number of scenes covered was counted. Specifically, using the Monkey test provided in this application embodiment can prioritize the selection of elements that change the scene based on the judgment results of this application embodiment. See also... Figure 12 , Figure 12 This is a schematic diagram illustrating the total number of scenarios covered by the two Monkey tests provided in this application embodiment. Figure 12 The data above shows that the Monkey test after using the scene partitioning and merging algorithm method proposed in this application embodiment can achieve a higher number of scene coverages than the Monkey test without using the scene partitioning and merging algorithm method proposed in this application embodiment, with an average improvement of more than 50%, and an improvement of more than 100% for some games.
[0116] This application embodiment utilizes tree-like data provided at the game engine interface for different game scenes within the same game. By identifying operable elements, judging their similarity, and matching, it determines the similarities and differences between different scenes within the same game. This helps mini-games accurately determine whether scenes have changed during monkey testing, thereby effectively calculating the scene coverage. Furthermore, the scene change information generated by this embodiment can help monkey testing make better operational decisions, prioritizing operations on elements that cause scene changes. This allows the testing process to cover more game scenes more efficiently, significantly improving monkey testing scene coverage. Moreover, this scene testing method can be designed for mini-games and is highly compatible with tens of thousands of mini-games developed using different engines in the current mini-game ecosystem. This method can also determine the similarities and differences between the same game's runtime scenes across multiple mobile terminals, overcoming the influence of terminal resolution.
[0117] The following description continues to illustrate the exemplary structure of the virtual scene testing device 555 provided in the embodiments of this application as a software module. In some embodiments, such as... Figure 2 As shown, the software modules in the scene testing device 555 storing the virtual scene in the memory 550 may include: The acquisition module 5551 is used to acquire the first set of operable elements corresponding to the first scene in the virtual scene, and the second set of operable elements corresponding to the second scene in the virtual scene. The determination module 5552 is used to determine the element similarity between each first operable element in the first operable element set and each second operable element in the second operable element set; The merging module 5553 is used to determine the scene similarity between the first scene and the second scene based on the element similarity, and merge the first scene and the second scene when the scene similarity reaches a similarity threshold to obtain a merged scene; Test module 5554 is used to perform scenario testing on the merged scenario instead of performing scenario testing on the first scenario and the second scenario.
[0118] In some embodiments, the acquisition module 5551 is further configured to acquire multiple scene elements in the first scene; Operable element identification is performed on the plurality of scene elements to determine the operable elements in the first scene; Based on the determined operable elements in the first scenario, a first set of operable elements corresponding to the first scenario is constructed.
[0119] In some embodiments, when performing operable element identification on the plurality of scene elements, the acquisition module 5551 is further configured to perform the following operations for each scene element in the first scene: Obtain the attribute value corresponding to each of the multiple attributes of the scene element; Based on the obtained attribute values of the scene elements, the feature vector of the scene elements is determined; The feature vectors of the scene elements are input into a classification model for classification, and the classification results are used to indicate whether the scene elements are operable elements.
[0120] In some embodiments, the determining module 5552 is further configured to construct a first scene tree using scene elements of the first scene as nodes, and construct a second scene tree using scene elements of the second scene as nodes. Obtain the first node chain of the first operable element in the first scene tree, and the second node chain of the second operable element in the second scene tree; Based on the first node chain and the second node chain, determine the element similarity between the first operable element and the second operable element.
[0121] In some embodiments, the determining module 5552 is further configured to obtain the first chain length corresponding to the first node chain and the second chain length corresponding to the second node chain; The lengths of the first chain and the second chain are compared to obtain the comparison result; When the comparison result indicates that the length of the first chain is equal to the length of the second chain, the information difference score between the first node chain and the second node chain is determined; Based on the information difference score, the element similarity between the first operable element and the second operable element is determined.
[0122] In some embodiments, the determining module 5552 is further configured to determine that the element similarity between the first operable element and the second operable element is lower than the element similarity threshold when the comparison result indicates that the length of the first chain and the length of the second chain are not equal, so as to indicate that the first operable element and the second operable element are different elements.
[0123] In some embodiments, the merging module 5553 is further configured to mark the first operable element and the second operable element when the element similarity reaches a similarity threshold, so as to indicate that the first operable element and the second operable element are similar elements. Determine the number of marked operable elements in the first set of operable elements and the second set of operable elements; Based on the number of marked operable elements, the scene similarity between the first scene and the second scene is determined.
[0124] In some embodiments, the merging module 5553 is further configured to obtain the total number of operable elements in the first scene and the second scene; Determine the ratio of the number of marked operable elements to the total number, and the scene similarity between the first scene and the second scene.
[0125] In some embodiments, the merging module 5553 is further configured to merge the first set of operable elements and the second set of operable elements when the scene similarity reaches a similarity threshold, to obtain a union of operable elements; Accordingly, the test module 5554 is also used to perform scene tests on each operable element in the operable element set, instead of performing scene tests for the first scene and the second scene.
[0126] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the virtual scene testing method described above in this application.
[0127] This application provides a computer-readable storage medium storing executable instructions. When these executable instructions are executed by a processor, they cause the processor to execute a scene testing method for a virtual scene provided in this application. For example... Figure 3 The method shown.
[0128] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0129] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0130] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).
[0131] As an example, executable instructions can be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.
[0132] In summary, the embodiments of this application have the following beneficial effects: Technical effect 1: Improve the accuracy of scene segmentation.
[0133] The mini-game scene segmentation and merging algorithm proposed in this application can achieve a similar discrimination effect to human scene similarity discrimination criteria for each scene of a mini-game, improve the accuracy of scene segmentation, and demonstrate a very good discrimination effect.
[0134] Technical benefit 2: Improved coverage of test scenarios.
[0135] The embodiments of this application have been practically implemented in the Monkey testing tool for mini-games, helping to determine whether the game scene has changed during the testing process. This helps Monkey testing make better decisions on operation methods and execute more operations that can change the game scene, thereby improving the overall coverage of the game scene.
[0136] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A method for scene testing in a virtual scene, characterized in that, The method includes: For each attribute value among multiple attributes of each scene element in the first scene, determine the feature vector of the scene element; The feature vectors of the scene elements are input into a classification model for classification to obtain a classification result. The classification result is used to indicate whether the scene element is an operable element, so as to determine the operable element in the first scene. Based on the determined operable elements in the first scenario, a first set of operable elements corresponding to the first scenario is constructed, and a second set of operable elements corresponding to the second scenario in the virtual scenario is obtained. A first scene tree is constructed using scene elements of the first scene as nodes, and a second scene tree is constructed using scene elements of the second scene as nodes; Based on the first node chain of the first operable element in the first scene tree and the second node chain of the second operable element in the second scene tree, determine the element similarity between the first operable element and the second operable element. Based on the element similarity, the scene similarity between the first scene and the second scene is determined, and when the scene similarity reaches a similarity threshold, the first scene and the second scene are merged to obtain a merged scene; Scenario testing is performed on the merged scenario instead of performing scenario testing on the first scenario and the second scenario.
2. The method as described in claim 1, characterized in that, The step of determining the element similarity between the first operable element and the second operable element based on the first node chain of the first operable element in the first scene tree and the second node chain of the second operable element in the second scene tree includes: Obtain the length of the first chain corresponding to the first node chain, and the length of the second chain corresponding to the second node chain; The lengths of the first chain and the second chain are compared to obtain the comparison result; When the comparison result indicates that the length of the first chain is equal to the length of the second chain, the information difference score between the first node chain and the second node chain is determined. Based on the information difference score, the element similarity between the first operable element and the second operable element is determined.
3. The method as described in claim 2, characterized in that, The method further includes: When the comparison result indicates that the length of the first chain is not equal to the length of the second chain, it is determined that the element similarity between the first operable element and the second operable element is lower than the element similarity threshold, so as to indicate that the first operable element and the second operable element are different scene elements.
4. The method as described in claim 1, characterized in that, Determining the scene similarity between the first scene and the second scene based on the element similarity includes: When the element similarity reaches the element similarity threshold, the first operable element and the second operable element are marked to indicate that the first operable element and the second operable element are similar elements; Determine the number of marked operable elements in the first set of operable elements and the second set of operable elements; Based on the number of marked operable elements, the scene similarity between the first scene and the second scene is determined.
5. The method as described in claim 4, characterized in that, Determining the scene similarity between the first scene and the second scene based on the number of labeled operable elements includes: Obtain the total number of operable elements in the first scene and the second scene; The ratio of the number of marked operable elements to the total number is determined, and the determined ratio is used as the scene similarity between the first scene and the second scene.
6. The method as described in claim 1, characterized in that, The process of merging the first scenario and the second scenario to obtain a merged scenario includes: Merge the first set of operable elements with the second set of operable elements to obtain the union of operable elements; The step of performing scenario testing on the merged scenario instead of performing scenario testing for the first scenario and the second scenario includes: The operable elements are subjected to scenario testing, and each operable element is grouped together to perform scenario testing, instead of performing scenario testing for the first scenario and the second scenario.
7. A scene testing device for a virtual scene, characterized in that, The device includes: The acquisition module is used to determine the feature vector of the scene element for the attribute values corresponding to each attribute among multiple attributes of each scene element in the first scene; The feature vectors of the scene elements are input into a classification model for classification to obtain a classification result. The classification result is used to indicate whether the scene element is an operable element, so as to determine the operable element in the first scene. Based on the determined operable elements in the first scenario, a first set of operable elements corresponding to the first scenario is constructed, and a second set of operable elements corresponding to the second scenario in the virtual scenario is obtained. The determination module is used to construct a first scene tree with scene elements of the first scene as nodes and construct a second scene tree with scene elements of the second scene as nodes; and to determine the element similarity between the first operable element and the second operable element based on the first node chain of the first operable element in the first scene tree and the second node chain of the second operable element in the second scene tree. The merging module is used to determine the scene similarity between the first scene and the second scene based on the element similarity, and merge the first scene and the second scene when the scene similarity reaches a similarity threshold to obtain a merged scene; The testing module is used to perform scenario testing on the merged scenario instead of performing scenario testing on the first scenario and the second scenario.
8. The apparatus according to claim 7, characterized in that, The determining module is further configured to obtain the first chain length corresponding to the first node chain and the second chain length corresponding to the second node chain; compare the first chain length and the second chain length to obtain a comparison result; when the comparison result indicates that the first chain length and the second chain length are equal, determine the information difference score between the first node chain and the second node chain; Based on the information difference score, the element similarity between the first operable element and the second operable element is determined.
9. The apparatus according to claim 8, characterized in that, The determining module is further configured to determine that the element similarity between the first operable element and the second operable element is lower than the element similarity threshold when the comparison result indicates that the length of the first chain and the length of the second chain are not equal, so as to indicate that the first operable element and the second operable element are different scene elements.
10. The apparatus according to claim 7, characterized in that, The merging module is further configured to mark the first operable element and the second operable element when the element similarity reaches the element similarity threshold, so as to indicate that the first operable element and the second operable element are similar elements; Determine the number of marked operable elements in the first set of operable elements and the second set of operable elements; Based on the number of marked operable elements, the scene similarity between the first scene and the second scene is determined.
11. The apparatus according to claim 10, characterized in that, The merging module is also used to obtain the total number of operable elements in the first scene and the second scene; The ratio of the number of marked operable elements to the total number is determined, and the determined ratio is used as the scene similarity between the first scene and the second scene.
12. The apparatus according to claim 7, characterized in that, The merging module is further configured to merge the first set of operable elements and the second set of operable elements to obtain a union of operable elements; The testing module is also used to perform scenario testing on the operable elements and each operable element separately, in order to replace the execution of scenario testing for the first scenario and the second scenario.
13. An electronic device, characterized in that, include: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the scene testing method for the virtual scene according to any one of claims 1 to 6.
14. A computer-readable storage medium, characterized in that, It stores executable instructions for implementing the scene testing method of the virtual scene as described in any one of claims 1 to 6 when executed by a processor.
15. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the scene testing method for the virtual scene according to any one of claims 1 to 6.
Citation Information
Patent Citations
Data processing method and device, equipment and storage medium
CN110032837A
Method, device and program for creating test scenario
JP2006112852A