System testing method, device, equipment, medium and program product
By obtaining current test task information and testing the system to be tested in combination with historical test data, the problem of test data in the existing technology cannot be reused, and the effect of improving system testing efficiency and accuracy is achieved.
Patent Information
- Application Number
- CN202411865993.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-03-28
AI Technical Summary
The existing testing methods require the construction of corresponding test data according to the system to be tested each time, which leads to the inability to reuse the test data, resulting in cumbersome construction of test data and low data utilization efficiency.
By obtaining the current test task information, newly generated test data (first data) are generated, and historical test data (second data) matching the test task information is queried in the database, and tests are performed on the system to be tested in combination with the first data and the second data to be tested to improve the testing efficiency and accuracy.
It achieves the improvement of system testing efficiency and accuracy, reduces the time of testing data generation, and improves the multiplexing rate and utilization efficiency of test data.
Smart Images

Figure CN119718944A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of big data technology, and more specifically to a system testing method, device, equipment, medium and program product. Background Art
[0002] During the software development process, the system needs to be tested based on test data to verify whether the current system meets the requirements and ensure that the system can work normally in the actual production environment.
[0003] The existing testing method is to construct corresponding test data according to the system to be tested each time, and perform testing based on the constructed test data. After the test is completed, the test data is directly discarded and cannot be reused, resulting in cumbersome test data construction work for each test and low data utilization efficiency. Summary of the invention
[0004] In view of the above problems, the present disclosure provides a system testing method, apparatus, device, medium and program product for improving testing efficiency and accuracy.
[0005] According to the first aspect of the present disclosure, a system testing method is provided, including: obtaining current test task information; generating first data based on the test task information; wherein the first data is newly generated test data in the current scenario; querying a database for historical test data matching the test task information, and determining second data based on the query result; wherein the second data is obtained based on the historical test data, and the database is used to classify and store the historical test data; and performing a test on a system to be tested based on the first data and the second data to obtain a test result of the system to be tested.
[0006] According to an embodiment of the present disclosure, the test task information includes system information and test environment information; the system information includes attribute information and connection relationship information, and the test environment information includes at least one of the test purpose, key parameters, data dependency, and business logic.
[0007] According to an embodiment of the present disclosure, historical test data matching the test task information is queried in a database, and second data is obtained based on the query result, including: determining a target database from multiple databases based on system information; wherein different databases store different test data; searching for target historical test data from the target database based on test environment information; and determining second data based on the target historical test data.
[0008] According to an embodiment of the present disclosure, the target database includes databases corresponding to the current system and an upstream system of the current system.
[0009] According to an embodiment of the present disclosure, searching for target historical test data from a target database based on test environment information includes: determining at least one data table that meets the current business scenario from the target database based on the test environment information; obtaining parameter information of each historical test data in the data table; wherein the parameter information of the historical test data includes link information and log information of each test data; determining whether the historical test data is applicable to the current system to be tested based on the link information; and determining the historical test data as target historical test data when the historical test data is applicable to the current system to be tested.
[0010] According to an embodiment of the present disclosure, determining the second data based on the target historical test data includes: obtaining a data version corresponding to the current test environment information based on the log information of the target historical test data, and determining the historical test data of this version as the second data; or adaptively modifying the target historical test data based on the test task information; and determining the modified target historical test data as the second data.
[0011] According to an embodiment of the present disclosure, it further includes: when the target historical test data is adaptively modified based on the test task information, the modification information is recorded in the log information of the target historical test data.
[0012] According to an embodiment of the present disclosure, generating first data based on test task information includes: selecting a corresponding generation method for the first data based on the test task information; generating the first data according to the generation method; wherein the test data generation method is determined by the test purpose.
[0013] According to an embodiment of the present disclosure, the method also includes: regularly obtaining access logs of each database; obtaining access information of each historical test data based on the access logs; determining and deleting historical test data in the database that meets a first condition based on the access information; wherein the historical test data that meets the first condition is historical test data that has not been subjected to a specified operation within a specified time range.
[0014] The second aspect of the present disclosure provides a system testing device, including: an acquisition module, used to acquire current test task information; a generation module, used to generate first data based on the test task information; wherein the first data is newly generated test data in the current scenario; a determination module, used to query historical test data matching the test task information in a database, and determine second data based on the query result; wherein the second data is obtained based on the historical test data, and the database is used to classify and store the historical test data; a test module, used to perform a test on a system to be tested based on the first data and the second data together, to obtain a test result of the system to be tested.
[0015] 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.
[0016] 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 above computer program or instructions are executed by a processor.
[0017] The fifth aspect of the present disclosure further provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the above computer program or instructions are executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] 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:
[0019] Figure 1 The application scenario diagram of the system testing method, apparatus, device, medium and program product according to the embodiment of the present disclosure is schematically shown;
[0020] Figure 2 A flowchart of a system testing method according to an embodiment of the present disclosure is schematically shown;
[0021] Figure 3 A flowchart schematically illustrates searching a database for historical test data matching test task information and obtaining second data based on the query result according to an embodiment of the present disclosure;
[0022] Figure 4 A flowchart of searching for target historical test data from a target database based on test environment information according to an embodiment of the present disclosure is schematically shown;
[0023] Figure 5 A flowchart of searching for target historical test data from a target database based on test environment information according to an embodiment of the present disclosure is schematically shown;
[0024] Figure 6 A flowchart for generating first data based on test task information according to an embodiment of the present disclosure is schematically shown;
[0025] Figure 7 A flowchart schematically illustrates a process of periodically performing a clearing operation on test data in a database according to an embodiment of the present disclosure;
[0026] Figure 8 A structural block diagram of a system testing device according to an embodiment of the present disclosure is schematically shown; and
[0027] Fig. 9 A block diagram of an electronic device suitable for implementing a system testing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0028] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, 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 known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0029] In the technical solution of the present disclosure, the information and data involved (including but not limited to data used for analysis, stored data, displayed data, etc.) are all information and data 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.
[0030] 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 existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0031] All terms (including technical and scientific terms) used herein 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.
[0032] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression 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.).
[0033] It should be noted that the system testing method and device provided in the present disclosure can be used in testing scenarios in the financial field, and can also be used in any field other than the financial field. The application field of the system testing method and device provided in the present disclosure is not limited.
[0034] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0035] An embodiment of the present disclosure provides a system testing method, including: obtaining scenario information of a current test; generating first data based on test task information; wherein the first data is newly generated test data in the current scenario; querying a database for historical test data that matches the test task information, and determining second data based on the query result; wherein the second data is obtained based on the historical test data, and the database is used to classify and store the historical test data; and performing a test on the system in the target scenario based on the first data and the second data to obtain a system test result.
[0036] Figure 1 The application scenario diagram of the system testing method, apparatus, device, medium and program product according to the embodiments of the present disclosure is schematically shown.
[0037] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0038] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0039] 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.
[0040] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for 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 the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0041] It should be noted that the system testing method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the system testing device provided in the embodiment of the present disclosure can generally be set in the server 105. The system testing method 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 system testing device 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.
[0042] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0043] The following will be based on Figure 1 The scene described by Figure 2~Figure 6 The system testing method of the disclosed embodiment is described in detail.
[0044] Figure 2 The flowchart of the system testing method according to the embodiment of the present disclosure is schematically shown.
[0045] like Figure 2 As shown, the system testing method of this embodiment includes operations S210 to S240.
[0046] In operation S210, current test task information is obtained.
[0047] In some embodiments, the test task information includes system information and test environment information. Among them, the system information at least includes the attribute information of the current system to be tested and the connection relationship information between the current system to be tested and other systems. The attribute information of the system to be tested includes the version information of the system, interface information, etc. The test environment information includes the test purpose, key parameters, data dependency, business logic, etc. The test purpose may include, for example, functional testing, performance testing, security testing, etc. The key parameters are data or conditions that have a direct impact or a decisive factor on the test results. The key parameters are usually selected and set according to the test objectives. The test purpose is performance testing. When testing the payment function of a certain software, the key parameters may include, for example, the number of concurrent users, request response time, payment success rate, etc. These parameters can directly reflect the performance and stability of the payment function. Data dependency is the mutual dependency between different test data or between test data and the test environment and the system under test. This relationship may be manifested as a logical relationship between data, a temporal relationship, or a dependency on a specific environmental state. Obtaining data dependency helps to ensure the integrity and consistency of test data when constructing test data, and improves test coverage and accuracy. Business logic refers to the logical structure that describes business operation rules, processes, strategies, etc. For example, when testing a bank system in a money transfer scenario, it is necessary to obtain the business logic of the money transfer to improve the accuracy of the test.
[0048] In operation S220, first data is generated based on the test task information; wherein the first data is newly generated test data in the current scenario.
[0049] In some embodiments, the generation method of the first data can be determined based on the test task information. The first data is usually test data that can cover all requirements in the current test scenario, and can more accurately reflect the actual needs and problems in the current scenario. For example, the corresponding generation method can be selected according to the current test scenario and the test purpose of the first data to generate the first data. For example, according to the designed test data template or rule, the specific test data can be generated using the corresponding tool or script.
[0050] In operation S230, historical test data matching the test task information is searched in the database, and second data is determined based on the query result; wherein the second data is obtained based on the historical test data, and the database is used to classify and store the historical test data.
[0051] In some embodiments, historical test data matching the current test scenario is queried in the database based on the test task information, and second data is determined based on the queried historical test data. The second data may be the queried historical test data directly, or may be obtained by adaptively modifying the queried historical test data.
[0052] In the specific implementation process, the present disclosure will record each test data separately in the corresponding database. Among them, the test data stored in different databases are different. For example, the historical test data can be stored separately from the system dimension, that is, each database only stores the historical test data for the specified system. In addition, the database also stores parameter information of each historical test data, wherein the parameter information is used to reflect the application information of the historical test data in the historical test scenario, for example, it may include the transmission path of the historical test data and the historical test log, etc. After obtaining the current test task information, the corresponding database is selected based on the current test task information, and the historical test data matching the current test task information is queried in the database to generate the second data based on the queried historical test data. For example, the parameter information of each historical test data is matched with the current test task information. If the matching degree is higher than the preset threshold, the second data is obtained based on the historical test data.
[0053] In operation S240, a test is performed on the system to be tested according to the first data and the second data to obtain a test result of the system to be tested.
[0054] In some embodiments, after the first data and the second data are obtained, a test is performed on the system in the target scenario based on the first data and the second data to obtain a test result of the system to be tested.
[0055] The present disclosure tests the system to be tested based on newly generated test data and historical test data together, which can effectively improve the comprehensiveness and accuracy of system testing. On the one hand, the newly generated test data can cover the latest business scenarios, functional changes and performance requirements, ensure the support for new requirements of the system to be tested, and help discover newly introduced problems. Historical test data can be used for the past status of the system and known problem scenarios to verify whether the new system can still correctly handle old data and old scenarios to avoid introducing regression problems. In addition, directly calling historical test data can also effectively improve the efficiency of test data use, reduce test data generation time, and thus improve system testing efficiency.
[0056] Figure 3 The flowchart schematically shows a method of searching a database for historical test data matching test task information and obtaining second data based on the query result according to an embodiment of the present disclosure.
[0057] like Figure 3 As shown, in this embodiment, searching the database for historical test data matching the test task information and obtaining the second data based on the query result include operations S310 to S330.
[0058] In operation S310, a target database is determined from among a plurality of databases based on system information.
[0059] In some embodiments, historical test data is classified and stored in databases, and different databases store different test data. The target database can be determined from multiple databases based on system information. For example, the test data is stored in the corresponding database according to the system type, that is, the test data for system A is stored in database 1, the test data for system B is stored in database 2, and so on. It should be noted that if the test data can be applied to multiple databases, the test data is stored in the database corresponding to the upstream system.
[0060] The upstream system usually refers to the system at the beginning or source of the business process, data flow or supply chain, while the downstream system refers to the system at the subsequent or key part of the business process, data flow or supply chain. Among them, the upstream system and the downstream system can be determined according to the data transmission mechanism. The upstream system is the starting point of the data flow and is used to transmit the data flow to the downstream system. The downstream system is used to receive the data flow provided by the upstream data and further process or display the data flow.
[0061] Since the downstream system usually relies on the data or services provided by the upstream system to complete its functions, the downstream system can reuse the test data of the upstream system for testing. Therefore, when determining the target database, the database corresponding to the current system and the database corresponding to the upstream system of the current system can be determined as the target database based on the system information, and the second data can be obtained in the target database.
[0062] In operation S320, target historical test data is searched from a target database based on the test environment information.
[0063] In some embodiments, the test environment information may include, for example, the test purpose, key parameters, data dependencies, business logic, etc., and reusable historical test data (i.e., target historical test data) may be selected from the target database based on the test environment information. Selecting the target historical test data from the target database includes: clarifying the test purpose, selecting the corresponding grouping from the database based on the test purpose, and selecting the reusable historical test data based on the key parameters and data dependencies. Specifically, query statements may be written based on the test purpose, key parameters, and data dependencies, or a database management tool may be used to retrieve historical test data from the database, and a data set that meets the test requirements may be screened out from the retrieved data to obtain the target historical test data. For example, the screened data set that meets the test requirements may be screened based on conditions such as time range, data type, and data value to obtain the target historical test data.
[0064] In operation S330 , second data is determined based on the target historical test data.
[0065] In some embodiments, the second data may be target historical test data, or may be data obtained by adaptively modifying the target historical test data.
[0066] Adaptive modification of the target historical test data may include, for example: adjusting the field length of the historical test data, adding fields, updating fields, etc. By adaptively modifying the historical test data, the matching degree between the second data and the current test scenario is improved, thereby improving the test accuracy.
[0067] The system testing method provided by the present disclosure improves the efficiency of data retrieval by gradually narrowing the data range when determining the second data, thereby quickly determining the second data. In addition, the second data determination method is relatively flexible. The second data can be a direct application of the target historical test data or a result of modifying the target historical test data, thereby effectively improving the flexibility of the second data and making the second data more in line with the needs of the current test scenario.
[0068] Figure 4 The flowchart of searching for target historical test data from a target database based on test environment information according to an embodiment of the present disclosure is schematically shown.
[0069] like Figure 4 As shown, searching for target historical test data from a target database based on test environment information in this embodiment includes operations S410 to S440.
[0070] In operation S410, at least one data table that meets the current business scenario is determined from a target database based on the test environment information.
[0071] In some embodiments, the purpose and scope of the test task are understood based on the test environment information, and the business scenario is clarified. For example, the test may be to verify new functions, fix known problems, perform performance evaluation, or perform security testing. According to the test purpose, the specific business scenario that needs to be simulated or verified is clarified.
[0072] After clarifying the business scenario, analyze key parameters and sort out data dependencies based on the business scenario, and determine at least one data table related to the current business scenario from the target database.
[0073] Specifically, based on the business scenario, the key parameters required for the current test are identified, and the data flow path in the current test scenario is understood. According to the key parameters and flow path, the corresponding data tables are matched in the target database. Among them, the key parameters are fields that may directly affect the execution of business logic or the verification of results. The data flow path includes data input, processing, output and other links. The data flow path is used to analyze whether the test data depends on other data or system status. For example, some tests may require specific user data or account balances as input. Through the above analysis, a comprehensive assessment is made of which data tables are key tables that meet the current business scenario. These data tables contain the key fields required for the test, have the necessary data dependencies and are closely connected with the business logic. The second data can be found in these data tables.
[0074] In operation S420, parameter information of each historical test data in the data table is obtained; wherein the parameter information of the historical test data includes link information and log information of each test data.
[0075] In some embodiments, after determining that the current data table is met, parameter information of each test parameter in the data table is obtained to select second data from the data table based on the parameter information of the test data.
[0076] Specifically, the parameter information of the data table may include, for example, test data ID, link information, log information and other test parameters. The test data ID is used to uniquely identify each test data, the link information is used to describe the transmission path of the test data in the system, and the log information records the detailed logs generated during the test process.
[0077] In operation S430, it is determined whether the historical test data is applicable to the current system to be tested based on the link information.
[0078] In some embodiments, the link information generally describes the flow path of data in the system, including the servers, network nodes, application interfaces, etc. passed through. The link information can be analyzed to determine which nodes or components in the link are directly or highly related to the current system under test, thereby evaluating the applicability of the test parameters in the system under test.
[0079] For example, if the link information clearly indicates that the test information will flow through the key parts of the system under test, then this test data can be directly applied to the system under test. If the link information indicates that the test data does not directly flow through the core part of the system under test, but can indirectly affect the system under test in some way (such as simulation, redirection, etc.), then this test data may need to be properly adjusted or converted before it can be used. If the link information is completely irrelevant to the system under test, or the components that the test data depends on do not exist in the system under test or are outdated, then this test data is not applicable to the current system under test.
[0080] In operation S440 , if the historical test data is applicable to the current system to be tested, the historical test data is determined as target historical test data.
[0081] In some embodiments, if the historical test data is applicable to the current test system, the historical test data is determined as the target historical test data for subsequent acquisition of the second data.
[0082] The system testing method provided by the embodiment of the present disclosure selects the corresponding data table from the target database based on the test environment information, which can ensure that the test data is directly related to the actual business needs, thereby improving the pertinence and effectiveness of the test, and improving the matching degree between the test data and the business scenario. By obtaining and analyzing the link information and log information of each test data in the data table, the source, flow direction and key information of the test data in the historical processing process can be understood, so as to effectively judge whether the test data is applicable to the current system to be tested, which can improve the pertinence, effectiveness and accuracy of the test data, avoid introducing irrelevant data into the test process, and save test time and resources.
[0083] Figure 5 The flowchart of searching for target historical test data from a target database based on test environment information according to an embodiment of the present disclosure is schematically shown.
[0084] like Figure 5 As shown, searching for target historical test data from a target database based on test environment information in this embodiment includes operations S510 to S530.
[0085] In operation S510, a data version corresponding to current test environment information is acquired based on log information of target historical test data, and the test data of this version is determined as second data.
[0086] In some embodiments, information related to the data version is extracted from the parsed log information, and the extracted data version information is matched with a predefined data version library, wherein the data version library should contain detailed information of all available data versions, including version number, release time, applicable environment, etc. After the match is successful, the corresponding test data version is selected from the data version library according to the current test environment information, and is determined as the second data.
[0087] In operation S520 , the target historical test data is adaptively modified based on the test task information.
[0088] In operation S530, the modified target historical test data is determined as second data.
[0089] In some embodiments, if the link information indicates that the test data does not directly flow through the core part of the system under test, but can indirectly affect the system under test through certain methods (such as simulation, redirection, etc.), then these target historical test data may need to be properly adjusted or converted before they can be used. Specifically, the target historical test data can be modified according to business needs to obtain second data suitable for the system under test in the current scenario.
[0090] In some embodiments, operation S520 further includes: when the target historical test data is adaptively modified based on the test task information, recording the modification information in the log information of the target historical test data.
[0091] In the specific implementation process, after the target historical test data is modified, the modification information of the test data is recorded in detail in the log information of the target historical test data, where the modification information may include, for example, the date when the data was modified, the software version to which it belongs, the specific modifications made (such as the addition and deletion of data fields, the modification of field types, the modification of length), and which version of the system is used for testing. The data modification method may include, for example, the addition and deletion of fields, the modification of field types, the modification of length, etc. Recording the modified content of the data in detail in the log information helps to verify the consistency of the data, improve the accuracy and reliability of the test data in the database, and facilitate subsequent calls.
[0092] Figure 6 The flowchart of generating first data based on test task information according to another embodiment of the present disclosure is schematically shown.
[0093] like Figure 6 As shown, the process of generating first data based on test task information in this embodiment includes operations S610 to S620.
[0094] In operation S610, a corresponding generation method is selected for first data based on the test task information.
[0095] In some embodiments, the generation method may be determined by the purpose of the test, and the generation methods of the first data may be different for different test purposes. The generation methods of the first data may include, for example, calling an interface to generate test data, using a generation tool to generate test data, etc. For example, if the purpose of the test is functional testing, more attention should be paid to the accuracy and completeness of the data. It may be necessary to call an interface to generate data that complies with specific business rules to verify whether the functions of the system work as expected. If the purpose of the test is performance testing, a large amount of data needs to be generated to simulate high-concurrency scenarios. At this time, a generation tool (such as Faker, DBUnit, datafaker, etc.) can be used to quickly generate a large amount of test data. If the purpose of the test is security testing, some special data (such as malicious input, boundary values, etc.) needs to be constructed to test the security of the system. At this time, the test data can be generated by calling the interface and combining the generation tool.
[0096] In operation S620, first data is generated according to a generating method.
[0097] In some embodiments, after determining the generation method, the first data is generated based on the target generation method. Selecting the corresponding generation method to generate the first data through the test task information can effectively improve the efficiency and accuracy of the test and enhance the coverage and comprehensiveness of the test data.
[0098] Specifically, if the generation method is to generate test data by calling an interface, the interface information to be called is obtained, and corresponding test data is prepared according to the interface information. The interface information includes the URL of the interface, the request method, the request parameters, and the response format. By calling the interface of the system to be tested to generate test data, the consistency of the test data and the data of the production environment can be improved.
[0099] If the generation method is to use a generation tool to generate test data, it is necessary to adjust the parameters of the pre-built data model based on the test task information, and write data generation rules according to the test requirements. The generation tool automatically generates test data that meets the requirements based on the defined data model and generation rules. Using a generation tool to generate test data is efficient and flexible. The generation tool supports the generation of test data of multiple data types and data formats, can be flexibly configured according to test requirements, and quickly generates a large amount of test data that meets the requirements.
[0100] It should be noted that the above generation method is only exemplary. In addition to the above-mentioned calling interface test to generate data and using generation tools to generate test data, the generation method may also include, for example, generation using a random number generator, desensitizing production environment data, etc., which is not limited in this disclosure.
[0101] The system testing method provided by the present disclosure selects a corresponding test data generation method to generate test data according to the test task information, which can effectively improve the test efficiency and accuracy, so that the generated test data can be consistent with the data structure and format of the production environment, and improve the accuracy of the test. And dynamically generate test data for different scenarios according to the test requirements, so that the test data is more in line with the current needs, and enhance the coverage and diversity of the test.
[0102] In addition, the system testing method provided by the present disclosure also includes: regularly performing a clearing operation on the test data in the database to reduce the database load and improve the response speed and query efficiency of the system.
[0103] Figure 7 The flowchart of periodically performing a clearing operation on test data in a database according to an embodiment of the present disclosure is schematically shown.
[0104] like Figure 7 As shown, the periodic clearing operation of the test data in the database in this embodiment includes operations S710 to S730.
[0105] In operation S710, access logs of each database are periodically obtained.
[0106] In some embodiments, an automated script is written or an existing log management tool is used to regularly collect access logs from each database server, wherein the access logs of the database include information such as access time, access content, and executed operations.
[0107] In operation S720, access information of each historical test data is obtained based on the access log.
[0108] In some embodiments, the collected access logs are parsed to extract access information related to the historical test data, wherein the access information may include access time, accessed database table, accessed test data ID, etc.
[0109] In operation S730, historical test data in the database that meets the first condition is determined and deleted based on the access information.
[0110] In some embodiments, historical test data in the database that meets a first condition is determined based on access information of each historical test data, wherein the first condition is historical test data that has not been subjected to a specified operation within a specified time range, and the specified operation includes query, call, update, etc. The specified time range may be, for example, 60 days, 90 days, etc., and relevant personnel in the field may set the specified time range according to actual conditions, and the present disclosure does not limit this.
[0111] Furthermore, before executing the deletion operation on the historical test data that meets the first condition, the test data may be backed up to meet the need of data recovery.
[0112] The system testing method provided by the embodiment of the present disclosure will regularly clean up the test data that has not been accessed for a long time according to the access information of each test data in the database, so as to reduce the load of the database and avoid unnecessary storage costs. And regularly cleaning up the poems that are not frequently accessed can effectively reduce the amount of data that needs to be scanned during the query, and improve the response speed and query efficiency.
[0113] Based on the above system testing method, the present disclosure also provides a system testing device. Figure 8 The device is described in detail.
[0114] Figure 8 The structural block diagram of a system testing device according to an embodiment of the present disclosure is schematically shown.
[0115] like Figure 8 As shown, the system testing device 800 of this embodiment includes an acquisition module 810 , a generation module 820 , a determination module 830 and a testing module 840 .
[0116] The acquisition module 810 is used to acquire the current test task information. In one embodiment, the acquisition module 810 can be used to perform the operation S210 described above, which will not be described in detail here.
[0117] The generating module 820 is used to generate first data based on the test task information; wherein the first data is the test data newly generated in the current scenario. In one embodiment, the generating module 820 can be used to perform the operation S220 described above, which will not be described in detail here.
[0118] The determination module 830 is used to query the database for historical test data that matches the test task information, and determine the second data based on the query result; wherein the second data is obtained based on the historical test data, and the database is used to classify and store the historical test data. In one embodiment, the determination module 830 can be used to perform the operation S230 described above, which will not be repeated here.
[0119] The test module 840 is used to perform a test on the system to be tested according to the first data and the second data to obtain a test result of the system to be tested. In one embodiment, the test module 840 can be used to perform the operation S240 described above, which will not be described in detail here.
[0120] According to an embodiment of the present disclosure, any multiple modules among the acquisition module 810, the generation module 820, the determination module 830 and the test module 840 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the acquisition module 810, the generation module 820, the determination module 830 and the test module 840 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 such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation modes of software, hardware and firmware or in a proper combination of any of them. Alternatively, at least one of the acquisition module 810, the generation module 820, the determination module 830 and the test module 840 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be performed.
[0121] Fig. 9 A block diagram of an electronic device suitable for implementing a system testing method according to an embodiment of the present disclosure is schematically shown.
[0122] like Fig. 9 As shown, the electronic device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 to a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include an onboard memory for caching purposes. The processor 901 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.
[0123] In RAM 903, various programs and data required for the operation of electronic device 900 are stored. Processor 901, ROM 902 and RAM 903 are connected to each other via bus 904. Processor 901 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 902 and / or RAM 903. It should be noted that the program can also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0124] According to an embodiment of the present disclosure, the electronic device 900 may further include an input / output (I / O) interface 905, which is also connected to the bus 904. The electronic device 900 may further include one or more of the following components connected to the input / output (I / O) interface 905: an input portion 906 including a keyboard, a mouse, etc.; an output portion 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 908 including a hard disk, etc.; and a communication portion 909 including a network interface card such as a LAN card, a modem, etc. The communication portion 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the input / output (I / O) interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage portion 908 as needed.
[0125] 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 without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0126] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is 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 containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 902 and / or RAM 903 described above and / or one or more memories other than ROM 902 and RAM 903.
[0127] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the system testing method provided by the embodiment of the present disclosure.
[0128] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 901. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0129] In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and downloaded and installed through the communication part 909, and / or installed from a removable medium 911. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0130] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0131] 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 computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of 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 through the Internet).
[0132] The flow charts and block diagrams in the accompanying drawings illustrate the possible 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 flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order 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 flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0133] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0134] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A system testing method, characterized in that: The method comprises: Get the current test task information; Generate first data based on the test task information; wherein the first data is newly generated test data in the current scenario; Querying the historical test data matching the test task information in the database, and determining the second data based on the query result; wherein the second data is obtained based on the historical test data, and the database is used to classify and store the historical test data; A test is performed on the system to be tested according to the first data and the second data to obtain a test result of the system to be tested.
2. The system testing method according to claim 1, characterized in that: The test task information includes system information and test environment information; System information includes attribute information and connection relationship information. The test environment information includes at least one of the test purpose, key parameters, data dependencies, and business logic.
3. The system testing method according to claim 2, characterized in that: The step of searching the database for historical test data matching the test task information and obtaining second data based on the query result includes: Determine a target database from a plurality of databases based on the system information; wherein different databases store different test data; Searching for target historical test data from the target database based on the test environment information; Second data is determined based on the target historical test data.
4. The system testing method according to claim 3, characterized in that: The target database includes databases corresponding to the current system and the upstream system of the current system.
5. The system testing method according to claim 3, characterized in that: The searching target historical test data from the target database based on the test environment information includes: Determine at least one data table that meets the current business scenario from the target database based on the test environment information; Obtaining parameter information of each historical test data in the data table; wherein the parameter information of the historical test data includes link information and log information of each test data; Determine whether the historical test data is applicable to the current system to be tested based on the link information; In the case that the historical test data is applicable to the current system to be tested, the historical test data is determined as target historical test data.
6. The system testing method according to claim 3, characterized in that: The determining the second data based on the target historical test data comprises: Acquire a data version corresponding to the current test environment information based on the log information of the target historical test data, and determine the historical test data of this version as the second data; or Adaptively modifying the target historical test data based on the test task information; The modified target historical test data is determined as the second data.
7. The system testing method according to claim 6, characterized in that: Also includes: When the target historical test data is adaptively modified based on the test task information, the modification information is recorded in the log information of the target historical test data.
8. The system testing method according to claim 1, characterized in that: The generating first data based on the test task information includes: Selecting a corresponding generation method for the first data based on the test task information; Generate first data according to the generation method; The test data generation method is determined by the test purpose.
9. The system testing method according to claim 1, characterized in that: The method further includes: Regularly obtain access logs of each database; Obtaining access information of each historical test data based on the access log; Determine and delete the historical test data in the database that meets the first condition based on the access information; The historical test data satisfying the first condition is historical test data on which no specified operation has been performed within a specified time range.
10. A system testing device, characterized in that: The device comprises: Acquisition module, used to obtain current test task information; A generating module, configured to generate first data based on the test task information; wherein the first data is newly generated test data in the current scenario; A determination module, used to query the database for historical test data matching the test task information, and determine second data based on the query result; wherein the second data is obtained based on the historical test data, and the database is used to classify and store the historical test data; The test module is used to perform a test on the system to be tested according to the first data and the second data to obtain a test result of the system to be tested.
11. 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 9.
12. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
13. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.