An automated testing method, device and storage medium based on blockchain
By using blockchain technology to generate block identifiers for business data in automated testing in the financial field, and building test parameters and verification logic based on preset models, the problem of incomplete enumeration of test scenarios is solved, the test reliability and security are improved, and R&D efficiency is enhanced.
Patent Information
- Application Number
- CN202210983414.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-16
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-08-16
AI Technical Summary
In automated testing in the financial sector, it is difficult to fully enumerate test scenarios, which leads to omissions in manually enumerated business scenarios and reduces the reliability of the test.
By identifying the block identifier of the business data of the target test scenario in the blockchain, using the preset test scenario construction model to build test parameters based on the block identifier, and determining the verification logic based on the block identifier, automated testing is performed.
It improves the reliability of testing, avoids data leakage, ensures data security, and solves the problems of low business scenario coverage and high missed detection rate, shortens the regression time of the R&D process, and improves R&D efficiency.
Smart Images

Figure CN115328786B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and specifically to a blockchain-based automated testing method, device, and storage medium. Background Art
[0002] Automated testing is the process of converting human-driven testing activities into machine-driven ones. Typically, after a test case is designed and reviewed, a tester executes the test step by step according to the procedures described in the test case, comparing the actual results with the expected results.
[0003] In the financial sector, test parameters in test scenarios are typically manually enumerated and then implemented through scripting. However, due to the wide variety of business scenarios involved in the financial sector, it is difficult to fully enumerate all test scenarios. Manually enumerated business scenarios are prone to omissions, reducing test reliability. Summary of the Invention
[0004] The embodiments of the present application propose a blockchain-based automated testing method, device, and storage medium, which can improve the reliability of testing.
[0005] The present application provides an automated testing method based on blockchain, including:
[0006] Identify the block ID corresponding to the business data of the target test scenario in the blockchain;
[0007] Using a preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier;
[0008] Determining, according to the block identifier, the verification logic corresponding to the test parameters of the target test scenario;
[0009] The test parameters corresponding to the target test scenario are verified based on the verification logic to obtain a verification result.
[0010] Accordingly, the embodiment of the present application also provides a blockchain-based automated testing device, comprising:
[0011] An identification unit, used to identify the block identifier corresponding to the business data of the target test scenario in the blockchain;
[0012] A construction unit, configured to construct test parameters corresponding to the target test scenario based on the block identifier using a preset test scenario construction model;
[0013] a determining unit, configured to determine, according to the block identifier, a verification logic corresponding to the test parameters of the target test scenario;
[0014] The verification unit is used to verify the test parameters corresponding to the target test scenario based on the verification logic to obtain a verification result.
[0015] In one embodiment, the construction unit may include:
[0016] a distribution determination subunit, configured to determine the data distribution corresponding to the business data of the target test scenario based on the block identifier by utilizing the distribution mapping relationship in the preset test scenario construction model;
[0017] The parameter generation subunit is used to generate test parameters corresponding to the target test scenario for the data distribution by using the preset test scenario construction model.
[0018] In one embodiment, the automated testing device may further include:
[0019] A first acquisition unit is used to acquire business data corresponding to different business scenarios;
[0020] A block identifier generation unit is used to generate corresponding block identifiers for business data of different business scenarios based on the blockchain.
[0021] In one embodiment, the automated testing device may further include:
[0022] A second acquisition unit is used to acquire first business data samples and second business data samples under different business scenarios, and to build a model for the test scenario to be trained;
[0023] a feature analysis unit, configured to perform feature analysis on the first business data samples under the different business scenarios to obtain reference data features corresponding to the first business data samples under the different business scenarios;
[0024] A training unit, configured to train the test scenario construction model to be trained using the first business data samples under the different business scenarios and reference data features corresponding to the first business data samples, to obtain an initial test scenario construction model;
[0025] A distribution fitting unit, configured to perform distribution fitting on the second business data samples under the different business scenarios using the model constructed by the initial test scenario, to obtain reference data distribution corresponding to the business data under the different business scenarios;
[0026] An updating unit is used to update the initial test scenario construction model based on the reference data distribution and the block identifier to obtain the preset test scenario construction model.
[0027] In one embodiment, the feature analysis unit may include:
[0028] The content analysis subunit is used to analyze the data field contents in multiple order data in the current business scenario to obtain content features;
[0029] The correlation analysis subunit is used to analyze the correlation between data fields in multiple order data in the current business scenario and obtain field correlation characteristics;
[0030] The integration subunit is used to integrate the content feature and the field association feature to obtain a reference data feature corresponding to the first business data sample.
[0031] In one embodiment, the training unit may include:
[0032] a distribution fitting subunit, configured to perform distribution fitting on the first business data sample by building a model using the test scenario to be trained, to obtain a data distribution corresponding to the first business data sample;
[0033] A parameter generation subunit, configured to construct a model using the test scenario to be trained and generate training test parameters based on the data distribution;
[0034] A feature analysis subunit, configured to perform feature analysis on the training and testing parameters to obtain data features corresponding to the training and testing parameters;
[0035] An adjustment subunit is used to adjust the test scenario construction model to be trained based on the data features corresponding to the training test parameters and the reference data features corresponding to the first business data sample to obtain the initial test scenario construction model.
[0036] In one embodiment, the adjusting subunit may include:
[0037] A feature loss calculation module, configured to calculate a feature loss between a data feature corresponding to a training test parameter and a reference data feature corresponding to the first business data sample;
[0038] An information acquisition module, configured to obtain expert feedback information on the training and testing parameters;
[0039] An expert feedback loss calculation module, used to convert the expert feedback information into an expert feedback loss;
[0040] A fusion module, configured to fuse the feature loss and the expert feedback loss to obtain a target loss;
[0041] An adjustment module is used to adjust the test scenario construction model to be trained using the target loss to obtain the initial test scenario construction model.
[0042] In one embodiment, the updating unit may include:
[0043] An association processing subunit, configured to associate the reference data distribution of business data in different business scenarios with the block identifier corresponding to the business data to obtain a distribution mapping relationship;
[0044] The embedding subunit is used to embed the distribution mapping relationship into the initial test scenario construction model to obtain the preset test scenario construction model.
[0045] Accordingly, an embodiment of the present application also provides a computer device, which includes a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute any blockchain-based automated testing method provided in any embodiment of the present application.
[0046] Accordingly, an embodiment of the present application also provides a storage medium, which stores a computer program. When the computer program is executed by a processor, it implements any blockchain-based automated testing method provided in any embodiment of the present application.
[0047] The embodiments of the present application include: identifying the block identifier corresponding to the business data of the target test scenario in the blockchain; using a preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier; determining the verification logic corresponding to the test parameters of the target test scenario based on the block identifier; and verifying the test parameters corresponding to the target test scenario based on the verification logic to obtain a verification result, which can improve the reliability of the test. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0049] Figure 1 This is a schematic diagram of a scenario of a blockchain-based automated testing method provided in an embodiment of the present application;
[0050] Figure 2 This is a flowchart of the blockchain-based automated testing method provided in an embodiment of the present application;
[0051] Figure 3 This is another flowchart of the blockchain-based automated testing method provided in an embodiment of the present application;
[0052] Figure 4 This is a schematic diagram of the structure of the blockchain-based automated testing device provided in an embodiment of the present application;
[0053] Figure 5 It is a structural diagram of the computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. However, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0055] The embodiments of the present application propose a blockchain-based automated testing method. This blockchain-based automated testing method can be executed by a blockchain-based automated testing device, which can be integrated into a computer device having at least one blockchain-based automated testing hardware. The computer device may include at least one of a computer device and a server. In other words, the blockchain-based automated testing method proposed in the embodiments of the present application can be executed by a computer device, a server, or a terminal and a server that can communicate with each other.
[0056] The terminals may be smartphones, tablets, laptops, personal computers (PCs), smart homes, wearable electronic devices, VR / AR devices, in-vehicle computers, etc. The servers may be intercommunication servers or backend servers between multiple heterogeneous systems, independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.
[0057] In one embodiment, if Figure 1 As shown, a blockchain-based automated testing device can be integrated with server 11 to implement the blockchain-based automated testing method proposed in the embodiment of the present application. Specifically, server 11 can identify the block identifier corresponding to the business data of the target test scenario in the blockchain; use a preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier; determine the verification logic corresponding to the test parameters of the target test scenario based on the block identifier; and verify the test parameters corresponding to the target test scenario based on the verification logic to obtain a verification result. Server 11 can then feed back the test results to terminal 10, so that the tester can know the test results through terminal 10.
[0058] The following are detailed descriptions of each embodiment. It should be noted that the description order of the following embodiments does not limit the preferred order of the embodiments.
[0059] The embodiments of the present application will be described from the perspective of a blockchain-based automated testing device, which can be integrated into a computer device.
[0060] like Figure 2 As shown in the figure, an automated testing method based on blockchain is provided. The specific process includes:
[0061] 101. Identify the block identifier corresponding to the business data of the target test scenario in the blockchain.
[0062] The target test scenario may refer to a scenario corresponding to a test task.
[0063] In one embodiment, the financial sector may include multiple different business scenarios, and the business data corresponding to each business scenario may have different characteristics. For example, the business data of different business scenarios may include data generated by credit cards, data generated by funds, data generated by insurance, and so on. The target test scenario may be one of these multiple different business scenarios.
[0064] In one embodiment, business data in the financial sector often involves user privacy. For example, business data in the financial sector generally involves information such as the user's name, age, home address, and financial status. Directly utilizing business data involving user privacy for testing may result in the disclosure of user privacy. Therefore, to improve data security and prevent the disclosure of user privacy, embodiments of the present application utilize blockchain technology to generate corresponding block identifiers for business data in different business scenarios. Then, using a pre-set test scenario to construct a model, test parameters corresponding to the target test scenario are generated based on the block identifiers, and the test parameters are used to implement the test process.
[0065] Specifically, before the step of "identifying the block identifier corresponding to the business data of the target test scenario in the blockchain", the following steps may be included:
[0066] Obtain corresponding business data for different business scenarios;
[0067] Generate corresponding block identifiers for business data in different business scenarios based on blockchain.
[0068] Blockchain is a chained data structure composed of sequentially linked data blocks in chronological order, a distributed ledger cryptographically guaranteed to be tamper-proof and unforgeable. Blockchain uses its distributed nodes to store, verify, transmit, and communicate network data. The data stored in a blockchain system can serve as strong evidence, providing a solid foundation for judgments. This not only helps prevent insurance fraud but also increases trust in the judgment results among all parties involved.
[0069] The block identifier can be a cryptographic identifier within the blockchain. For example, the block identifier can be a digital fingerprint derived by performing a double SHA256 hash calculation on the block header in the blockchain. The 32-byte hash value generated by the block identifier is called the block hash, or more accurately, the "block header hash," because only the block header is used to calculate this hash. The block hash uniquely and unambiguously identifies a block and can be independently derived by any node by simply hashing the block header. Note that the block hash is not actually included in the block's data structure, whether when the block is transmitted on the network, stored in a node's persistent storage as part of the blockchain, or stored as part of the blockchain. Instead, the hash of the block identifier is calculated by each node when the block is received from the network. The block hash can be stored in a separate database table as part of the block's metadata to facilitate indexing and faster retrieval of blocks from disk.
[0070] In one embodiment, business data corresponding to different business scenarios can be obtained, and corresponding block identifiers can be generated for each business data in each business scenario based on the blockchain. For example, a developer can use data collection methods such as tracking points to collect business data corresponding to N business scenarios. These N records can then be recorded in the blockchain, and the blockchain will assign a block identifier to the business data in each business scenario.
[0071] In one embodiment, when a business scenario includes multiple types of business data, the blockchain can also generate a block identifier for each type of business data. For example, a credit card scenario may generate multiple different types of business data. The blockchain can be used to generate a block identifier for each type of business data.
[0072] In one embodiment, after a block identifier is generated for business data, if testing is required, the block identifier of the business data of the target test scenario in the blockchain can be identified.
[0073] 102. Use the preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier.
[0074] In one embodiment, after identifying the block identifier of the business data of the target test scenario in the blockchain, a preset test scenario construction model can be used to construct test parameters corresponding to the target test scenario based on the block identifier.
[0075] The preset test scenario construction model is an artificial intelligence model. For example, the preset test scenario can be at least one of Convolutional Neural Networks (CNN), Deconvolutional Neural Networks (DN), Deep Neural Networks (DNN), Deep Convolutional Inverse Graphics Networks (DCIGN), Region-based Convolutional Networks (RCNN), Self-Attentive Sequential Recommendation (SASRec), Generative Adversarial Networks (GAN), Faster Region-based Convolutional Networks (Faster RCNN), Bidirectional Encoder Representations from Transformers (BERT) model, Conditional Random Field (CRF) model, etc.
[0076] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also involves studying the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0077] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0078] Machine Learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of artificial intelligence. Machine learning and deep learning typically include technologies such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning by demonstration. Reinforcement learning is a field within machine learning that emphasizes how to act based on the environment to maximize expected benefits. Deep reinforcement learning combines deep learning and reinforcement learning, applying deep learning techniques to solve reinforcement learning problems.
[0079] In one embodiment, the preset test scenario construction model may be used to construct test parameters corresponding to the target test scenario based on the block identifier.
[0080] The test parameters can be data generated by simulating the data characteristics of the business data of the target test scenario. The data characteristics of the test parameters and the business data have the same characteristics, but the test parameters and the business data are not the same. By using the preset test scenario construction model to construct the test parameters corresponding to the target test scenario based on the block identifier, the test parameters can be made to conform to the data characteristics of the business data of the target test scenario without leaking to the actual business data, thus ensuring both the reliability of the test and the security of the data.
[0081] In one embodiment, before using the preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier, the model needs to be trained to obtain the preset test scenario construction model.
[0082] Specifically, before the step of "using the preset test scenario to build a model to build test parameters corresponding to the target test scenario based on the block identifier", the following steps may be included:
[0083] Obtain first business data samples and second business data samples under different business scenarios, as well as the test scenarios to be trained to build models;
[0084] Performing feature analysis on first business data samples under different business scenarios to obtain reference data features corresponding to the first business data samples under different business scenarios;
[0085] Training the to-be-trained test scenario construction model using the first business data samples under the different business scenarios and reference data features corresponding to the first business data samples to obtain an initial test scenario construction model;
[0086] Using the initial test scenario to build a model, a distribution fitting is performed on the second business data samples under different business scenarios to obtain the reference data distribution corresponding to the business data under different business scenarios;
[0087] The initial test scenario construction model is updated based on the reference data distribution and block identification to obtain a preset test scenario construction model.
[0088] In one embodiment, the first service data sample and the second service data sample may be data obtained from the service data. The first service data sample and the second service data sample may be training samples to be used when training a model for building a test scenario to be trained.
[0089] In one embodiment, to enable the trained test scenario construction model to learn how to generate accurate test parameters, feature analysis can be performed on first business data samples in different business scenarios to obtain reference data features corresponding to the first business data samples in different business scenarios. The reference data features are then used to guide the trained test scenario construction model in learning how to construct accurate test parameters.
[0090] Among them, the reference data feature can refer to the data distribution of the data sample. For example, the parameter data feature describes the distribution of the data itself, and can also describe the correlation between data and data. For example, business data can include multiple order data. Among them, order data is data formed in units of orders. For example, the credit card business scenario includes data from tens of thousands of orders. For example, each order data may include the order number, user information, credit card application channel (online channel, integrated development channel, branch channel, direct sales channel), main and supplementary application, card type, card category and other information.
[0091] Among them, feature analysis can be performed on the information in the order to obtain reference data features.
[0092] Specifically, the step of “performing feature analysis on the first business data samples in different business scenarios to obtain reference data features corresponding to the first business data samples in different business scenarios” may include:
[0093] Analyze the data field contents in multiple order data in the current business scenario to obtain content features;
[0094] Analyze the correlation between data fields in multiple order data in the current business scenario to obtain field correlation features;
[0095] The content features and field association features are integrated to obtain reference data features corresponding to the first business data sample.
[0096] In one embodiment, each order data entry contains certain fixed fields that serve as reminders for the user to enter information. For example, in a credit card scenario, the order data may include fields such as "Order Number," "Name," "Age," "Card Type," and "Card Category." The information entered by the user based on these fields may serve as the data field content.
[0097] In one embodiment, the data field contents in multiple order data in the current business scenario may be analyzed to obtain content features. For example, the distribution of the data field contents in multiple content data in the current business scenario may be statistically analyzed to obtain content features.
[0098] In one embodiment, the correlation between data fields in multiple order data in the current business scenario can be analyzed to obtain field correlation features. For example, by analyzing the correlation between data fields in multiple order data, it can be determined that some fields will not appear in the same order. For another example, by analyzing the correlation between data fields in multiple order data, it can be determined that when certain data fields appear in an order, other fields will also appear in the order.
[0099] In one embodiment, the content features and field association features may be integrated to obtain reference data features corresponding to the first business data sample. For example, the content features and field association features may be integrated according to a preset format to obtain reference data features. For example, the integration may be performed in the format of {content features, field association features} to obtain reference data features. In another example, the content features and field association features may be constructed into a knowledge graph to obtain reference data features.
[0100] In one embodiment, after analyzing and obtaining reference data features, the reference data features can be used to guide the learning of the to-be-trained test scenario construction model. Specifically, the step of "using the first business data samples under different business scenarios and the reference data features corresponding to the first business data samples to train the to-be-trained test scenario construction model to obtain an initial test scenario construction model" may include:
[0101] Using the test scenario to be trained to build a model, a distribution fitting is performed on the first business data sample to obtain a data distribution corresponding to the first business data sample;
[0102] Use the test scenario to be trained to build a model based on data distribution and generate training and testing parameters;
[0103] Perform feature analysis on the training and testing parameters to obtain the data features corresponding to the training and testing parameters;
[0104] The test scenario construction model to be trained is adjusted based on the data features corresponding to the training test parameters and the reference data features corresponding to the first business data sample to obtain an initial test scenario construction model.
[0105] In one embodiment, the model to be trained can be used to perform distribution fitting on the first business data sample to obtain the data distribution corresponding to the first data sample. For example, the model to be trained for building a test scenario can be a generative adversarial network (GAN). The model to be trained for building a test scenario can include a generator and a discriminator. The generator is used to generate training test parameters based on the first business data sample, while the antagonist can discriminate the training test parameters generated by the generator. Through continuous confrontation and game between the generator and the antagonist, the generator can generate accurate test parameters.
[0106] In one embodiment, when the test scenario construction model to be trained is a GAN, a generator in the test scenario construction model to be trained can be used to perform distribution fitting on a first business data sample using the test scenario construction model to be trained, thereby obtaining a data distribution corresponding to the first business data sample; and the test scenario construction model to be trained can be used to generate training and test parameters based on the data distribution. For example, the generator can include an encoder and a decoder. The encoder can perform distribution fitting on the first business data sample to obtain a data distribution corresponding to the first business data sample. The decoder can generate training and test parameters based on the data distribution.
[0107] In one embodiment, feature analysis can be performed on the training test parameters to obtain data features corresponding to the training test parameters. The method of performing feature analysis on the training test parameters can refer to the above steps and will not be described here.
[0108] In one embodiment, the test scenario construction model to be trained may be adjusted based on the data features corresponding to the training test parameters and the reference data features corresponding to the first business data sample to obtain an initial test scenario construction model.
[0109] When the test scenario construction model to be trained is a GAN, an adversary of the test scenario construction model to be trained can be used to adjust the generator of the test scenario construction model to be trained based on the data features corresponding to the training test parameters and the reference data features corresponding to the first business data sample, thereby obtaining an initial test scenario construction model. For example, the adversary can calculate the loss between the data features corresponding to the training test parameters and the reference data features corresponding to the first business data sample, and then discriminate the training test parameters generated by the generator based on the loss, and feed the discrimination result back to the generator.
[0110] For another example, when the test scenario construction model to be trained is not a GAN, the step of “adjusting the test scenario construction model to be trained based on the data features corresponding to the training test parameters and the reference data features corresponding to the first business data sample to obtain an initial test scenario construction model” may include:
[0111] Calculating feature loss between data features corresponding to the training test parameter and reference data features corresponding to the first business data sample;
[0112] Obtain expert feedback on training and testing parameters;
[0113] Convert expert feedback information into expert feedback loss;
[0114] The feature loss and expert feedback loss are combined to obtain the target loss;
[0115] The target loss is used to adjust the model for the test scenario to be trained to obtain the initial test scenario model.
[0116] In one embodiment, a feature loss between the data feature corresponding to the training test parameter and the reference data feature corresponding to the first business data sample may be calculated. For example, the feature loss between the data feature corresponding to the training test parameter and the reference data feature corresponding to the first business data sample may be calculated based on relative entropy and cross entropy.
[0117] In one embodiment, during the training of the test scenario construction model to be trained, the test scenario construction model to be trained may generate training test parameters that meet the characteristics of the reference data. However, these training test parameters do not meet the requirements of the scenario. For example, some training test parameters generated by the test scenario construction model to be trained will not appear in the business scenario. If these invalid training test parameters appear during the test process, the reliability and accuracy of the test will be reduced. In order to filter out these invalid training test parameters, expert feedback information can also be introduced during the training process, and these training test parameters can be filtered out based on the expert feedback information.
[0118] Expert feedback information can be the knowledge accumulated by experts in the testing field based on their rich testing knowledge and experience. For example, expert feedback knowledge can explain what kind of business data will appear in what sample business scenarios, etc.
[0119] In one embodiment, the expert feedback information can be converted into an expert feedback loss. For example, the loss of the training and testing parameters can be calculated based on the expert feedback information to obtain the expert feedback loss. For example, the loss of the training and testing parameters can be calculated based on the expert feedback information using a negative log-likelihood function to obtain the expert feedback loss.
[0120] In one embodiment, the feature loss and the expert feedback loss can be fused to obtain a target loss. For example, the feature loss and the expert feedback loss can be added together to obtain the target loss. For another example, the feature loss and the expert feedback loss can be multiplied by an adjustment parameter and then added together to obtain the target loss. The adjustment parameter can be used to adjust the size of the feature loss and the expert feedback loss so that the two losses can be balanced. For example, when the adjusted feature loss is large, the adjustment parameter corresponding to the adjusted feature loss can be relatively small, so that the two losses can achieve a balanced effect on the training process of building a model for the training test scenario.
[0121] In one embodiment, the target loss can be used to adjust the test scenario construction model to be trained to obtain the initial test scenario construction model. For example, the test scenario construction model to be trained can adjust its own model parameters according to the target loss to obtain the initial test scenario construction model.
[0122] In one embodiment, the initial test scenario construction model can be a model that meets performance requirements and is capable of generating accurate test parameters. However, at this point, the initial test scenario construction model cannot yet generate test parameters based on block identifiers. Therefore, the test scenario construction model can be used to perform distribution fitting on second business data samples from different business scenarios to obtain reference data distributions corresponding to the business data in different business scenarios. The initial test scenario construction model is then updated based on the reference data distributions and block identifiers to obtain a preset test scenario construction model.
[0123] In one embodiment, the step of “updating the initial test scenario construction model based on the reference data distribution and the block identifier to obtain a preset test scenario construction model” may include:
[0124] Correlate the reference data distribution of business data in different business scenarios with the block identifiers corresponding to the business data to obtain a distribution mapping relationship;
[0125] The distribution mapping relationship is embedded into the initial test scenario construction model to obtain a preset test scenario construction model.
[0126] For example, the initial test scenario construction model can be used to perform distribution fitting on the second business data samples under different business scenarios to obtain the reference data distribution corresponding to the business data under different business scenarios. The reference data distribution of the business data under different business scenarios and the block identifiers corresponding to the business data are then associated to obtain a distribution mapping relationship. The distribution mapping relationship is then embedded in the initial test scenario construction model, allowing the preset test scenario construction model to determine the data distribution corresponding to the data based on the distribution mapping relationship. Test parameters can then be generated based on the data distribution.
[0127] Specifically, the step of "using the preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier" may include:
[0128] Use the distribution mapping relationship in the preset test scenario to build the model, and determine the data distribution corresponding to the business data of the target test scenario based on the block identifier;
[0129] The model is constructed using the preset test scenarios to generate test parameters corresponding to the target test scenarios for the data distribution.
[0130] For example, the preset test scenario construction model can use the distribution mapping relationship to map the block identifier to the data distribution corresponding to the business data of the target test scenario. Then, the preset test scenario construction model can use its own model structure and model parameters to generate test parameters corresponding to the target test scenario based on the data distribution.
[0131] 103. Determine the verification logic corresponding to the test parameters of the target test scenario according to the block identifier.
[0132] In one embodiment, after the preset test scenario construction model constructs the test parameters corresponding to the target test scenario based on the block identifier, the verification logic corresponding to the test parameters of the target test scenario can be determined according to the block identifier.
[0133] Before determining the verification logic corresponding to the test parameters of the target test scenario according to the block identifier, a verification logic mapping relationship between the block identifier corresponding to the business data in different business scenarios and the verification logic can also be established in advance.
[0134] Then, the verification logic corresponding to the test parameters of the target test scenario can be determined according to the verification logic mapping relationship.
[0135] For example, the block identifier may be matched with the reference area identifier in the verification logic mapping relationship, and then the verification logic corresponding to the test parameters of the target test scenario may be determined based on the matching result.
[0136] 104. Verify the test parameters corresponding to the target test scenario based on the verification logic to obtain a verification result.
[0137] In one embodiment, the test parameters corresponding to the target test scenario may be verified based on the verification logic to obtain a verification result.
[0138] For example, verification logic such as regularization matching rules, field consistency verification rules, and whitelist configuration rules can be used to verify the test parameters corresponding to the target test scenario to obtain verification results.
[0139] By using verification logic such as regularized matching rules, field consistency verification rules, and whitelist configuration rules to verify the test parameters corresponding to the target test scenario, the problem of many application fields and low consistency verification accuracy can be effectively solved. At the same time, it reduces the noise of inconsistent comparisons and reduces the cost of manual analysis.
[0140] The present embodiment proposes a blockchain-based automated testing method, comprising: identifying the block identifier corresponding to the business data of a target test scenario in the blockchain; constructing test parameters corresponding to the target test scenario based on the block identifier using a preset test scenario construction model; determining verification logic corresponding to the test parameters of the target test scenario based on the block identifier; and verifying the test parameters corresponding to the target test scenario based on the verification logic to obtain a verification result. First, the present embodiment can utilize blockchain technology to generate corresponding block identifiers for business data in different business scenarios. Then, the preset test scenario construction model can be used to generate test parameters corresponding to the target test scenario based on the block identifier, and the test process can be implemented using the test parameters. By utilizing blockchain technology, business data can be prevented from being directly utilized during the testing process, thereby preventing data leakage and improving the security of the testing process. Specifically, the present embodiment can utilize the preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier. This preset test scenario construction model implements full scenario model-driven automation, solving the problem of difficult and comprehensive business scenario coverage, effectively reducing the online scenario missed test rate, shortening the overall R&D process regression time, achieving high-quality delivery, and greatly improving R&D efficiency.
[0141] The method described in the above embodiment will be further described in detail below with examples.
[0142] The embodiment of this application will take the integration of a blockchain-based automated testing method in a server as an example to introduce the method of the embodiment of this application.
[0143] In one embodiment, if Figure 3 As shown in the figure, an automated testing method based on blockchain has the following specific process:
[0144] 201. The server identifies the block identifier corresponding to the business data of the target test scenario in the blockchain.
[0145] For example, the server can obtain corresponding business data under different business scenarios; and generate corresponding block identifiers for business data in different business scenarios based on the blockchain.
[0146] When the server obtains the business data of the target test scenario, the server can identify the block identifier corresponding to the business data of the target test scenario in the blockchain.
[0147] 202. The server uses a preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier.
[0148] For example, the server may input the block identifier into a preset test scenario construction model, and then the preset test scenario construction model constructs test parameters corresponding to the target test scenario based on the block identifier.
[0149] 203. The server determines the verification logic corresponding to the test parameters of the target test scenario according to the block identifier.
[0150] For example, the server can block identify the baseline knowledge base that matches the query and then obtain the verification logic from the baseline knowledge base. The baseline knowledge base can be a distributed system.
[0151] 204. The server verifies the test parameters corresponding to the target test scenario based on the verification logic to obtain a verification result.
[0152] For example, verification logic such as regularization matching rules, field consistency verification rules, and whitelist configuration rules can be used to verify the test parameters corresponding to the target test scenario to obtain verification results.
[0153] An embodiment of the present application proposes an operating method, including: the server identifies the block identifier corresponding to the business data of the target test scenario in the blockchain; the server uses a preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier; the server determines the verification logic corresponding to the test parameters of the target test scenario according to the block identifier; the server verifies the test parameters corresponding to the target test scenario based on the verification logic to obtain a verification result, which can improve the reliability of the test.
[0154] To better implement the blockchain-based automated testing method provided in the embodiments of this application, one embodiment also provides a blockchain-based automated testing device, which can be integrated into a computer device. The meanings of the terms herein are the same as those in the blockchain-based automated testing method for the aforementioned product. For specific implementation details, please refer to the description in the method embodiments.
[0155] In one embodiment, a blockchain-based automated testing device is provided. The blockchain-based automated testing device can be integrated into a computer device, such as a television. Figure 4 As shown, the blockchain-based automated testing device includes: an identification unit 301, a construction unit 302, a determination unit 303 and a verification unit 304, which are specifically as follows:
[0156] Identification unit 301, used to identify the block identifier corresponding to the business data of the target test scenario in the blockchain;
[0157] A construction unit 302 is configured to construct test parameters corresponding to the target test scenario based on the block identifier using a preset test scenario construction model;
[0158] A determining unit 303 is configured to determine, according to the block identifier, a verification logic corresponding to the test parameters of the target test scenario;
[0159] The verification unit 304 is configured to verify the test parameters corresponding to the target test scenario based on the verification logic to obtain a verification result.
[0160] In one embodiment, the constructing unit 302 may include:
[0161] a distribution determination subunit, configured to determine the data distribution corresponding to the business data of the target test scenario based on the block identifier by utilizing the distribution mapping relationship in the preset test scenario construction model;
[0162] The parameter generation subunit is used to generate test parameters corresponding to the target test scenario for the data distribution by using the preset test scenario construction model.
[0163] In one embodiment, the automated testing device may further include:
[0164] A first acquisition unit is used to acquire business data corresponding to different business scenarios;
[0165] A block identifier generation unit is used to generate corresponding block identifiers for business data of different business scenarios based on the blockchain.
[0166] In one embodiment, the automated testing device may further include:
[0167] A second acquisition unit is used to acquire first business data samples and second business data samples under different business scenarios, and to build a model for the test scenario to be trained;
[0168] a feature analysis unit, configured to perform feature analysis on the first business data samples under the different business scenarios to obtain reference data features corresponding to the first business data samples under the different business scenarios;
[0169] A training unit, configured to train the test scenario construction model to be trained using the first business data samples under the different business scenarios and reference data features corresponding to the first business data samples, to obtain an initial test scenario construction model;
[0170] A distribution fitting unit, configured to perform distribution fitting on the second business data samples under the different business scenarios using the model constructed by the initial test scenario, to obtain reference data distribution corresponding to the business data under the different business scenarios;
[0171] An updating unit is used to update the initial test scenario construction model based on the reference data distribution and the block identifier to obtain the preset test scenario construction model.
[0172] In one embodiment, the feature analysis unit may include:
[0173] The content analysis subunit is used to analyze the data field contents in multiple order data in the current business scenario to obtain content features;
[0174] The correlation analysis subunit is used to analyze the correlation between data fields in multiple order data in the current business scenario and obtain field correlation characteristics;
[0175] The integration subunit is used to integrate the content feature and the field association feature to obtain a reference data feature corresponding to the first business data sample.
[0176] In one embodiment, the training unit may include:
[0177] a distribution fitting subunit, configured to perform distribution fitting on the first business data sample by building a model using the test scenario to be trained, to obtain a data distribution corresponding to the first business data sample;
[0178] A parameter generation subunit, configured to construct a model using the test scenario to be trained and generate training test parameters based on the data distribution;
[0179] A feature analysis subunit, configured to perform feature analysis on the training and testing parameters to obtain data features corresponding to the training and testing parameters;
[0180] An adjustment subunit is used to adjust the test scenario construction model to be trained based on the data features corresponding to the training test parameters and the reference data features corresponding to the first business data sample to obtain the initial test scenario construction model.
[0181] In one embodiment, the adjusting subunit may include:
[0182] A feature loss calculation module, configured to calculate a feature loss between a data feature corresponding to a training test parameter and a reference data feature corresponding to the first business data sample;
[0183] An information acquisition module, configured to obtain expert feedback information on the training and testing parameters;
[0184] An expert feedback loss calculation module, used to convert the expert feedback information into an expert feedback loss;
[0185] A fusion module, configured to fuse the feature loss and the expert feedback loss to obtain a target loss;
[0186] An adjustment module is used to adjust the test scenario construction model to be trained using the target loss to obtain the initial test scenario construction model.
[0187] In one embodiment, the updating unit may include:
[0188] An association processing subunit, configured to associate the reference data distribution of business data in different business scenarios with the block identifier corresponding to the business data to obtain a distribution mapping relationship;
[0189] The embedding subunit is used to embed the distribution mapping relationship into the initial test scenario construction model to obtain the preset test scenario construction model.
[0190] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can be found in the previous method embodiments and will not be repeated here.
[0191] The reliability of the test can be improved through the above-mentioned blockchain-based automated testing device.
[0192] The embodiment of the present application also provides a computer device, which may include a computer device or a server. For example, the computer device may be used as an automated testing computer device based on blockchain, and the automated testing computer device based on blockchain may be a smart TV, etc.; for another example, the computer device may be a server, such as an automated testing server based on blockchain, etc. Figure 5 , which shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0193] The computer device may include one or more processing core processors 401, one or more computer readable storage media memories 402, a power supply 403, an input unit 404 and other components. Those skilled in the art will understand that Figure 5 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently.
[0194] Processor 401 is the control center of the computer device. It utilizes various interfaces and circuits to connect the various components of the entire computer device. By running or executing software programs and / or modules stored in memory 402 and accessing data stored in memory 402, it performs various functions of the computer device and processes data, thereby providing overall monitoring of the computer device. Optionally, processor 401 may include one or more processing cores; preferably, processor 401 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interfaces, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 401.
[0195] Memory 402 can be used to store software programs and modules. Processor 401 executes various functional applications and blockchain-based automated testing by running the software programs and modules stored in memory 402. Memory 402 may mainly include a program storage area and a data storage area. The program storage area may store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created based on the use of the computer device, etc. In addition, memory 402 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, memory 402 may also include a memory controller to provide processor 401 with access to memory 402.
[0196] The computer device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 403 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0197] The computer device may further include an input unit 404, which may be configured to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0198] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the computer device will load the executable files corresponding to one or more application processes into the memory 402 according to the following instructions, and the processor 401 will run the application stored in the memory 402 to implement various functions as follows:
[0199] Identify the block ID corresponding to the business data of the target test scenario in the blockchain;
[0200] Using a preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier;
[0201] Determining, according to the block identifier, the verification logic corresponding to the test parameters of the target test scenario;
[0202] The test parameters corresponding to the target test scenario are verified based on the verification logic to obtain a verification result.
[0203] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0204] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in various optional implementations of the above embodiments.
[0205] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0206] To this end, embodiments of the present application further provide a storage medium storing a computer program that can be loaded by a processor to execute the steps of any of the blockchain-based automated testing methods provided in embodiments of the present application. For example, the computer program can execute the following steps:
[0207] Identify the block ID corresponding to the business data of the target test scenario in the blockchain;
[0208] Using a preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier;
[0209] Determining, according to the block identifier, the verification logic corresponding to the test parameters of the target test scenario;
[0210] The test parameters corresponding to the target test scenario are verified based on the verification logic to obtain a verification result.
[0211] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0212] Since the computer program stored in the storage medium can execute the steps of any blockchain-based automated testing method provided in the embodiments of the present application, the beneficial effects that can be achieved by any blockchain-based automated testing method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0213] The above is a detailed introduction to the blockchain-based automated testing method, device and storage medium provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present application.
Claims
1. An automated testing method based on blockchain, characterized in that: include: Identify the block ID corresponding to the business data of the target test scenario in the blockchain; Using a preset test scenario construction model to construct test parameters corresponding to the target test scenario based on the block identifier; Determining, according to the block identifier, the verification logic corresponding to the test parameters of the target test scenario; Verify the test parameters corresponding to the target test scenario based on the verification logic to obtain a verification result; Before constructing the test parameters corresponding to the target test scenario based on the block identifier by using the preset test scenario construction model, the method further includes: Obtain first business data samples and second business data samples under different business scenarios, as well as the test scenarios to be trained to build models; Performing feature analysis on the first business data samples under the different business scenarios to obtain reference data features corresponding to the first business data samples under the different business scenarios; Using the to-be-trained test scenario to build a model, a distribution fitting is performed on the first business data sample to obtain a data distribution corresponding to the first business data sample; Building a model using the test scenario to be trained and based on the data distribution, generating training test parameters; Performing feature analysis on the training and testing parameters to obtain data features corresponding to the training and testing parameters; Adjusting the to-be-trained test scenario construction model based on the data features corresponding to the training test parameters and the reference data features corresponding to the first business data sample to obtain an initial test scenario construction model; Using the initial test scenario to build a model, a distribution fitting is performed on the second business data samples under the different business scenarios to obtain a reference data distribution corresponding to the business data under the different business scenarios; The initial test scenario construction model is updated based on the reference data distribution and the block identifier to obtain the preset test scenario construction model.
2. The method according to claim 1, characterized in that The method of using a preset test scenario to construct a model to construct test parameters corresponding to the target test scenario based on the block identifier includes: Utilizing the distribution mapping relationship in the preset test scenario construction model, determining the data distribution corresponding to the business data of the target test scenario based on the block identifier; The preset test scenario is used to construct a model to generate test parameters corresponding to the target test scenario for the data distribution.
3. The method according to claim 1, characterized in that The business data identifying the target test scenario is placed before the corresponding block identifier in the blockchain, and the method further includes: Obtain corresponding business data for different business scenarios; Based on the blockchain, corresponding block identifiers are generated for business data in different business scenarios.
4. The method according to claim 1, wherein The first business data sample includes a plurality of order data; and the feature analysis of the first business data samples under the different business scenarios to obtain reference data features corresponding to the first business data samples under the different business scenarios includes: Analyze the data field contents in multiple order data in the current business scenario to obtain content features; Analyze the correlation between data fields in multiple order data in the current business scenario to obtain field correlation features; The content feature and the field association feature are integrated to obtain a reference data feature corresponding to the first business data sample.
5. The method according to claim 1, wherein The adjusting the test scenario construction model to be trained based on the data features corresponding to the training test parameters and the reference data features corresponding to the first business data sample to obtain an initial test scenario construction model includes: Calculating feature loss between data features corresponding to the training test parameters and reference data features corresponding to the first service data sample; Obtaining expert feedback information on the training and testing parameters; Converting the expert feedback information into an expert feedback loss; The feature loss and the expert feedback loss are combined to obtain the target loss; The target loss is used to adjust the test scenario construction model to be trained to obtain the initial test scenario construction model.
6. The method according to claim 1, characterized in that The updating of the initial test scenario construction model based on the reference data distribution and the block identifier to obtain the preset test scenario construction model includes: Associating the reference data distribution of business data in different business scenarios with the block identifiers corresponding to the business data to obtain a distribution mapping relationship; The distribution mapping relationship is embedded in the initial test scenario construction model to obtain the preset test scenario construction model.
7. An automated testing device based on blockchain, characterized in that: include: An identification unit, used to identify the block identifier corresponding to the business data of the target test scenario in the blockchain; A construction unit, configured to construct test parameters corresponding to the target test scenario based on the block identifier using a preset test scenario construction model; a determining unit, configured to determine, according to the block identifier, a verification logic corresponding to the test parameters of the target test scenario; A verification unit, configured to verify the test parameters corresponding to the target test scenario based on the verification logic to obtain a verification result; Wherein, before the construction unit, it also includes: Obtain first business data samples and second business data samples under different business scenarios, as well as the test scenarios to be trained to build models; Performing feature analysis on the first business data samples under the different business scenarios to obtain reference data features corresponding to the first business data samples under the different business scenarios; Using the to-be-trained test scenario to build a model, a distribution fitting is performed on the first business data sample to obtain a data distribution corresponding to the first business data sample; Building a model using the test scenario to be trained and based on the data distribution, generating training test parameters; Performing feature analysis on the training and testing parameters to obtain data features corresponding to the training and testing parameters; Adjusting the to-be-trained test scenario construction model based on the data features corresponding to the training test parameters and the reference data features corresponding to the first business data sample to obtain an initial test scenario construction model; Using the initial test scenario to build a model, a distribution fitting is performed on the second business data samples under the different business scenarios to obtain a reference data distribution corresponding to the business data under the different business scenarios; The initial test scenario construction model is updated based on the reference data distribution and the block identifier to obtain the preset test scenario construction model.
8. A computer device, characterized in that: The system comprises a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the blockchain-based automated testing method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium stores a plurality of computer programs, which are suitable for loading by a processor to execute the blockchain-based automated testing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Block chain-based test method and device, storage medium and computer equipment
CN110598446A
Data monitoring method and system and non-instantaneous computer readable storage medium
CN113821398A