Methods, systems, apparatuses, devices, and media for testing software products
The automated testing framework built using the GTest engine and testing services solves the problems of low testing efficiency and compatibility in software products developed with Unreal Engine. It enables automated testing of C++ interfaces and UI, improving testing efficiency and compatibility, and simplifying the testing process.
Patent Information
- Application Number
- CN202411677898.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2044-11-21
AI Technical Summary
Traditional manual software product testing methods are inefficient, affecting development and release efficiency, and are unable to meet the needs of increasingly shorter development cycles and multi-platform compatibility.
An automated testing framework consisting of the GTest engine and test services is used to implement C++ interface and UI automated testing for software products developed with Unreal Engine. The GTestPlugin blueprint class and AsyncTask are used to implement multi-threaded asynchronous task execution. Combined with UI automated testing frameworks such as Macaca and Appium, it supports cross-platform compatibility.
It improved testing efficiency, ensured cross-platform compatibility, simplified test maintenance, enabled rapid quality assurance activities, and enhanced development and release efficiency.
Smart Images

Figure CN119807022B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular, to a method, system, device and medium for testing a software product. BACKGROUND
[0002] With the rapid development of Unreal Engine (UE) technology, the testing demand for software products developed using Unreal Engine is increasing. Developers can ensure the quality of software products by testing various software products developed in terms of C++ interface and user interface (UI).
[0003] However, the testing efficiency of the traditional artificial-based software product testing method is low, which greatly affects the development and release efficiency of related software products. SUMMARY
[0004] In view of the above problems, the embodiments of the present application provide a method, system, device and medium for testing a software product, so as to overcome the above problems or at least partially solve the above problems.
[0005] In a first aspect, the present application provides a method for testing a software product, which is applied to a GTest engine, and includes the following steps:
[0006] In response to receiving a start instruction sent by a to-be-tested software product, performing an initialization operation of a GTest and a loading operation of various test cases, the to-be-tested software product is developed using Unreal Engine, and the various test cases include various test cases related to C++ interface testing of the to-be-tested software product and / or various test cases related to user interface (UI) testing of the to-be-tested software product;
[0007] Performing, by a testing service, the various test cases loaded by the GTest engine to obtain execution results of the various test cases;
[0008] Returning the execution results of the various test cases to the to-be-tested software product.
[0009] As a possible implementation, the various test cases at least include various test cases related to UI testing of the to-be-tested software product.
[0010] The performing, by a testing service, the various test cases loaded by the GTest engine to obtain execution results of the various test cases includes:
[0011] sending, by the test service, UI test instructions to the test daemon, so as to make the test daemon request a UI automation test framework to perform UI operations on the to-be-tested software product according to each of the UI test-related test cases, to obtain execution results of each of the UI test-related test cases, wherein the to-be-tested software product, the GTest engine and the test service are deployed on a first device, the test daemon and the UI automation test framework are deployed on a second device, and the first device and the second device are different devices.
[0012] As a possible implementation, when performing UI tests across software products, the UI automation test framework performs UI operations on software products that are returned to the background of a device system based on a preset communication mode, and the preset communication mode includes at least one of a lock and a condition variable, file communication, and socket communication.
[0013] As a possible implementation, the test service performs each of the test cases based on a preconfigured C++ class and an AsyncTask, and the Unreal Engine has a GTestPlugin blueprint class added in advance, and the GTestPlugin blueprint class encapsulates initialization logic and execution logic of GTest.
[0014] The method further includes:
[0015] configuring a C++ class that inherits from the GTestPlugin blueprint class, and the C++ class is used to provide the test service with the ability to execute multiple test cases in parallel;
[0016] configuring an AsyncTask in a component of the Unreal Engine, and the AsyncTask is used to provide the test service with the ability to execute test cases in an asynchronous task execution manner.
[0017] As a possible implementation, the method further includes:
[0018] learning and analyzing historical test data by using a semantic large model to generate test cases and corresponding assertions.
[0019] As a possible implementation, the method further includes:
[0020] analyzing coverage of each of the test cases by using a code coverage analysis tool;
[0021] performing performance analysis on the to-be-tested software product in the execution process of each of the test cases by using a performance analysis tool.
[0022] In a second aspect, the embodiment of the present application provides a system for testing a software product, the system comprising a GTest engine and a test service, wherein:
[0023] The GTest engine is configured to perform an initialization operation of the GTest and a loading operation of each test case in response to receiving a starting instruction sent by the software product to be tested, the software product to be tested being developed by using the Unreal Engine, and the each test case comprising: each test case related to C++ interface test of the software product to be tested, and / or each test case related to user interface (UI) test of the software product to be tested.
[0024] The GTest engine is further configured to send an execution instruction of each test case loaded by the GTest engine to the test service.
[0025] The test service is configured to execute each test case loaded by the GTest engine according to the received execution instruction, and return an execution result of the each test case to the GTest engine.
[0026] The GTest engine is further configured to return the execution result of the each test case to the software product to be tested.
[0027] In a third aspect, the embodiment of the present application provides a device for testing a software product, the device being applied to a GTest engine and comprising:
[0028] An instruction receiving module is configured to perform an initialization operation of the GTest and a loading operation of each test case in response to receiving a starting instruction sent by the software product to be tested, the software product to be tested being developed by using the Unreal Engine, and the each test case comprising: each test case related to C++ interface test of the software product to be tested, and / or each test case related to user interface (UI) test of the software product to be tested.
[0029] A test executing module is configured to execute each test case loaded by the GTest engine through the test service, to obtain an execution result of the each test case.
[0030] A result sending module is configured to return the execution result of the each test case to the software product to be tested.
[0031] In a fourth aspect, the embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor performs the steps of the method for testing a software product according to the first aspect.
[0032] In a fifth aspect, the present application provides a computer readable storage medium having stored thereon computer programs / instructions, which, when executed by a processor, implement the steps of the method for testing the software product according to the first aspect.
[0033] In a sixth aspect, the present application provides a computer program product comprising computer programs / instructions, which, when executed by a processor, implement the method for testing the software product according to the first aspect disclosed in the embodiments of the present application.
[0034] The embodiments of the present application have the following advantages: the GTest engine automatically loads the initialization part and the test case part of the GTest in response to receiving the start instruction sent by the software product to be tested, then calls the test service to execute each test case loaded by itself, and returns the execution result of each test case to the software product to be tested, thereby realizing the automatic testing of the software product developed by the Unreal Engine based on the GTest (i.e., realizing the automatic testing of the C++ interface and / or the UI), which can improve the testing efficiency and further improve the development and release efficiency of the related software product. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0036] Figure 1 is an implementation flowchart of a method for testing a software product in the embodiments of the present application;
[0037] Figure 2 is a schematic diagram of a test calling flow in the embodiments of the present application;
[0038] Figure 3 is a test calling timing diagram in the embodiments of the present application;
[0039] Figure 4 is another test calling timing diagram in the embodiments of the present application;
[0040] Figure 5 is a structural schematic diagram of a system for testing a software product in the embodiments of the present application;
[0041] Figure 6 is a structural schematic diagram of an apparatus for testing a software product in the embodiments of the present application;
[0042] Figure 7is a schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0043] To facilitate understanding of the technical solutions provided in the present application, the main technical concepts related to the embodiments of the present application are briefly described below.
[0044] Unreal Engine: is a software product development engine. Compared with other software product development engines, Unreal Engine is more efficient and versatile, and can directly preview the development effect of the software product, so it has been widely used.
[0045] GTest: is a test framework generated for writing C++ tests on different platforms such as Linux, Mac OS X, Windows, Cygwin, Windows CE, and Symbian, which can be used to write and run test cases for various tests.
[0046] Macaca: is a test solution for user-side software, providing functions such as automated driving, environment matching, peripheral tools, and integrated solutions, aiming to solve problems such as testing, automation, and performance on terminals.
[0047] Appium: is an open-source cross-platform mobile application automation testing framework that supports automation testing for iOS and Android platforms, and can use the same Application Programming Interface (API) to write cross-platform test scripts.
[0048] Test case: is a description of a test task for a specific software product, including test objectives, test environments, input data, test steps, expected results, test scripts, and other content.
[0049] Assertion: is a mechanism for verifying the expected results of a test case. If the expected results do not match the actual results, the relevant test is determined to have failed, which allows you to check whether a program or system behaves as expected after performing certain operations or running certain code.
[0050] Socket: is an interface for applications to communicate through network protocols.
[0051] Currently, for software products developed using Unreal Engine (such as Unreal Engine 4), manual testing is usually used to implement C++ interface and UI-related testing for related software products, resulting in a longer testing cycle and higher testing cost for related software products, and making it difficult to meet the increasingly shortened development cycle requirements and multi-platform compatibility requirements, thereby affecting the development and release efficiency of related software products.
[0052] To solve the problems in the related art, the embodiment of the present application provides a method, system, device and medium for testing a software product. The automatic testing framework suitable for the Unreal Engine is formed by the GTest engine and the testing service, and the C++ interface automatic testing and the UI automatic testing of the software product developed by the Unreal Engine are realized. Therefore, the testing efficiency can be improved to quickly complete the quality assurance activities of the related software product, so as to meet the requirement of the increasingly shortened development cycle. In addition, the GTest is applied to the testing of the software product developed by the Unreal Engine, which can ensure the cross-platform compatibility of the testing, thereby meeting the multi-platform compatibility requirement of the software product.
[0053] The method, system, device, equipment and medium for testing a software product provided by the embodiment of the present application will be described in detail in combination with the drawings and some embodiments and application scenarios.
[0054] In a first aspect, referring to Figure 1 The method for testing a software product provided by the embodiment of the present application is applied to a GTest engine, and the method includes the following steps:
[0055] In step S11, in response to receiving a start instruction sent by a to-be-tested software product, an initialization operation of the GTest and a loading operation of each test case are performed. The to-be-tested software product is developed by using the Unreal Engine, and the each test case includes each test case related to the C++ interface testing of the to-be-tested software product and / or each test case related to the user interface (UI) testing of the to-be-tested software product.
[0056] The C++ interface testing of the to-be-tested software product can include unit testing, function testing and integration testing, etc. The UI testing of the to-be-tested software product mainly refers to the testing of the page control related to the software product by simulating the touch screen operation when the software product developed by the Unreal Engine runs on a mobile terminal (such as a terminal related to the Android, iOS, etc. system).
[0057] In a specific implementation, after receiving the start instruction sent by the to-be-tested software product, the GTest engine (which can be constructed by the developer by prewriting code) initializes the GTest according to the preconfigured initialization logic and execution logic of the GTest (such as setting the running environment of the test case, etc.), and then collects the related test case by calling the interface of the GTest to realize the loading of the test case.
[0058] Optionally, the test scripts in the test cases can be designed modularly to facilitate management and maintenance, thereby improving the reusability of the test scripts.
[0059] It should be noted that, considering that the programming language used for developing the software product by using the Unreal Engine is usually C++, the GTest engine is configured in the present application to apply the GTest to the testing process of the software product (i.e., the to-be-tested software product) developed by the Unreal Engine, so as to realize the automated testing of the related software product, and by virtue of the capability of the GTest to run on multiple platforms, the cross-platform compatibility of the testing is ensured, thereby meeting the multi-platform compatibility requirement of the software product developed by the Unreal Engine.
[0060] Step S12: executing each test case loaded by the GTest engine through the test service to obtain the execution result of each test case.
[0061] In specific implementation, the test service can include one or more threads, and the GTest engine executes each test case in a serial or parallel manner through one or more threads in the test service to obtain the execution result (e.g., pass, fail, skip, error, blocked, etc.) of each test case.
[0062] Step S13: returning the execution result of each test case to the to-be-tested software product.
[0063] In specific implementation, the GTest engine returns the execution result of each test case to the to-be-tested software product, thereby ending the automated testing of the to-be-tested software product.
[0064] It can be understood that the foregoing automated testing process can be integrated into a continuous integration process, so that the test can be automatically run after each code submission, thereby greatly improving the development and release efficiency of the related software product. Among them, continuous integration refers to that the developer submits the code for daily building to produce a deliverable (i.e., a to-be-tested software product) every day. The deliverable cannot guarantee the quality because it is not tested, and by combining with the automated testing, the automated testing can be automatically executed after the building of the deliverable is completed, and the deliverable that passes the testing can be considered to meet the quality standard.
[0065] According to the technical solution of the embodiment of the application, the GTest engine automatically loads the initialization part and the test case part of the GTest in response to receiving the start instruction sent by the to-be-tested software product, then calls the test service to execute each test case loaded by the GTest, and returns the execution result of each test case to the to-be-tested software product, thereby realizing the automatic testing of the software product developed by the Unreal Engine based on the GTest (i.e., realizing the automatic testing of the C++ interface and / or the UI), improving the testing efficiency, and further improving the development and release efficiency of the related software product.
[0066] As a possible implementation, the test cases include at least test cases related to UI testing of the to-be-tested software product.
[0067] The test service executes the test cases loaded by the GTest engine to obtain the execution result of the test cases.
[0068] The test service sends a UI test instruction to the test daemon to request a UI automation test framework to perform UI operations on the to-be-tested software product according to the test cases related to UI testing, so as to obtain the execution result of the test cases related to UI testing, wherein the to-be-tested software product, the GTest engine, and the test service are deployed on a first device, and the test daemon and the UI automation test framework are deployed on a second device, and the first device and the second device are different devices.
[0069] The UI automation test framework can be Macaca, Appium, or the like.
[0070] In specific implementation, referring to the schematic diagram of a test calling flow shown in Figure 2 The to-be-tested software product, the GTest engine, and the test service can be deployed on a first device such as a mobile phone, and the test daemon and the UI automation test framework can be deployed on a second device such as a personal computer (PC) or a Mac.
[0071] In the execution of the UI test, the GTest engine sends instructions of the UI test to the test daemon (TestDeamon) through the test service (also referred to as GCloudWorkThread), and the test daemon (i.e., the server side) initiates a request for the UI operation (e.g., UI click operation) involved in each test case related to the UI test to the UI automation test framework (such as Macaca) according to the instructions, and the UI automation test framework further performs the UI operation on the software product under test (such as QQ or WeChat) to obtain the execution result of each UI operation (i.e., the execution result of each test case), and returns the execution result to the GTest engine through the test daemon, so that the GTest engine obtains the execution result of each test case related to the UI test. In this way, the application provides a cross-platform UI test solution based on the UI automation test framework such as Macaca, which can ensure the compatibility of the test framework and facilitate the seamless connection between mobile devices and desktop applications, thereby supporting the testing of software products on different platforms such as iOS, Android, and Windows.
[0072] In this embodiment, the GTest engine communicates with the UI automation test framework through the test service and the test daemon, thereby applying the UI automation test framework to the UI test of the software product developed by the Unreal Engine, which can reduce the implementation complexity of the related test process, and with the cross-platform and cross-terminal UI test capability of the UI automation test framework, the maintenance of multiple test cases in the multi-terminal and multi-platform test scenario can be avoided.
[0073] Optionally, the GTestPlugin blueprint class can be added in the Unreal Engine (such as Unreal Engine 4) to use the GTestPlugin blueprint class to provide an interaction interface with the UI automation test framework, which allows the test script to communicate with the Unreal Engine environment, thereby realizing the sending of the related test command and the receiving of the execution result.
[0074] Optionally, when performing the cross-software product UI test, the UI automation test framework performs the UI operation on the software product returned to the device system background based on a preset communication mode, and the preset communication mode includes at least one of a lock and a condition variable, file communication, and socket communication.
[0075] In this embodiment, considering that when the UI automation test framework performs UI tests across software products, such as UI tests of simulated click operations on multiple mobile software, the mobile software under test will be suspended by the system after being returned to the background of the mobile system and cannot receive new instructions, the above-mentioned preset communication mode can be used to implement simulated click operations, such as using a timer, a lock, and environment variables related to UI operation communication with the mobile software, thereby decoupling UI operations from test logic in an asynchronous control manner, so that UI operations can be executed in the background and will not affect the execution of test case related test logic in the foreground of the system.
[0076] Optionally, the UI automation test framework can also pull the related software product under test that has completed the UI operation back to the foreground of the system based on the above-mentioned preset communication mode according to the execution order of the test logic (which can be indicated by the GTest engine through the test service and the test daemon), thereby ensuring that the execution order of the UI operation and the execution order of the test logic can be correctly matched, thereby improving the accuracy and reliability of the test.
[0077] As a possible implementation, the test service is based on a pre-configured C++ class and AsyncTask to execute the test cases, and a GTestPlugin blueprint class is pre-added in the Unreal Engine, which encapsulates the initialization logic and execution logic of GTest.
[0078] The method further comprises:
[0079] A C++ class inherited from the GTestPlugin blueprint class is configured, which is used to provide the test service with the ability to execute multiple test cases in parallel;
[0080] An AsyncTask is configured in the component Component of the Unreal Engine, which is used to provide the test service with the ability to execute test cases in an asynchronous task execution manner.
[0081] In specific implementation, a GTestPlugin blueprint class is added in the Unreal Engine (such as Unreal Engine 4), which encapsulates the initialization and execution logic of GTest, and can ensure that the test case can run seamlessly in the environment of the Unreal Engine.
[0082] It should be noted that based on the GTestPlugin blueprint class, some logic arrangement and control can be implemented, such as the initialization logic of GTest and the execution logic of test cases can be implemented in the GTestPlugin blueprint class; in this way, after adding the GTestPlugin blueprint class in the Unreal Engine, the GTest engine can use the GTestPlugin blueprint class to call the interface of GTest to implement the collection and execution of test cases, so that the developer does not need to write code to configure and manage test cases.
[0083] The C++ class inherited from the GTestPlugin blueprint class is configured to realize deep integration with the Unreal Engine, so that the test service can subsequently utilize the multi-threading capability of the Unreal Engine based on the C++ class to realize parallel execution of test cases, thereby further improving test efficiency.
[0084] The implementation of AsyncTask is added in the Component of the Unreal Engine to execute asynchronous tasks, so that the test service can subsequently utilize the asynchronous execution mechanism of the Unreal Engine based on AsyncTask, so that test cases can be executed without blocking the main thread, thereby improving the stability and efficiency of testing. The main thread refers to the main thread of the software product developed by the Unreal Engine, which is driven by the Unreal Engine (which can be understood as the driving of the World of the Unreal Engine).
[0085] Optionally, after creating a World in the Unreal Engine and adding the Component (which adds the implementation of the AsyncTask) in the World, the GTestPlugin blueprint class is bound to the Unreal Engine to let the Unreal Engine take responsibility for the underlying driving work, such as driving and executing the AsyncTask bound on the Component, thereby ensuring that the related test cases can be executed in any environment of the Unreal Engine (such as the environment associated with the editor and the game runtime).
[0086] Optionally, users can also customize and extend the functions of the above GTest engine and test service through the plug-in mechanism to meet the needs of specific scenarios.
[0087] Exemplarily, refer to Figure 3The test call timing chart is shown. The software product to be tested (such as a game thread of the Unreal Engine) sends a start instruction to the GTest engine (also referred to as a GTest module), the GTest engine performs an initialization operation of the GTest based on the C++ class and a loading operation of each test case, loads the test cases testConn1 and testFunc related to the C++ interface test, and then executes each test case loaded by the GTest engine through a test service. Specifically, the test service performs the testConn1 and testFunc in an asynchronous and parallel manner without blocking the main thread based on an AsyncTask in a multithreaded manner, obtains the execution results of the two test cases, and returns the execution results of the two test cases to the GTest engine, and the GTest engine returns the execution results of the two test cases to the software product to be tested.
[0088] Based on the above examples and embodiments, the application adds a GTestPlugin blueprint class to the Unreal Engine to implement the initialization and control logic of the GTest, and adds a C++ class of the Unreal Engine (which inherits from the GTestPlugin blueprint class) to implement asynchronous task execution in a multithreaded manner. Therefore, the application implements a C++ interface automatic testing method based on an asynchronous task execution mechanism of the Unreal Engine, which can improve testing efficiency while ensuring asynchronous execution capability.
[0089] As a possible implementation, the method further includes:
[0090] The historical test data is learned and analyzed by using the semantic large model to generate test cases and corresponding assertions.
[0091] In this embodiment, the application applies machine learning technology and natural language processing technology to software product testing, learns and analyzes historical test data by using a semantic large model to automatically and efficiently generate test cases and assertions and quickly expand test cases and assertions. For example, a developer can input a description text of a test requirement into the semantic large model to obtain related test cases and assertions. Therefore, the time and cost of manually writing and maintaining test cases and assertions can be reduced, and the richness of test cases and assertions can be improved, thereby improving the efficiency and accuracy of testing.
[0092] As a possible implementation, the method further includes:
[0093] The coverage of each test case is analyzed by using a code coverage analysis tool.
[0094] Through a performance analysis tool, performance analysis is performed on the software product under test during execution of each test case.
[0095] In a specific implementation, a code coverage analysis tool such as gcov can be used to analyze test case coverage to ensure that the test case can comprehensively cover the functions of the software product (for example, can comprehensively cover the functions of the C++ interface).
[0096] Considering that the test case is closely related to the actual use scenario of the user, during execution of the test case, a performance analysis tool can be used to collect resource usage during the process, such as a phone screen rendering stuttering situation, and consumption of resources such as a central processing unit (CPU), memory, network input / output (IO), and the like, to facilitate more in-depth performance testing and optimization.
[0097] Exemplarily, referring to the test call timing diagram shown in Figure 4 The software product under test sends a start instruction to the GTest engine, the GTest engine performs initialization operations of the GTest based on the C++ class and loading operations of each test case, loads the test case testConn1 related to C++ interface testing and the test case testLogin related to UI testing (that is, the test case for login testing), and then executes each test case loaded by the GTest engine through the test service. Specifically, the test service uses other threads other than the main thread to execute testConn1 on the software product under test in the foreground of the system based on AsyncTask, and uses another thread to send a UI test instruction to the test daemon process, so that the test daemon process requests a UI automation test framework to perform UI operations on the software product under test (such as QQ or WeChat) in the background of the system according to testLogin. The GTest engine can thus obtain execution results of the test case testConn1 related to C++ interface testing and the test case testLogin related to UI testing. Finally, the GTest engine returns the obtained execution results to the software product under test, thereby ending the test process. Thus, the application realizes an automatic test method for software products developed by the Unreal Engine, can realize C++ interface automatic testing and UI automatic testing, thereby quickly completing quality assurance activities of related software products and ensuring test cross-platform compatibility and asynchronous execution capability, so that it can seamlessly access various cloud test platforms to realize large-scale concurrent testing.
[0098] Based on the above examples and embodiments, the method for testing a software product provided by the application can at least achieve the following optimization effects:
[0099] 1. Improve testing efficiency: By building an automated testing framework suitable for Unreal Engine, the time and cost of manually testing software products developed by Unreal Engine can be greatly reduced, so that the quality assurance activities of related software products can be quickly completed to improve the speed of development and release.
[0100] 2. Ensure testing quality: Automated testing can cover more test scenarios, improving the comprehensiveness and accuracy of testing, and through asynchronous execution and multithreading technology, the stability and reliability of testing can be improved.
[0101] 3. Cross-platform compatibility: The automated testing framework supports mobile cross-platform integrated testing, which can ensure the compatibility of software products on different devices and operating systems.
[0102] 4. Simplify test maintenance: The decoupling of UI operations and test logic makes UI debugging and test case maintenance more convenient, and the simple interface and unit testing implementation of the automated testing framework can reduce the complexity of test maintenance.
[0103] 5. Seamless integration with Unreal Engine: The automated testing framework follows the running logic of Unreal Engine and is based on the native support of Unreal Engine, ensuring seamless integration with Unreal Engine.
[0104] 6. Strong scalability: The design of the automated testing framework has good scalability and can easily adapt to new testing requirements and software product features.
[0105] 7. Significant practical application effect: In practical application, a large number of automated test cases can be written and executed in a short time, significantly improving testing efficiency, and developers have discovered and fixed multiple potential problems based on the execution results of test cases, greatly improving the quality of software products.
[0106] For method embodiments, they are all described as a combination of a series of actions for the sake of simple description, but those skilled in the art should know that the application embodiments are not limited by the order of the described actions, because according to the application embodiments, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the application embodiments.
[0107] The second aspect, Figure 5 is a structural schematic diagram of a system for testing software products according to an embodiment of the application, the system comprising a GTest engine and a test service, wherein:
[0108] The GTest engine is configured to perform an initialization operation of the GTest and a loading operation of each test case in response to receiving a starting instruction sent by the to-be-tested software product developed by using the Unreal Engine, and the each test case comprises: each test case related to C++ interface testing of the to-be-tested software product, and / or each test case related to user interface (UI) testing of the to-be-tested software product.
[0109] The GTest engine is further configured to send, to the test service, an execution instruction of each test case loaded by the GTest engine.
[0110] The test service is configured to execute each test case loaded by the GTest engine according to the received execution instruction, and return an execution result of the each test case to the GTest engine.
[0111] The GTest engine is further configured to return the execution result of the each test case to the to-be-tested software product.
[0112] By adopting the technical solutions of the embodiments of the present application, the GTest engine automatically loads an initialization part and a test case part of the GTest in response to receiving a starting instruction sent by the to-be-tested software product, then calls a test service to execute each test case loaded by the GTest, and returns an execution result of the each test case to the to-be-tested software product, thereby realizing automatic testing of a software product developed by using the Unreal Engine (i.e., realizing automatic testing of C++ interface and / or UI) based on the GTest, and improving testing efficiency, and further improving development and release efficiency of related software products.
[0113] Optionally, the each test case at least comprises each test case related to UI testing of the to-be-tested software product, and the system further comprises a test daemon and a UI automation testing framework, the to-be-tested software product, the GTest engine and the test service are deployed on a first device, and the test daemon and the UI automation testing framework are deployed on a second device, and the first device and the second device are different devices, and wherein:
[0114] The GTest engine is further configured to send, to the test daemon, a UI testing instruction through the test service.
[0115] The test daemon is configured to request the UI automation testing framework to perform a UI operation on the to-be-tested software product according to the each test case related to the UI testing in response to receiving the UI testing instruction, so as to obtain an execution result of the each test case related to the UI testing.
[0116] The test daemon is further configured to send the execution results of the test cases to the GTest engine through the test service.
[0117] Optionally, when performing UI testing across software products, the UI automation testing framework implements UI operations on software products that are returned to the background of a device system based on a preset communication mode, and the preset communication mode includes at least one of a lock and a condition variable, file communication, and socket communication.
[0118] Optionally, the test service is configured to execute the test cases based on a preconfigured C++ class and an AsyncTask, and the Unreal Engine is pre-added with a GTestPlugin blueprint class, and the GTestPlugin blueprint class encapsulates initialization logic and execution logic of GTest.
[0119] The GTest engine is further configured to configure a C++ class that inherits from the GTestPlugin blueprint class and an AsyncTask in a component of the Unreal Engine, the C++ class is configured to provide the test service with the ability to execute multiple test cases in parallel, and the AsyncTask is configured to provide the test service with the ability to execute test cases in an asynchronous task execution manner.
[0120] Optionally, the GTest engine is further configured to learn and analyze historical test data by using a semantic large model to generate test cases and corresponding assertions.
[0121] Optionally, the GTest engine is further configured to analyze coverage of the test cases by using a code coverage analysis tool, and perform performance analysis on the software product under test during execution of the test cases by using a performance analysis tool.
[0122] In a third aspect, Figure 6 is a structural schematic diagram of a device for testing a software product, the device is applied to a GTest engine, and includes:
[0123] The instruction receiving module 610 is configured to perform initialization of GTest and loading of test cases in response to receiving a start instruction sent by a software product under test, the software product under test is developed by using an Unreal Engine, and the test cases include test cases related to C++ interface testing of the software product under test and / or test cases related to user interface (UI) testing of the software product under test.
[0124] The test execution module 620 is configured to execute each test case loaded by the GTest engine through a test service to obtain an execution result of the each test case.
[0125] The result sending module 630 is configured to return the execution result of the each test case to the software product to be tested.
[0126] By adopting the technical solutions of the embodiments of the present application, the GTest engine automatically loads an initialization part and a test case part of the GTest in response to receiving a starting instruction sent by the software product to be tested, then calls a test service to execute each test case loaded by the GTest, and returns the execution result of the each test case to the software product to be tested, thereby realizing the automatic testing of the software product developed by the Unreal Engine based on the GTest (i.e., realizing the automatic testing of the C++ interface and / or the UI), which can improve the testing efficiency and further improve the development and release efficiency of the related software product.
[0127] Optionally, the each test case at least includes each test case related to UI testing of the software product to be tested.
[0128] The test execution module 620 is further configured to send a UI testing instruction to a test daemon through the test service, so that the test daemon requests a UI automation testing framework to perform UI operation on the software product to be tested according to the each test case related to the UI testing, to obtain an execution result of the each test case related to the UI testing, wherein the software product to be tested, the GTest engine and the test service are deployed on a first device, the test daemon and the UI automation testing framework are deployed on a second device, and the first device and the second device are different devices.
[0129] Optionally, when performing the UI testing across software products, the UI automation testing framework performs the UI operation on the software product returned to a device system background based on a preset communication mode, and the preset communication mode includes at least one of a lock and a condition variable, file communication, and socket communication.
[0130] Optionally, the test service is configured to execute the each test case based on a preconfigured C++ class and an AsyncTask, a GTestPlugin blueprint class is pre-added in the Unreal Engine, and the GTestPlugin blueprint class encapsulates an initialization logic and an execution logic of the GTest.
[0131] The apparatus further includes a configuration module configured to perform the following steps:
[0132] A C++ class configured to inherit from the GTestPlugin Blueprint class, the C++ class configured to provide the test service with the ability to execute multiple test cases in parallel;
[0133] An AsyncTask configured in a Component of the Unreal Engine, the AsyncTask configured to provide the test service with the ability to execute test cases in an asynchronous task execution manner.
[0134] Optionally, the apparatus further comprises:
[0135] A generating module configured to learn and analyze historical test data using a semantic large model to generate test cases and corresponding assertions.
[0136] Optionally, the apparatus further comprises an analyzing module configured to perform the following steps:
[0137] Analyzing coverage of the test cases using a code coverage analysis tool;
[0138] Performing performance analysis on the software product under test during execution of the test cases using a performance analysis tool.
[0139] It should be noted that the apparatus embodiment is similar to the method embodiment, and thus the description is relatively simple, and the relevant parts can be referred to the method embodiment.
[0140] The present application embodiment further provides an electronic device, which refers to Figure 7 , Figure 7 is a schematic diagram of an electronic device according to the present application embodiment. As shown in Figure 7 , the electronic device 100 comprises a memory 110 and a processor 120, the memory 110 and the processor 120 are communicatively connected through a bus, the memory 110 stores a computer program, the computer program can be run on the processor 120, and thus the steps in the method for testing a software product disclosed in the present application embodiment are implemented.
[0141] The present application embodiment further provides a computer readable storage medium, which stores a computer program / instruction, the computer program / instruction is executed by a processor to implement the method for testing a software product disclosed in the present application embodiment.
[0142] The present application embodiment further provides a computer program product, which comprises a computer program / instruction, the computer program / instruction is executed by a processor to implement the method for testing a software product disclosed in the present application embodiment.
[0143] The various embodiments in the specification are described in progressive manner, and each embodiment focuses on the difference from other embodiments, and the same or similar parts between the embodiments can be referred to each other.
[0144] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, device or computer program product. Therefore, the embodiments of the present application can adopt a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can adopt the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0145] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams according to the methods, systems, devices, storage media and program products of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal equipment to produce a machine, so that the instructions executed by the computer or other programmable data processing terminal equipment produce a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in one or more flows and / or blocks.
[0146] These computer program instructions can also be stored in a computer readable storage medium that can guide the computer or other programmable data processing terminal equipment to work in a specific way, so that the instructions stored in the computer readable storage medium produce a product including instruction apparatus, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in one or more flows and / or blocks.
[0147] These computer program instructions can also be loaded into a computer or other programmable data processing terminal equipment, so that a series of operation steps are performed on the computer or other programmable terminal equipment to produce a computer implemented process, so that the instructions executed on the computer or other programmable terminal equipment provide a process for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in one or more flows and / or blocks.
[0148] While preferred embodiments of the application have been described, a wide variety of modifications, alterations, and permutations of these embodiments can become apparent to those skilled in the art in light of the foregoing detailed description. Accordingly, it is to be understood that other embodiments can be utilized, and that the scope of the disclosure is not limited to the specific embodiments described herein. The specification and drawings should be regarded as illustrative only and should not be considered restrictive in any sense. The accompanying drawings are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the application and, together with the description, serve to explain the principles of the application.
[0149] Finally, it should be noted that the terms "first", "second", and the like, herein do not denote any order, quantity, combination, or importance, but rather are used to distinguish one element from another, and do not imply singular or plural. Moreover, the term "include," "have," or the like, means to comprise, house, or have, but does not mean to limit. Further, the term "coupled" means to be directly or indirectly connected, and can include wired, wireless, optical, or the like, connection. Also, the term "comprise a" or "comprises" or "comprising" when listing components or features constitutes that than an exclusive inclusion, such that the process, method, article, or apparatus need not include the components or features but can include other components or features not expressly listed or inherent to such process, method, article, or apparatus.
[0150] The above detailed description of the application has been given to understand the application better. The above examples are only used to help understand the method of the application and its core idea; meanwhile, for those skilled in the art, according to the idea of the application, the specific implementation and application range can be changed. The above description should not be understood as a limitation of the application.
Claims
1. A method of testing a software product, characterized by, The method applied to a GTest engine comprises: In response to receiving a start instruction sent by a software product to be tested, performing an initialization operation of the GTest and a loading operation of each test case, the software product to be tested being developed using an Unreal Engine, the each test case comprising: each test case related to C++ interface testing of the software product to be tested, and / or each test case related to user interface (UI) testing of the software product to be tested; Executing, by a test service, each test case loaded by the GTest engine to obtain an execution result of the each test case; Returning the execution result of the each test case to the software product to be tested; The test service is configured to execute the each test case based on a pre-configured C++ class and an AsyncTask, a GTestPlugin blueprint class being pre-added in the Unreal Engine, the GTestPlugin blueprint class encapsulating initialization logic and execution logic of the GTest; The method further comprises: Configuring a C++ class inherited from the GTestPlugin blueprint class, the C++ class being configured to provide the test service with the capability of executing multiple test cases in parallel; Configuring an AsyncTask in a component of the Unreal Engine, the AsyncTask being configured to provide the test service with the capability of executing test cases in an asynchronous task execution manner.
2. The method of claim 1, wherein, The each test case at least comprises each test case related to UI testing of the software product to be tested; The executing, by the test service, of the each test case loaded by the GTest engine to obtain the execution result of the each test case comprises: Sending, by the test service, a UI test instruction to a test daemon to make the test daemon request a UI automation test framework to perform UI operations on the software product to be tested according to the each test case related to UI testing, to obtain an execution result of the each test case related to UI testing, wherein the software product to be tested, the GTest engine and the test service are deployed on a first device, and the test daemon and the UI automation test framework are deployed on a second device, the first device and the second device being different devices.
3. The method of claim 2, wherein, When performing UI testing across software products, the UI automation test framework is configured to perform UI operations on software products that are returned to a background of a device system based on a preset communication mode, the preset communication mode comprising at least one of a lock and a condition variable, file communication, and socket communication.
4. The method according to any of claims 1 to 3, characterized in that, The method further comprises: Learning and analyzing historical test data by using a semantic large model to generate test cases and their corresponding assertions.
5. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: Analyzing coverage of the each test case by using a code coverage analysis tool; Performing performance analysis on the software product to be tested during execution of the each test case by using a performance analysis tool.
6. A system for testing a software product, characterized in that The system comprises a GTest engine and a test service, wherein: The GTest engine is configured to perform an initialization operation of GTest and a loading operation of each test case in response to receiving a starting instruction sent by a to-be-tested software product, the to-be-tested software product is developed using the Unreal Engine, and the each test case includes each test case related to C++ interface testing of the to-be-tested software product and / or each test case related to user interface (UI) testing of the to-be-tested software product. The GTest engine is further configured to send an execution instruction of each test case loaded by the GTest engine to the test service. The test service is configured to execute each test case loaded by the GTest engine according to the received execution instruction and return an execution result of the each test case to the GTest engine. The GTest engine is further configured to return the execution result of the each test case to the to-be-tested software product. The test service is configured to execute the each test case based on a preconfigured C++ class and an AsyncTask, a GTestPlugin blueprint class is pre-added in the Unreal Engine, and the GTestPlugin blueprint class encapsulates initialization logic and execution logic of GTest. The GTest engine is further configured to configure a C++ class inherited from the GTestPlugin blueprint class and an AsyncTask in a component (Component) of the Unreal Engine, the C++ class is configured to provide the test service with the capability of executing multiple test cases in parallel, and the AsyncTask is configured to provide the test service with the capability of executing test cases in an asynchronous task execution manner.
7. An apparatus for testing a software product, characterized in that The device is applied to a GTest engine and includes: An instruction receiving module is configured to perform an initialization operation of GTest and a loading operation of each test case in response to receiving a starting instruction sent by a to-be-tested software product, the to-be-tested software product is developed using the Unreal Engine, and the each test case includes each test case related to C++ interface testing of the to-be-tested software product and / or each test case related to user interface (UI) testing of the to-be-tested software product. A test execution module is configured to execute each test case loaded by the GTest engine through a test service to obtain an execution result of the each test case. A result sending module is configured to return the execution result of the each test case to the to-be-tested software product. The test service is configured to execute the each test case based on a preconfigured C++ class and an AsyncTask, a GTestPlugin blueprint class is pre-added in the Unreal Engine, and the GTestPlugin blueprint class encapsulates initialization logic and execution logic of GTest. The GTest engine is further configured to configure a C++ class inherited from the GTestPlugin blueprint class and an AsyncTask in a Component of the Unreal Engine, the C++ class being configured to provide the test service with the ability to execute multiple test cases in parallel, and the AsyncTask being configured to provide the test service with the ability to execute test cases in an asynchronous task execution manner.
8. An electronic device comprising a memory, a processor, and a computer program stored on the memory, wherein, The computer program is executed by the processor to implement the method of the test software product according to any one of claims 1 to 5.
9. A computer readable storage medium having stored thereon computer programs / instructions, characterized in that, The computer program / instructions, when executed by the processor, implement the method of the test software product according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method for realizing regional controller equipment test based on GoogleTest test framework
CN111016978A
Test method and device of unit to be tested, electronic equipment and storage medium
CN115470113A
Cited By
Automobile software unit test code generation method and system
CN121996550A