Unlock instant, AI-driven research and patent intelligence for your innovation.

Method and device for generating smart contract test cases

A test case, smart contract technology, applied in the blockchain field, can solve problems such as difficult test cases

Active Publication Date: 2021-01-15
ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF6 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Since the interface on the smart contract can only parse data with a specific format, it is difficult to efficiently generate test cases that can be parsed by the smart contract

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and device for generating smart contract test cases
  • Method and device for generating smart contract test cases
  • Method and device for generating smart contract test cases

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0077] As mentioned earlier, in order to ensure the correctness of the smart contract deployed in the blockchain system, the smart contract needs to be tested before deploying the smart contract on the blockchain system. The basic idea of ​​testing smart contracts is to generate a series of test cases that simulate the actual use of smart contracts as input. After inputting the generated test cases into smart contracts, the execution actions or output results of smart contracts are obtained, and then according to the input The match between the test case and the obtained execution actions or output results is used to determine whether there is an error in the smart contract.

[0078] However, the interface parameters of smart contracts are usually designed as serializable complex data structures to facilitate data transmission between different nodes in the blockchain system. The test case used to test the smart contract includes one or more structured parameters. When the tes...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The embodiment of this specification provides a method and device for generating smart contract test cases. The method includes: first selecting at least one structural parameter to be mutated from the current test case, and ensuring that the selected structural parameter to be mutated can be Identify at least one interface in the smart contract to be tested; then, for each structured parameter to be mutated, obtain the parameter structure corresponding to the structured parameter to be mutated; then, for each structured parameter to be mutated, according to the structured parameter to be mutated For the corresponding parameter structure, mutate the structured parameter to be mutated to obtain the mutated structured parameter; then generate a test case including each mutated structured parameter as a test case input into the smart contract to be tested.

Description

technical field [0001] One or more embodiments of this specification relate to the field of blockchain technology, and in particular to a method and device for generating test cases for testing smart contracts in a blockchain system. Background technique [0002] The smart contract in the blockchain system is a set of commitments defined in digital form, which includes an agreement for the contract participants to implement the defined commitments. Through smart contracts, mutual distrust can be automatically achieved without the intervention of a centralized third party. The participants realize the agreed agreement. The smart contract is completely transparent to the participants of the blockchain system, and once deployed, it is difficult to be changed. Therefore, the smart contract needs to be tested before the smart contract is deployed to ensure the security and correctness of the deployed smart contract. sex. [0003] When testing a smart contract, it is necessary t...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F11/36G06Q40/04
CPCG06F11/3684G06Q40/04G06F11/3688G06F11/3692H04L9/3239H04L9/50
Inventor 邬萌王海军
Owner ALIPAY (HANGZHOU) INFORMATION TECH CO LTD