Test case generation method for Solidity language

A test case generation and test case technology, applied in software testing/debugging, genetic rules, error detection/correction, etc., can solve problems such as program errors

Active Publication Date: 2019-08-06
HOHAI UNIV
View PDF6 Cites 12 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

In addition to common programming errors in traditional languages, some unique errors may also be caused by programming defects in solidity language

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
  • Test case generation method for Solidity language
  • Test case generation method for Solidity language

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0032] Below in conjunction with specific embodiment, further illustrate the present invention, should be understood that these embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention, after having read the present invention, those skilled in the art will understand various equivalent forms of the present invention All modifications fall within the scope defined by the appended claims of the present application.

[0033] Such as figure 1 As shown, a kind of solidity language-oriented test case generation method provided by the embodiment of the present invention comprises the following steps:

[0034]Step S1: CFG drawing of the program to be tested. According to the variable type of solidity language (especially address type address and unsigned integer uint); flow control statements including if-else, while, for, etc.; function body structure defined by keyword function; unique internal function require a...

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 invention discloses a test case generation method oriented to a Solidity language, which comprises the following steps of: for an intelligent contract program implemented by applying the Soliditylanguage, obtaining a corresponding control flow graph (CFG) according to the program, wherein the control flow graph covers calling information among function methods in the intelligent contract program; obtaining a definition-use pair (dup) of a variable present in the program according to the program CFG; in the process of generating the test case, applying a genetic algorithm to accelerate thegeneration speed of the effective test case. The integer overflow safety problem existing in the Solidity is considered, the definition and use of variables capable of causing integer overflow errorsby the test case are emphasized when the fitness function of the genetic algorithm is designed, so that coverage is realized, and the fitness value of the test case for realizing coverage on the dumprelated to the integer overflow errors is relatively large. The method provided by the invention is feasible, and realizes integer overflow coverage test on the basis of realizing coverage test on conventional variable operation in a program.

Description

technical field [0001] The invention relates to a method for generating test cases oriented to solidity language, in particular to a method for generating test cases based on data flow testing by applying a genetic algorithm, and belongs to the technical field of software testing. Background technique [0002] In the past two years, with the continuous development of blockchain technology, digital currency and smart contracts have become the focus of many researches. Among them, Ethereum is one of the typical platforms that support smart contract deployment and compilation, and solidity has become the programming language for smart contracts today. Popular languages. The reason why it is called a smart contract is that its main feature is that it can be automatic or have a certain degree of intelligence. Through pre-defined execution conditions and logic, when the conditions are met, the content of the contract is automatically executed to achieve the desired function; Espe...

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 Applications(China)
IPC IPC(8): G06F11/36G06N3/12
CPCG06F11/3684G06N3/126
Inventor 张鹏程于佳男吉顺慧肖锋
Owner HOHAI UNIV
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products