Software testing method and device, equipment and storage medium
Through the software testing method based on virtual scenarios, virtual users and scenarios are generated, and automated interactive testing is carried out, which solves the problems of insufficient coverage, high cost and poor timeliness in traditional testing methods, and realizes efficient, comprehensive and accurate software testing.
Patent Information
- Application Number
- CN202411936737.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-09-19
AI Technical Summary
Traditional software testing methods are unable to fully simulate various user behaviors in the real world, resulting in insufficient test coverage, high costs, poor timeliness, and inconsistent test environments, and are unable to effectively discover product problems in specific scenarios.
By obtaining the scenario data of the software to be tested, performing behavioral analysis and processing, generating virtual scenarios and virtual users, and using test scripts to perform automated interactions in the virtual environment, stress testing is performed to obtain performance test feedback data.
It improves the comprehensiveness and accuracy of software testing, reduces costs, achieves efficient, timely and consistent testing, and improves product quality and user satisfaction.
Smart Images

Figure CN120670282A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of software testing and financial technology, and more specifically to a software testing method, apparatus, device, and storage medium based on a virtual scenario. Background Art
[0002] Software testing is a critical step in software development, comprehensively examining functionality, performance, and compatibility to ensure software stability and reliability. It plays a crucial role in improving user experience, significantly enhancing user satisfaction and loyalty through stability maintenance and usability optimization. Software testing can also effectively reduce enterprise costs and risks, mitigate financial losses caused by software failures, help companies comply with industry standards and regulations, and promote the successful delivery and ongoing operation of software projects.
[0003] Traditional software testing methods mainly rely on actual user feedback or pre-set test scripts. These methods are usually unable to fully simulate various user behaviors in the real world, resulting in an inability to effectively discover possible problems with the product in specific scenarios. Therefore, traditional methods have the following main problems: (1) Insufficient test coverage: actual user feedback and pre-set scripts cannot cover all possible usage scenarios and abnormal situations. (2) High cost: a large amount of human resources are required for testing and feedback collection. (3) Poor timeliness: actual user feedback lags behind product launch, and problems cannot be discovered and solved in a timely manner. (4) Inconsistent test environment: the environments in which actual users are located are different, resulting in test results that are not universally applicable. (5) Manual analysis methods require a large amount of manpower and time costs, especially when the number of target products or elements is large, the marginal cost increases. Summary of the Invention
[0004] In view of at least one aspect of the above problems, embodiments of the present disclosure provide a virtual scenario-based software testing method, apparatus, device, and storage medium that improve the comprehensiveness and accuracy of software performance testing.
[0005] According to a first aspect of the present disclosure, a software testing method based on a virtual scenario is provided, comprising: obtaining scenario data of the software to be tested, and performing behavioral analysis processing on the scenario data to obtain a typical scenario; based on the scenario data, performing scenario virtualization on the typical scenario to generate test data and a virtual scenario; collecting user behavior data, and performing virtual user analysis on the user behavior data to generate a virtual user and virtual user behavior data; and based on the virtual user, utilizing a test script in the virtual scenario to automatically interact with the test data and the virtual user data, and performing a stress test on the software to be tested to obtain performance test feedback data corresponding to the software to be tested.
[0006] According to an embodiment of the present disclosure, the behavioral analysis processing of the scene data to obtain a typical scene includes: extracting scene behavior patterns in the scene data; dividing different scene categories according to the scene behavior patterns; and statistically analyzing the different scene categories based on multidimensional selection rules to select the typical scene.
[0007] According to an embodiment of the present disclosure, the typical scenario is virtualized based on the scenario data to generate test data and a virtual scene, including: based on the scenario data, the typical scenario is subjected to scenario design modeling to construct a scenario model; based on the scenario model, a virtual environment is constructed to generate the test data; and based on the scenario model, the virtual scene is constructed in the constructed virtual environment.
[0008] According to an embodiment of the present disclosure, the scenario design modeling of the typical scenario is performed based on the scenario data to construct a scenario model, including: extracting the operation steps of the typical scenario based on the scenario data; determining the user expected results based on the operation steps; drawing a flowchart corresponding to the typical scenario according to the operation steps and the user expected results, and determining an exception handling strategy; and parameterizing the typical scenario based on the flowchart and the exception handling strategy to construct the scenario model.
[0009] According to an embodiment of the present disclosure, building a virtual environment based on the scenario model to generate the test data includes: using a virtualization tool to create the virtual environment; configuring system resources of the virtual environment; installing the software to be tested in the virtual environment; using a network simulation tool to simulate different network conditions to test the network environment performance of the software to be tested; and using the scenario model in the virtual environment to generate the test data, and importing the test data into a database of the virtual environment.
[0010] According to an embodiment of the present disclosure, the virtual user analysis of the user behavior data to generate virtual users and virtual user behavior data includes: data cleaning of the user behavior data; statistical clustering of the cleaned user behavior data to extract m types of user behavior patterns; m is an integer greater than 1; based on the m types of user behavior patterns, user role classification is performed to construct a role model; using a machine learning algorithm to train the role model; and using the trained role model to analyze and verify real behavior association data to obtain the virtual user and the virtual user behavior data.
[0011] According to an embodiment of the present disclosure, the user role classification based on the m categories of user behavior patterns to construct a role model includes: extracting behavioral features corresponding to the m categories of user behavior patterns; based on the behavioral features, the users are divided into different user roles; wherein each category of user roles has a different user behavior pattern; creating a feature vector corresponding to each category of user roles; and constructing the role model based on the feature vector and preset behavioral rules.
[0012] According to an embodiment of the present disclosure, the use of a trained role model to analyze and verify the real behavior association data to obtain the virtual user and the virtual user behavior data includes: inputting the real behavior association data into the trained role model to generate initial virtual user behavior data; assigning the initial virtual user behavior data to the different user roles to generate the virtual user; based on the real behavior association data, comparing and verifying the initial virtual user behavior data corresponding to the virtual user; importing the verified virtual user data into the database of the virtual environment to obtain the virtual user behavior data.
[0013] According to an embodiment of the present disclosure, based on the virtual user, in the virtual scenario, using a test script, automatically interacting the test data and the virtual user data, and performing a stress test on the software to be tested to obtain performance test feedback data corresponding to the software to be tested, including: configuring a test tool in the virtual environment; configuring a test plan based on the virtual user; configuring a monitoring tool in the virtual environment based on preset monitoring indicators; based on the test plan, in the virtual scenario, using the virtual environment to simulate user behaviors under different loads, automatically interacting the test data and the virtual user data through the test tool and the test script, and performing a stress test on the software to be tested; exporting the performance test feedback data from the test tool and the monitoring tool to obtain performance test feedback data corresponding to the software to be tested.
[0014] According to an embodiment of the present disclosure, configuring a test plan based on the virtual user includes: configuring a virtual user group in the test tool based on the virtual user; allocating the virtual user group to a concurrent group according to a set number of concurrent users to obtain a concurrent user group; and configuring the test time element of the concurrent user group to obtain the test plan.
[0015] According to an embodiment of the present disclosure, the method further includes: analyzing the performance test feedback data corresponding to the software to be tested to generate a software test report; the analyzing the performance test feedback data corresponding to the software to be tested to generate a software test report includes: performing data cleaning processing on the performance test feedback data corresponding to the software to be tested; performing software performance analysis on the cleaned performance test feedback data to obtain analysis data; and performing performance evaluation on the analysis data to generate the software test report.
[0016] According to an embodiment of the present disclosure, the method further includes: using a log collection tool in a configured log system to collect recorded log data during stress testing; performing behavioral analysis on the recorded log data to obtain user behavior analysis results; and based on the user behavior analysis results, identifying user problems on the recorded log data to generate a user experience evaluation report.
[0017] The second aspect of the present disclosure provides a software testing device based on a virtual scenario, including: a scenario data analysis module, which is used to obtain scenario data of the software to be tested, and perform behavior analysis processing on the scenario data to obtain a typical scenario; a scenario virtualization module, which is used to perform scenario virtualization on the typical scenario based on the scenario data to generate test data and a virtual scenario; a virtual user analysis module, which is used to collect user behavior data and perform virtual user analysis on the user behavior data to generate a virtual user and virtual user behavior data; and an automated testing module, which is used to automatically interact with the test data and the virtual user data in the virtual scenario based on the virtual user, and perform stress testing on the software to be tested to obtain performance test feedback data corresponding to the software to be tested.
[0018] According to an embodiment of the present disclosure, the device also includes: a user experience evaluation module, which is used to collect recorded log data during stress testing in a configured log system using a log collection tool; perform behavioral analysis on the recorded log data to obtain user behavior analysis results; and identify user problems on the recorded log data based on the user behavior analysis results to generate a user experience evaluation report.
[0019] According to an embodiment of the present disclosure, the device also includes: a test report generation module, which is used to analyze the performance test feedback data corresponding to the software to be tested to generate a software test report; the test report generation module is also used to perform data cleaning processing on the performance test feedback data corresponding to the software to be tested; perform software performance analysis on the cleaned performance test feedback data to obtain analysis data; and perform performance evaluation on the analysis data to generate the software test report.
[0020] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0021] The fourth aspect of the present disclosure further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the computer program or instructions are executed by a processor.
[0022] The fifth aspect of the present disclosure further provides a computer program product, comprising a computer program or instructions, which implement the steps of the above method when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0024] Figure 1 Schematically illustrates an application scenario diagram of a software testing method based on a virtual scenario according to an embodiment of the present disclosure;
[0025] Figure 2 The flowchart of the software testing method based on the virtual scene according to the embodiment of the present disclosure is schematically shown;
[0026] Figure 3 Schematically shows a branch structure flow chart of a software testing method based on a virtual scene according to an embodiment of the present disclosure;
[0027] Figure 4 The following schematically illustrates a flowchart of a scenario model construction of a software testing method based on a virtual scenario according to an embodiment of the present disclosure;
[0028] Figure 5 The following schematically shows a flow chart of building a virtual environment for a software testing method based on a virtual scene according to an embodiment of the present disclosure;
[0029] Figure 6 Schematically shows a role classification flow chart of a software testing method based on a virtual scene according to an embodiment of the present disclosure;
[0030] Figure 7 The following schematically illustrates an analysis and verification flow chart of a software testing method based on a virtual scenario according to an embodiment of the present disclosure;
[0031] Figure 8 Schematically shows a test plan configuration flow chart of a software testing method based on a virtual scenario according to an embodiment of the present disclosure;
[0032] Figure 9 The following schematically illustrates a flow chart of user experience evaluation of a software testing method based on a virtual scenario according to an embodiment of the present disclosure;
[0033] Figure 10 A block diagram schematically illustrates a structure of a software testing device based on a virtual scene according to an embodiment of the present disclosure; and
[0034] Figure 11 A block diagram of an electronic device suitable for implementing a software testing method based on a virtual scenario according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0035] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the detailed description below, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0036] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise," "include," etc. used herein indicate the presence of features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0037] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0038] When expressions such as "at least one of A, B, and C, etc." are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0039] The embodiments of the present disclosure provide a software testing method based on virtual scenarios, which obtains scenario data of the software to be tested, and performs behavioral analysis on the scenario data to obtain a typical scenario; based on the scenario data, the typical scenario is virtualized to generate test data and a virtual scenario; user behavior data is collected, and virtual user analysis is performed on the user behavior data to generate virtual users and virtual user behavior data; and based on the virtual user, in a virtual scenario, stress testing is performed on the software to be tested using test scripts, automated interactive test data and virtual user data to obtain performance test feedback data corresponding to the software to be tested.
[0040] The present disclosure simulates real user behaviors and usage scenarios, constructs corresponding virtual users and virtual scenarios, and uses them for software testing. It can more accurately discover possible problems of products in various specific typical scenarios, increase the coverage of software testing, improve the comprehensiveness of software product testing, obtain more accurate test data, improve the accuracy of software testing reports, and achieve efficient and comprehensive software product testing, which is conducive to improving product quality and user satisfaction. It has the advantages of comprehensive coverage, cost savings, high efficiency and timeliness, consistency and intuitive presentation.
[0041] It should be noted that the software testing method and device based on virtual scenarios disclosed herein can be used in the software testing of financial application software products (such as mobile banking, online banking, and mobile life, etc.) in the field of financial technology, and can also be used in any field other than the field of financial technology. The application field of the software testing method and device based on virtual scenarios disclosed herein is not limited.
[0042] In the technical solution of the present disclosure, the user information involved (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and user-related behavior data (including but not limited to data used for analysis, stored data, displayed data, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0043] In scenarios where personal information is used for automated decision-making, the methods, devices, and systems provided by the embodiments of the present disclosure all provide users with corresponding operation portals for them to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating an individual's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge, and skills, and have reached a certain level of professionalism.
[0044] Figure 1 The application scenario diagram of the virtual scenario-based software testing method according to an embodiment of the present disclosure is schematically shown.
[0045] like Figure 1 As shown, the application scenario 100 according to this embodiment may include financial application software testing or general application software testing. A network 104 is used as a medium for providing a communication link between a first terminal device 101, a second terminal device 102, a third terminal device 103, and a server 105. The network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0046] A user may use a first terminal device 101, a second terminal device 102, or a third terminal device 103 to interact with a server 105 via a network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, or the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (for example only).
[0047] The first terminal device 101 , the second terminal device 102 , and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0048] The server 105 may be a server that provides various services, such as a background management server (for example only) that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process received data such as user requests, and feed back processing results (e.g., web pages, information, or data obtained or generated based on user requests) to the terminal devices.
[0049] It should be noted that the software testing method based on the virtual scenario provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the software testing device based on the virtual scenario provided in the embodiment of the present disclosure can generally be set in the server 105. The software testing method based on the virtual scenario provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the software testing device based on the virtual scenario provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0050] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0051] The following will be based on Figure 1 The scene described by Figures 2 to 9 The software testing method based on virtual scenarios of the disclosed embodiment is described in detail.
[0052] Figure 2 The flowchart of the software testing method based on the virtual scene according to the embodiment of the present disclosure is schematically shown.
[0053] Figure 3 The branch structure flow chart of the virtual scene-based software testing method according to an embodiment of the present disclosure is schematically shown.
[0054] like Figure 2 、 3 As shown, the software testing method based on the virtual scene of this embodiment includes operations S210 to S240, and the software testing method can be automatically executed.
[0055] In operation S210 , scenario data of the software to be tested is acquired, and behavior analysis processing is performed on the scenario data to obtain a typical scenario.
[0056] Collect user behavior data when using the software under test to obtain scenario data. Data sources include user logs, transaction records, and user feedback. The collected data includes the timestamp of the user operation, the operation type (such as login, transfer, balance inquiry, etc.), the operation result (success or failure), and the user device information. The software under test includes but is not limited to financial application software (such as mobile banking and online banking) and life service software (such as social communication software, travel navigation software, and entertainment and leisure software).
[0057] In operation S220 , based on the scenario data, scenario virtualization is performed on the typical scenario to generate test data and a virtual scenario.
[0058] In operation S230 , user behavior data is collected, and virtual user analysis is performed on the user behavior data to generate a virtual user and virtual user behavior data.
[0059] Collect user behavior data from the backend database and log system of the software under test. User behavior data includes at least data types and data fields. Data types include user login records, transaction records, operation logs, etc. Data fields include timestamp, user ID, operation type (such as login, transfer, balance query, etc.), operation result, device type, network type, etc. for each record.
[0060] In operation S240 , based on virtual users, in a virtual scenario, using test scripts, automated interactive test data, and virtual user data, a stress test is performed on the software to be tested to obtain performance test feedback data corresponding to the software to be tested.
[0061] In virtual scenarios, test data and virtual user data interact automatically through test scripts, testing tools, and concurrent user management tools. The virtual environment simulates user behavior under varying loads, combining the number of concurrent users and system response time to conduct stress testing and performance verification. This connection and interaction enables comprehensive automated stress testing.
[0062] Test scripts include, but are not limited to, login scripts (scripts that simulate user login operations, including opening the application, entering the username and password, and clicking the login button), transaction scripts (scripts that simulate user transfer operations, including selecting the transfer function, entering the recipient account number and transfer amount, and confirming the transfer), and query scripts (scripts that simulate user balance query operations, including selecting the query function and obtaining the account balance).
[0063] In the embodiments of the present disclosure, by simulating real user behavior and usage scenarios, constructing corresponding virtual users and virtual scenarios, and using them for software testing, it is possible to more accurately discover possible problems of products in various specific typical scenarios, increase the coverage of software testing, improve the comprehensiveness of software product testing, obtain more accurate test data, improve the accuracy of software testing reports, and achieve efficient and comprehensive software product testing, which is convenient for improving product quality and user satisfaction. It has the advantages of comprehensive coverage, cost savings, high efficiency and timeliness, consistency and intuitive presentation.
[0064] According to an embodiment of the present disclosure, operation S210 performs behavior analysis on scene data to obtain a typical scene, which includes operations S2101-S2103.
[0065] In operation S2101 , a scene behavior pattern in scene data is extracted.
[0066] Data analytics tools are used to analyze collected data and extract behavioral patterns, including common user behavior patterns and transaction flows. Data analytics tools are software libraries or applications that deeply analyze large amounts of collected data to extract valuable information and insights.
[0067] In operation S2102 , different scene categories are classified according to scene behavior patterns.
[0068] Based on the extracted scenario behavior patterns, user operations are divided into different scenario categories, such as login scenarios, transaction scenarios, query scenarios, etc.
[0069] In operation S2103 , based on the multi-dimensional selection rule, different scene categories are statistically analyzed to select typical scenes.
[0070] Multidimensional selection rules include importance, diversity, boundary conditions, and changing trends.
[0071] Importance: Although some low-frequency scenarios occur less frequently, they have a significant impact on system performance, business processes, or user experience and should also be included in typical scenarios.
[0072] Diversity: In order to fully cover the usage behaviors of different user groups, a variety of scenarios were selected, such as the behavior patterns of active users and occasional users.
[0073] Edge cases: Some extreme or abnormal behavior scenarios (such as long periods of no operation, sudden high load, etc.) are considered as typical scenarios, although they are less frequent, considering their significance for system stress testing.
[0074] Changing trends: Combine time-of-day and seasonal changes to select scenarios based on different usage scenarios, such as user behavior during holidays, promotions, and other specific time periods.
[0075] In the embodiments of the present disclosure, statistical analysis can be used to determine the frequency and importance of various scenarios, select representative typical user behavior scenarios, and obtain representative typical scenarios, the number of which is one or more, so as to accurately simulate typical scenarios and typical user behaviors in virtual scenario design and improve the accuracy of software testing.
[0076] According to an embodiment of the present disclosure, operation S220 of performing scene virtualization on a typical scene based on scene data to generate test data and a virtual scene includes operations S2201 - S2203 .
[0077] In operation S2201 , scenario design modeling is performed on a typical scenario based on scenario data to construct a scenario model.
[0078] In operation S2202 , a virtual environment is constructed based on the scenario model to generate test data.
[0079] In operation S2203 , a virtual scene is constructed in the constructed virtual environment based on the scene model.
[0080] In the embodiments of the present disclosure, a variety of virtual scenarios can be simulated through the scenario model so that the virtual scenarios comprehensively cover various user behaviors and usage situations, reduce dependence on actual user feedback, and reduce testing costs.
[0081] Figure 4 The flowchart of constructing a scenario model of a software testing method based on a virtual scenario according to an embodiment of the present disclosure is schematically shown.
[0082] like Figure 4 As shown, according to an embodiment of the present disclosure, in operation S2201 , scene design modeling is performed on a typical scene based on scene data to construct a scene model, including operations S410 - S440 .
[0083] In operation S410 , operation steps of a typical scenario are extracted based on the scenario data.
[0084] Based on the scenario data, the operation steps of each typical scenario are described in detail. The extracted operation steps, such as the login scenario, include the steps of opening the application, entering the user name and password, clicking the login button, etc.
[0085] For each typical scenario, a detailed description of the operation steps is an important part of ensuring that the virtual user behavior is consistent with the actual user behavior. Each operation step not only includes the user's single operation, but also needs to consider the order of the operation, the specific content of the input and output. The process of extracting the operation steps is as follows: (1) Identification of operation steps: First, based on the scenario design, identify the various operation steps in the typical scenario. For example, in the login scenario, the operation steps include "open the application", "enter the username and password", "click the login button", etc. (2) Operation sequence and dependency: Describe the operation sequence of each step to ensure that the virtual user behavior is consistent with the actual user. The dependency between steps needs to be clear. For example, after logging in, the user may need to wait for the page to load before performing subsequent operations. (3) Input content and interaction details: For each operation step, describe in detail the required input content and the interaction method with the system. For example, in the step of "entering the username and password", clearly indicate the source of the username and password (whether it is randomly generated or generated based on some rules), and ensure that each generated username and password can pass the system verification. (4) Exception handling and error feedback: Each operation step may have some exceptions or error feedback. For example, when a user enters an incorrect username or password, the system may prompt "Incorrect username or password." These edge cases should be considered in the description of the operation steps to ensure that the corresponding errors can be handled and fed back during the simulation. (5) Time intervals and user behavior characteristics: Describe the time intervals between operation steps. For example, it may take 1-3 seconds for a user to click the login button and the successful login page to load. This process also needs to be simulated in the virtual environment to ensure the authenticity of user behavior.
[0086] Data Verification: After the operation steps are completed, verify whether the results of each operation are as expected. For example, after a successful login, check whether the user enters the main interface or whether the user's personal information is displayed. These verification steps help confirm whether the operation is executed correctly.
[0087] Concurrency and load: In scenarios requiring high concurrency or stress testing, it's important to consider the possibility of concurrent users performing the same operation at the same time. For example, if multiple users click the login button simultaneously, will the system respond promptly, or will there be congestion or error messages?
[0088] In operation S420 , a user expected result is determined based on the operation steps.
[0089] Determine the expected results for each operation step, such as jumping to the homepage after a successful login, displaying a confirmation message after a successful transfer, etc.
[0090] In operation S430 , a flowchart corresponding to a typical scenario is drawn according to the operation steps and the user's expected results, and an exception handling strategy is determined.
[0091] You can use a flowchart tool to draw an operation flow chart for each typical scenario to clarify the operation sequence and logical relationship. Consider the possible abnormal situations and handling methods of each step to determine the abnormal handling strategy, such as error prompts after login failure, retry mechanism after transfer failure, etc.
[0092] In operation S440 , the typical scenario is parameterized based on the flowchart and the exception handling strategy to construct a scenario model.
[0093] Define the variable parameters in each typical scenario (such as user ID, transaction amount, device type, etc.), and determine the value range and distribution of each parameter (for example, the transaction amount range is 1-10,000 yuan, and the device types include mobile smart devices and tablet devices, etc.).
[0094] Quantitatively adjust the specific parameters of the scenario model (such as operation frequency, behavior interval, login time, etc.) to ensure that the behavior of virtual users is consistent with that of real users.
[0095] In the embodiments of the present disclosure, drawing flowcharts combined with exception handling strategies enhances the robustness and adaptability of the model, while parameterized operations give the model flexibility and scalability, thereby effectively improving the ability to cope with complex and changing business scenarios, while improving efficiency and ensuring model quality and reliability.
[0096] Figure 5 The flowchart of building a virtual environment for a software testing method based on a virtual scene according to an embodiment of the present disclosure is schematically shown.
[0097] like Figure 5 As shown, according to an embodiment of the present disclosure, in operation S2202 , a virtual environment is built based on a scenario model to generate test data, including operations S510 - S550 .
[0098] In operation S510 , a virtual environment is created using a virtualization tool.
[0099] Select appropriate virtualization tools and platforms to create and manage virtual environments. Virtual environments provide a controlled infrastructure for testing, enabling simulation of various user behaviors and testing without impacting actual system operations. Therefore, the configuration of virtual environments directly impacts the effectiveness of scenario design and modeling.
[0100] In operation S520 , system resources of the virtual environment are configured.
[0101] Configure the system resources required for the virtual environment. System resources include hardware resources (such as CPU, memory, storage, etc.) and software resources (such as operating system, database, middleware, etc.).
[0102] In operation S530 , the software to be tested is installed in the virtual environment.
[0103] Install and configure the software under test in a virtual environment to ensure that the application can run normally.
[0104] In operation S540 , a network simulation tool is used to simulate different network conditions to test the network environment performance of the software under test.
[0105] Network conditions include bandwidth, latency, packet loss rate, etc.
[0106] In operation S550 , test data is generated in the virtual environment using the scenario model, and the test data is imported into a database of the virtual environment.
[0107] Based on the results of scenario model parameterization, a large amount of test data is generated, including user accounts, transaction records, operation logs, etc. The generated test data is imported into the database in the virtual environment to ensure the integrity and consistency of the test data.
[0108] The main methods for generating test data include the following: (1) Rule generation method: Based on predefined user behavior rules, data is generated according to a certain probability distribution. For example, the time distribution of user logins, the selection of operation types, etc. can be set. (2) Data-driven generation method: Based on real historical data, new test data is generated through data analysis and synthesis techniques (such as cluster analysis, data enhancement, etc.) to ensure the diversity and authenticity of the data. (3) Model generation method: Using machine learning models (such as generative adversarial networks (GANs)) or other statistical models, the model is trained based on existing data to generate virtual data similar to real user behavior. (4) Random generation method: Random data is generated according to a certain parameter range (such as user ID, transaction amount, timestamp, etc.), which is suitable for generating large-scale basic data sets.
[0109] In the embodiments of the present disclosure, generating test data based on scenario models can ensure that the data fits the actual application logic, and importing the test data into the database can ensure the integrity and consistency of the test process, greatly improving the comprehensiveness, accuracy and repeatability of software testing, effectively promoting software quality improvement and problem discovery, and ensuring that the generated data can meet the testing requirements in terms of quality, quantity and diversity.
[0110] According to an embodiment of the present disclosure, operation S230 of performing virtual user analysis on user behavior data to generate virtual users and virtual user behavior data includes operations S2301 to S2305 .
[0111] In operation S2301, user behavior data is cleansed.
[0112] Use the data processing and analysis library of data processing tools to preprocess data, remove duplicate records and invalid data, fill or delete missing values, and interpolate or fill with the mean as needed. Data processing tools are used for data cleaning, transformation, and analysis.
[0113] In operation S2302 , the cleaned user behavior data is statistically clustered to extract m types of user behavior patterns; m is an integer greater than 1.
[0114] Use the data visualization library of the data processing tool to perform statistical analysis on the data, calculate the frequency and distribution of various operations, cluster user behaviors through clustering algorithms (such as K-means algorithm, hierarchical clustering algorithm, etc.), and extract common user behavior patterns.
[0115] In operation S2303 , based on the m types of user behavior patterns, the users are classified into roles to construct a role model.
[0116] The basis for role classification includes operation frequency, operation type and user needs, etc., to ensure that the behavior pattern of each role can cover the main usage scenarios in the actual system. The classification method is as follows: (1) High-frequency users: These users frequently perform system operations, usually logging in and interacting multiple times a day, such as users who perform multiple transfer operations every day, users who frequently check balances and transaction records. Their behavior pattern is characterized by high-frequency operations and long-term use. (2) Low-frequency users: These users have a low login and operation frequency, and may only log in once or occasionally within a specific time period, such as users who log in once a week and do not necessarily perform transactions, and high-value transaction users who transfer large amounts each time. Their behavior pattern is characterized by low-frequency login and short-term use. (3) Administrator role: This type of user has the authority to perform advanced operations such as system configuration and maintenance, and their behavior pattern is different from that of ordinary users. (4) Potential customers: This type of user frequently browses and searches but does not complete conversions (for example, they have not made a purchase or registration). Their behavior pattern is mainly characterized by browsing operations.
[0117] In operation S2304, the role model is trained using a machine learning algorithm.
[0118] You can choose Generative Adversarial Networks (GANs) or Variational Autoencoders (VAEs) to generate virtual user data. These algorithms are good at generating data with a distribution similar to real data. Model training: Use a deep learning framework to train the character model.
[0119] Divide the cleaned user behavior data into a training set and a validation set. Model construction: Build a GAN or VAE model, defining the generator and discriminator (for GAN) or the encoder and decoder (for VAE). Training: Train the model using the training set, tuning hyperparameters to ensure the generated virtual user data matches the distribution of real user behavior.
[0120] In operation S2305 , the trained role model is used to analyze and verify the real behavior association data to obtain a virtual user and virtual user behavior data.
[0121] In the embodiments of the present disclosure, the learning results of the model are fully utilized to deeply explore the potential patterns in real data, so that the generated virtual users and their behaviors are highly consistent with the characteristics of real scenarios, thereby effectively improving the authenticity, representativeness and effectiveness of the test data.
[0122] Figure 6 The following schematically shows a role classification flow chart of a software testing method based on a virtual scenario according to an embodiment of the present disclosure.
[0123] like Figure 6 As shown, according to an embodiment of the present disclosure, in operation S2303 , based on m types of user behavior patterns, user roles are classified to construct a role model, including operations S610 - S640 .
[0124] In operation S610 , behavior features corresponding to m types of user behavior patterns are extracted.
[0125] Behavioral characteristics include, but are not limited to, frequency, time distribution, and operation sequence. For example, frequency defines the frequency of operations for each user type, e.g., a frequent trader logs in three times a day and makes two transfers each time. Time distribution defines the time distribution of a user's operations based on analysis results, e.g., an occasional trader typically logs in on weekends. Operation sequence describes the common operation sequence for each user type, e.g., a high-volume trader might have an operation sequence of login -> balance check -> transfer.
[0126] In operation S620 , users are divided into different user roles based on their behavioral characteristics; wherein each user role has a different user behavior pattern.
[0127] There is a close connection between role classification and behavior patterns. Users are divided into different roles based on their behavioral characteristics and operating habits, and each role has different behavior patterns.
[0128] In operation S630 , a feature vector corresponding to each type of user role is created.
[0129] Create a feature vector for each user role, including information such as operation frequency, time distribution, and common operation sequences.
[0130] In operation S640 , a role model is constructed based on the feature vector and preset behavior rules.
[0131] Behavioral rules are preset by defining user behavior rules and conditions, such as high-value transaction users will not make large transfers when their balance is insufficient.
[0132] In the embodiments of the present disclosure, it helps to accurately depict the unique attributes and behavior patterns of different types of users, realistically simulate users, and assist in system testing and service optimization.
[0133] Figure 7 The following schematically illustrates an analysis and verification flow chart of a software testing method based on a virtual scenario according to an embodiment of the present disclosure.
[0134] like Figure 7 As shown, according to an embodiment of the present disclosure, in operation S2305 , the trained role model is used to analyze and verify the real behavior association data to obtain the virtual user and the virtual user behavior data, including operations S710 - S740 .
[0135] In operation S710 , real behavior association data is input into the trained role model to generate initial virtual user behavior data.
[0136] Real-world behavior-related data includes, but is not limited to, historical user behavior data (such as user login logs, operation records, and transaction data), user profile data (such as basic user information such as age, gender, and region), external influencing factors (such as season, promotions, and holidays), and operation sequence data (such as the specific operation sequence and interaction content from login to logout). This data is input into a trained persona model to generate virtual user behavior data that matches real user behavior. Using the trained model to generate initial virtual user behavior data ensures data diversity and authenticity.
[0137] In operation S720 , initial virtual user behavior data is assigned to different user roles to generate virtual users.
[0138] According to the user role definition, the initial virtual user behavior data is assigned to different user roles. The specific method of role assignment can be automated through data analysis and simulation tools to ensure that the generated data is consistent with the test requirements. Among them, the principles of role assignment mainly include: (1) Based on behavior pattern: roles are assigned according to the user's behavior characteristics (such as operation frequency, time distribution, etc.), ensuring that each role represents a different behavior pattern. (2) Based on scenario requirements: appropriate user roles are selected according to specific test scenario requirements (such as load testing, user experience testing, etc.). (3) Based on business goals: For example, if the goal is to test the system's processing capacity, a large number of high-frequency users can be assigned; if the goal is to test the user's interactive experience, more low-frequency users can be assigned.
[0139] In operation S730 , the initial virtual user behavior data corresponding to the virtual user is compared and verified based on the real behavior association data.
[0140] The validity of the generated virtual user data is verified by comparing it with the real user behavior to ensure that its behavior pattern meets expectations. The specific process of behavior verification is as follows: (1) Data collection: Collect the behavior data of real users, including login information, operation logs, etc. (2) Virtual data generation: Generate virtual user data through the model and simulate its behavior in the system. (3) Comparative analysis: Compare the virtual user behavior data with the real data to evaluate its similarity, coverage, etc. Focus on the matching of factors such as user operation path, operation frequency, and time distribution. (4) Adjustment and optimization: If the comparison finds that there is a large deviation between the virtual data and the real data, the model needs to be adjusted, including modifying the behavior rules, parameterizing the model, and reclassifying the user roles.
[0141] In operation S740 , the verified virtual user data is imported into a database of the virtual environment to obtain virtual user behavior data.
[0142] Import the verified virtual user data into the test database for subsequent testing. Record the virtual user's operation log for analysis and optimization.
[0143] If the initial virtual user behavior data fails verification, the data is regenerated through an adjustment method, which includes: (1) re-examining the user behavior model and scenario design, (2) adjusting the characteristics of the input data to optimize the model training process, and (3) revising the scenario and role classification based on the test results.
[0144] In the embodiments of the present disclosure, the validity of the generated virtual user data is verified by comparing it with the real user behavior data to ensure that its behavior pattern meets expectations and the accuracy of user behavior during the test is ensured.
[0145] According to an embodiment of the present disclosure, in operation S240, based on virtual users, in a virtual scene, the software to be tested is stress tested using test scripts, automated interactive test data and virtual user data to obtain performance test feedback data corresponding to the software to be tested, including operations S2401-S2405.
[0146] In operation S2401 , a testing tool is configured in a virtual environment.
[0147] Select appropriate software performance testing tools to evaluate the performance of the software under test under different load conditions. Install and configure the selected testing tool to ensure it interacts properly with the virtual user generation system and application server. Testing tools are typically installed on dedicated test servers or virtual machines within a virtual environment to ensure smooth interaction with the virtual user generation system and application server. The virtual user generation system is the system module that generates virtual user behavior data. It simulates virtual user behavior based on scenario design and user models. Application servers are the servers that run actual business applications, and virtual user data is verified against these servers.
[0148] In operation S2402 , a test plan is configured based on the virtual user.
[0149] In operation S2403 , a monitoring tool is configured in the virtual environment based on preset monitoring indicators.
[0150] Preset monitoring indicators include but are not limited to response time (recording the response time of each operation step, such as login time, transfer confirmation time, query response time, etc.), resource usage (monitoring the server's CPU usage, memory usage, disk I / O, network bandwidth and other resource usage), error rate (recording the error rate of each operation step, and counting the number and type of failed requests).
[0151] Monitoring tools include but are not limited to server monitoring (using monitoring tools to monitor server resource usage), log collection (configuring log collection tools to collect and analyze application logs to obtain detailed error information and performance data), and application performance management (using application performance management tools to deeply monitor application performance and obtain call chain and bottleneck analysis).
[0152] In operation S2404 , based on the test plan, in a virtual scenario, a virtual environment is used to simulate user behaviors under different loads, and test tools and test scripts are used to automatically interact with test data and virtual user data to perform stress testing on the software to be tested.
[0153] In operation S2405 , performance test feedback data is exported from the testing tool and the monitoring tool to obtain performance test feedback data corresponding to the software to be tested.
[0154] Export performance test feedback data from performance testing tools and monitoring tools, including response time, resource usage, error rate, etc.
[0155] In the embodiments of the present disclosure, the virtual environment and the behavior of the virtual user are highly consistent, and the test results are generally applicable and comprehensive.
[0156] Figure 8A test plan configuration flowchart of a software testing method based on a virtual scenario according to an embodiment of the present disclosure is schematically shown.
[0157] like Figure 8 As shown, according to an embodiment of the present disclosure, in operation S2402 , configuring a test plan based on a virtual user includes operations S810 - S830 .
[0158] In operation S810 , a virtual user group is configured in a test tool based on the virtual user.
[0159] Configure multiple virtual user groups in the test tool, each group representing different types of user roles (such as frequent transaction users, occasional login users, etc.).
[0160] In operation S820 , the virtual user group is allocated to a concurrent group according to the set number of concurrent users to obtain a concurrent user group.
[0161] Set different numbers of concurrent users, gradually increasing from low to high, for example, from 100, 500, 1000 to 5000 concurrent users.
[0162] In operation S830 , test time elements of the concurrent user group are configured to obtain a test plan.
[0163] Develop a detailed test plan that defines the test time elements for each concurrent user group, including key time points such as start time, duration, and end time.
[0164] In the embodiments of the present disclosure, a test plan is used to rationally plan concurrent tests, accurately control time, and efficiently evaluate system performance and stability.
[0165] According to an embodiment of the present disclosure, after performing stress testing on the software to be tested and obtaining performance test feedback data corresponding to the software to be tested in operation S240, the process further includes analyzing the performance test feedback data corresponding to the software to be tested to generate a software test report.
[0166] According to an embodiment of the present disclosure, analyzing performance test feedback data corresponding to the software to be tested to generate a software test report includes operations S2501 to S2503.
[0167] In operation S2501 , data cleaning is performed on performance test feedback data corresponding to the software to be tested.
[0168] Use data processing tools to clean and preprocess the exported data to remove invalid data and outliers.
[0169] In operation S2502 , the cleaned performance test feedback data is subjected to software performance analysis to obtain analysis data.
[0170] Software performance analysis includes but is not limited to response time analysis (calculating and drawing the response time distribution graph of each operation step, and analyzing the response time changes under different numbers of concurrent users), resource usage analysis (drawing a server resource utilization curve graph, and analyzing resource usage under different numbers of concurrent users), and error rate analysis (counting and analyzing the error rate of each operation step, finding the operation steps with high error rates and the corresponding error types).
[0171] In operation S2503 , a performance evaluation is performed on the analysis data to generate a software test report.
[0172] Performance evaluation includes but is not limited to performance bottleneck location (locating system performance bottlenecks such as database query, network transmission, and application logic processing based on response time and resource usage), stability evaluation (evaluating the stability of the system under high concurrency conditions, such as whether the system can continue to provide services, whether resource exhaustion occurs, whether there are crashes, etc.), and improvement suggestions (based on the analysis results, proposing performance optimization and improvement suggestions, such as increasing server resources, optimizing database queries, and improving code logic).
[0173] Based on the performance evaluation results, a corresponding software test report can be generated. The generation process is as follows: (1) Report writing: Write a detailed performance test report, including the test background, test environment, test script, test results, analysis conclusions, and improvement suggestions. (2) Chart presentation: Use data visualization tools to generate charts of test results, such as response time distribution charts, resource utilization curve charts, error rate statistics charts, etc. (3) Results presentation: Submit the test report and charts to the product team and technical team to help them understand the system performance and improvement directions.
[0174] In the embodiments of the present disclosure, the performance test feedback data of the software is comprehensively analyzed to obtain an accurate software test report, which can discover and solve problems before the product goes online, thereby improving testing efficiency.
[0175] Figure 9 The following schematically illustrates a flow chart of user experience evaluation of a software testing method based on a virtual scenario according to an embodiment of the present disclosure.
[0176] like Figure 9 As shown, according to an embodiment of the present disclosure, after the software test report is generated in operation S2503, the user experience of the software may be further evaluated, and the evaluation process includes operations S910-S930.
[0177] In operation S910 , in the configured log system, a log collection tool is used to collect log data recorded during the stress test.
[0178] Use log collection tools to collect, store, and analyze log data. Maintain a unified log format when collecting and recording log data to ensure convenient analysis and processing of log data from different sources. Configure a data collection engine to collect server and client logs and send them to a distributed search and analysis engine for storage. Aggregate log data from different sources into a single distributed search and analysis engine index for unified analysis.
[0179] The recorded log data includes server-side logs (configure logging on the application server to record the operations of each virtual user, including request time, request type, request parameters, response time, response results, etc.) and client-side logs (configure logging on the virtual user client to record detailed information about user operations, including operation time, operation type, operation results, page loading time, etc.).
[0180] In operation S920 , behavior analysis is performed on the recorded log data to obtain a user behavior analysis result.
[0181] Behavioral analysis includes data cleaning and preprocessing, smoothness analysis, success rate and error rate analysis.
[0182] Data cleaning and preprocessing include log parsing (using a data collection engine or a customized log parsing tool to parse the collected log data and extract key fields such as user ID, operation type, operation time, response time, operation results, etc.), data cleaning (removing invalid and duplicate data, processing missing values, and ensuring data integrity and accuracy).
[0183] Smoothness analysis includes operation path analysis (using network analysis and graph theory libraries to analyze user operation paths, draw user operation flow charts, and identify common user operation paths and steps), page loading time (counting the loading time of each page, analyzing the smoothness of page loading, and identifying pages and steps with longer loading times).
[0184] Success rate and error rate analysis includes success rate calculation (calculating the success rate of each operation step, such as login success rate, transfer success rate, query success rate, etc.), error rate statistics (counting the error rate of each operation step and identifying the number and type of failed requests, such as login failure, transfer failure, etc.), and error cause analysis (analyzing error logs to find common error causes, such as network problems, server timeouts, data verification failures, etc.).
[0185] In operation S930 , based on the user behavior analysis result, user problem identification is performed on the recorded log data to generate a user experience evaluation report.
[0186] User problem identification includes bottleneck identification, user experience problem classification, report generation, and report presentation.
[0187] Bottleneck identification includes response time bottlenecks (analyzing the response time distribution of operation steps, identifying steps with longer response times, and finding performance bottlenecks) and high error rate steps (counting operation steps with higher error rates and identifying key issues in user experience, such as operation steps that frequently fail).
[0188] User experience problem classification includes performance problems (identifying user experience problems caused by performance problems, such as slow page loading, slow operation response, etc.), functional problems (identifying user experience problems caused by functional defects, such as unavailable functions, complicated operation steps, etc.), and interaction problems (identifying user experience problems caused by interaction design, such as unfriendly operations, unclear prompt information, etc.).
[0189] Report generation includes problem description (detailed description of the identified user experience problem, including the operational steps for the problem, the scope of impact, the cause of the problem, etc.), data support (providing data support for problem analysis, such as response time distribution graphs, error rate statistics graphs, operation path graphs, etc.), and improvement suggestions (based on the problem analysis results, making targeted improvement suggestions, such as optimizing page loading performance, simplifying operation processes, improving prompt information, etc.).
[0190] Report presentation includes report writing (writing a detailed user journey evaluation report, i.e., a user experience evaluation report, which includes evaluation background, evaluation methods, data analysis, problem identification, improvement suggestions, etc.), chart display (using data visualization tools to generate charts of evaluation results, such as operation path diagrams, response time distribution diagrams, error rate statistics diagrams, etc.), and result reporting (submitting the evaluation report and charts to the product team and user experience team to help them understand user experience issues and improvement directions).
[0191] In the embodiments of the present disclosure, software problems are analyzed from the user's perspective, and an accurate user experience evaluation report is obtained. Data visualization technology can be used to intuitively display test results and user experience problems, which facilitates optimization by the product team.
[0192] Based on the above-mentioned software testing method based on virtual scenes, the present disclosure also provides a software testing device based on virtual scenes. Figure 10 The device is described in detail.
[0193] Figure 10 The following schematically shows a structural block diagram of a software testing device based on a virtual scene according to an embodiment of the present disclosure.
[0194] like Figure 10As shown, the virtual scene-based software testing device 1000 of this embodiment includes a scene data analysis module 1010 , a scene virtualization module 1020 , a virtual user analysis module 1030 and an automated testing module 1040 .
[0195] The scenario data analysis module 1010 is used to obtain scenario data of the software under test and perform behavior analysis on the scenario data to obtain a typical scenario. In one embodiment, the scenario data analysis module 1010 can be used to perform the operation S210 described above, which will not be repeated here.
[0196] The scene virtualization module 1020 is used to perform scene virtualization on a typical scene based on the scene data to generate test data and a virtual scene. In one embodiment, the scene virtualization module 1020 can be used to perform the operation S220 described above, which will not be repeated here.
[0197] The virtual user analysis module 1030 is used to collect user behavior data and perform virtual user analysis on the user behavior data to generate virtual users and virtual user behavior data. In one embodiment, the virtual user analysis module 1030 can be used to perform the operation S230 described above, which will not be repeated here.
[0198] The automated testing module 1040 is used to perform stress testing on the software under test using virtual users in a virtual scenario, utilizing test scripts, automated interactive test data, and virtual user data, to obtain performance test feedback data corresponding to the software under test. In one embodiment, the automated testing module 1040 can be used to perform operation S240 described above, which will not be further described here.
[0199] The apparatus 1000 further includes a test report generating module 1050 and a user experience evaluating module 1060 .
[0200] The test report generation module 1050 is used to analyze the performance test feedback data corresponding to the software to be tested to generate a software test report. In one embodiment, the test report generation module 1050 can be used to perform the operations S2501-S2503 described above, which will not be repeated here.
[0201] User experience evaluation module 1060 is used to collect log data recorded during stress testing using a log collection tool in a configured log system; perform behavioral analysis on the recorded log data to obtain user behavior analysis results; and, based on the user behavior analysis results, identify user issues in the recorded log data to generate a user experience evaluation report. In one embodiment, user experience evaluation module 1060 can be used to perform operations S910-S930 described above, which will not be further described here.
[0202] According to an embodiment of the present disclosure, any multiple modules among the scenario data analysis module 1010, the scenario virtualization module 1020, the virtual user analysis module 1030, the automated testing module 1040, the test report generation module 1050, and the user experience evaluation module 1060 can be combined into a single module for implementation, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in a single module. According to an embodiment of the present disclosure, at least one of the scenario data analysis module 1010, the scenario virtualization module 1020, the virtual user analysis module 1030, the automated testing module 1040, the test report generation module 1050, and the user experience evaluation module 1060 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware through any other reasonable means of integrating or packaging circuits, or can be implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, at least one of the scenario data analysis module 1010, the scenario virtualization module 1020, the virtual user analysis module 1030, the automated testing module 1040, the test report generation module 1050, and the user experience evaluation module 1060 can be at least partially implemented as a computer program module, which can perform corresponding functions when executed.
[0203] Figure 11 A block diagram of an electronic device suitable for implementing a software testing method based on a virtual scenario according to an embodiment of the present disclosure is schematically shown.
[0204] like Figure 11 As shown, the electronic device 1100 according to an embodiment of the present disclosure includes a processor 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage portion 1108 into a random access memory (RAM) 1103. The processor 1101 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1101 may also include onboard memory for caching purposes. The processor 1101 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0205] Various programs and data required for the operation of the electronic device 1100 are stored in the RAM 1103. The processor 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. The processor 1101 executes the various operations of the method flow according to the embodiment of the present disclosure by executing the programs in the ROM 1102 and / or the RAM 1103. It should be noted that the programs may also be stored in one or more memories other than the ROM 1102 and the RAM 1103. The processor 1101 may also execute the various operations of the method flow according to the embodiment of the present disclosure by executing the programs stored in the one or more memories.
[0206] According to an embodiment of the present disclosure, electronic device 1100 may further include an input / output (I / O) interface 1105, which is also connected to bus 1104. Electronic device 1100 may also include one or more of the following components connected to I / O interface 1105: an input section 1106 including a keyboard, mouse, etc.; an output section 1107 including devices such as a cathode ray tube (CRT), liquid crystal display (LCD), and speakers; a storage section 1108 including a hard disk; and a communication section 1109 including a network interface card such as a LAN card or modem. Communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to I / O interface 1105 as needed. Removable media 1111, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed in drive 1110 as needed, so that computer programs read from the removable media can be installed into storage section 1108 as needed.
[0207] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not be incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, and when executed, implements the method according to the embodiments of the present disclosure.
[0208] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, and may include, for example, but not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 1102 and / or RAM 1103 described above, and / or one or more memories other than ROM 1102 and RAM 1103.
[0209] The embodiments of the present disclosure also include a computer program product, which includes a computer program containing program code for executing the method shown in the flowchart. When the computer program product is executed in a computer system, the program code is used to enable the computer system to implement the virtual scenario-based software testing method provided by the embodiments of the present disclosure.
[0210] The computer program executes the above functions defined in the system / device of the embodiment of the present disclosure when the computer program is executed by the processor 1101. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0211] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal on a network medium, downloaded and installed via the communication portion 1109, and / or installed from removable media 1111. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0212] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1109 and / or installed from the removable medium 1111. When the computer program is executed by the processor 1101, the above-described functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the systems, devices, means, modules, units, etc. described above can be implemented by computer program modules.
[0213] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).
[0214] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0215] Those skilled in the art will appreciate that the features described in the various embodiments of the present disclosure may be combined and / or coupled in various ways, even if such combinations or couplings are not explicitly described in the present disclosure. In particular, the features described in the various embodiments of the present disclosure may be combined and / or coupled in various ways without departing from the spirit and teachings of the present disclosure. All such combinations and / or couplings fall within the scope of the present disclosure.
[0216] The above describes the embodiments of the present disclosure. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although each embodiment has been described separately above, this does not mean that the measures in each embodiment cannot be advantageously used in combination. Without departing from the scope of the present disclosure, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A software testing method based on a virtual scene, characterized in that: The method comprises: Obtaining scenario data of the software to be tested, and performing behavioral analysis on the scenario data to obtain typical scenarios; Based on the scenario data, performing scenario virtualization on the typical scenario to generate test data and a virtual scenario; Collecting user behavior data and performing virtual user analysis on the user behavior data to generate virtual users and virtual user behavior data; and Based on the virtual user, in the virtual scenario, a test script is used to automatically interact with the test data and the virtual user data to perform a stress test on the software to be tested, so as to obtain performance test feedback data corresponding to the software to be tested.
2. The method according to claim 1, characterized in that The behavioral analysis processing of the scenario data to obtain a typical scenario includes: extracting scene behavior patterns from the scene data; Classify different scenarios into different categories according to the scenario behavior patterns; and Based on multi-dimensional selection rules, the different scene categories are statistically analyzed to select the typical scene.
3. The method according to claim 1, characterized in that The performing scene virtualization on the typical scene based on the scene data to generate test data and a virtual scene includes: Based on the scenario data, performing scenario design modeling on the typical scenario to construct a scenario model; Building a virtual environment based on the scenario model to generate the test data; and Based on the scene model, the virtual scene is constructed in the constructed virtual environment.
4. The method according to claim 3, characterized in that The performing scenario design modeling on the typical scenario based on the scenario data to construct a scenario model includes: Extracting the operation steps of the typical scenario based on the scenario data; Determine the user's expected results based on the operation steps; Based on the operation steps and the user's expected results, draw a flowchart corresponding to the typical scenario and determine an exception handling strategy; and Based on the flowchart and the exception handling strategy, the typical scenario is parameterized to construct the scenario model.
5. The method according to claim 3, characterized in that The step of constructing a virtual environment based on the scenario model to generate the test data includes: Using a virtualization tool to create the virtual environment; Configuring system resources of the virtual environment; Installing the software to be tested in the virtual environment; Using a network simulation tool to simulate different network conditions to test the network environment performance of the software under test; and In the virtual environment, the test data is generated using the scenario model, and the test data is imported into a database of the virtual environment.
6. The method according to any one of claims 1 to 5, characterized in that The performing virtual user analysis on the user behavior data to generate virtual users and virtual user behavior data includes: Performing data cleaning on the user behavior data; Perform statistical clustering on the cleaned user behavior data to extract m types of user behavior patterns; m is an integer greater than 1; Based on the m types of user behavior patterns, users are classified into roles to construct a role model; Using a machine learning algorithm to train the role model; and The trained role model is used to analyze and verify the real behavior association data to obtain the virtual user and the virtual user behavior data.
7. The method according to claim 6, characterized in that The user role classification based on the m types of user behavior patterns to construct a role model includes: Extracting behavioral features corresponding to the user behavior patterns of the m categories; Based on the behavioral characteristics, the users are divided into different user roles; wherein each user role has a different user behavior pattern; Creating a feature vector corresponding to each type of user role; and The role model is constructed based on the feature vector and preset behavior rules.
8. The method according to claim 3, characterized in that The method of analyzing and verifying the real behavior association data using the trained role model to obtain the virtual user and the virtual user behavior data includes: Inputting the real behavior association data into the trained role model to generate initial virtual user behavior data; Allocating the initial virtual user behavior data to the different user roles to generate the virtual users; Based on the real behavior association data, comparing and verifying the initial virtual user behavior data corresponding to the virtual user; and The verified virtual user data is imported into the database of the virtual environment to obtain the virtual user behavior data.
9. The method according to claim 1, characterized in that The method of performing a stress test on the software to be tested by automatically interacting the test data and the virtual user data in the virtual scenario based on the virtual user to obtain performance test feedback data corresponding to the software to be tested includes: configuring a test tool in the virtual environment; Based on the virtual user, configure a test plan; Based on preset monitoring indicators, configuring monitoring tools in the virtual environment; Based on the test plan, in the virtual scenario, using the virtual environment to simulate user behaviors under different loads, and automatically interacting the test data and the virtual user data through the test tool and the test script to perform stress testing on the software to be tested; The performance test feedback data is exported from the testing tool and the monitoring tool to obtain the performance test feedback data corresponding to the software to be tested.
10. The method according to claim 9, characterized in that The configuring of the test plan based on the virtual user includes: Based on the virtual user, configuring a virtual user group in the testing tool; According to the set number of concurrent users, the virtual user group is allocated to a concurrent group to obtain a concurrent user group; and The test time element of the concurrent user group is configured to obtain the test plan.
11. The method according to claim 1, wherein The method further includes: analyzing performance test feedback data corresponding to the software to be tested to generate a software test report; The analyzing the performance test feedback data corresponding to the software to be tested to generate a software test report includes: Performing data cleaning on the performance test feedback data corresponding to the software to be tested; Performing software performance analysis on the cleaned performance test feedback data to obtain analysis data; and A performance evaluation is performed on the analysis data to generate the software test report.
12. The method according to claim 1, characterized in that The method further comprises: In the configured log system, use the log collection tool to collect the log data recorded during the stress test; Performing behavior analysis on the recorded log data to obtain user behavior analysis results; and Based on the user behavior analysis results, user problem identification is performed on the recorded log data to generate a user experience evaluation report.
13. A software testing device based on a virtual scene, characterized in that: The device comprises: The scenario data analysis module is used to obtain scenario data of the software to be tested and perform behavior analysis on the scenario data to obtain typical scenarios; A scene virtualization module, configured to perform scene virtualization on the typical scene based on the scene data to generate test data and a virtual scene; a virtual user analysis module, configured to collect user behavior data and perform virtual user analysis on the user behavior data to generate virtual users and virtual user behavior data; and The automated testing module is used to automatically interact the test data and the virtual user data in the virtual scenario based on the virtual user using a test script to perform a stress test on the software to be tested to obtain performance test feedback data corresponding to the software to be tested.
14. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 12.
15. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instructions are executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.