Pflux lets you analyze the dataflow of a python function, which is focused on the variable value changing. Based on the dataflow testing principles, it can generate CFG(control flow graph), program slice(all the code lines definitly or possibly affecting the chosen variable value), dc-path(define-clear path), and then analyze the coverage standard(how many dc-path the test case covers) according to your given test case.
In addition, the ui design draws inspiration from Electron Fiddle.
After cloning the repo,
cd pflux
npm install
npm start
The CFG divides the function into blocks. Each line of code must be executed only once when the program running into the block.
Program slice is a collection of code lines which may affect the value of chosen variable. For example, sum = a + b
affects the value of sum
and if sign > 0: sum = a + b
possibly
possibly affect the value of sum
, both are program slice of sum
.
Pflux gives the def-clear path but not def-use path. The only difference is that def-clear path has only one defining point at the beginning of the path but def-use path does not. Clear can alse be regarded as killing a value of the variable, more accuratedly, reassgining a variable.