In coverage code coverage ~

  We look ~ code coverage statistics, this need not be too worried, that can help you optimize your code, you can look, but also do not take care ~

1, install coverage in cmd command-line window

1 pip install coverage

 

 

 2. After installation we command window, type in cmd: command ----- switch from the current directory to the directory where the code module .py file

cd C:\Users\92938\PycharmProjects\F20\bokeyuan

 

 

 3, started using code coverage coverage statistics, enter cmd allTest.py in my file, you need to enter your own python module file name, then press Return

1 coverage run allTest.py

 

 

 4. When you press Enter, the code begins to run statistics: the statistics look after ~

 

 

 5, panic, continue to enter the command cmd window: note the space, and then press ENTER ~

1 coverage html

 

 

 6, open Pycharm integrated environment, find the directory of htmlcov package following the index.html file browser open ~~~

 

 

 We look at the code to open the browser statistics -

 

 

 Click the implementation of the module, you can see into the implementation rate of the module details information

 

 

 After entering, click on the run button, green will be covered code, the code executed on behalf of what, after missing button clicks, the code will be covered with red, you can not see the code being executed what ~

 

 

 

The code here is not covered green coverage is not a hundred percent of it? In fact carried out, as part of the color is not covered by the parameters discover, discover () method is executed, the parameters must have been executed myself ~ ~

 

 

 

Today, so many things ~ ~ ~ If you still do not understand oh ~~~ white friends can leave a message on the road from novice

 

Guess you like

Origin www.cnblogs.com/woshidaliua/p/11432031.html
Recommended