Prerequisite
Sonarqube is installed (Create a new project named 'shootout')Sonar scanner is installed
Anaconda is installed
Install nose and coverage
pip install nose pip install coverage
Python Project structure
main.py
sample/
hello.py
testcase/
test.py
Sonar property file
create sonar-project.properties under the root folderContents of the file
sonar.projectKey=shootout #corresponds to the project name in Sonarqube sonar.projectName=Penalty shootout sonar.projectVersion=1.0 sonar.language=py sonar.python.xunit.reportPath=nosetests.xml sonar.python.coverage.reportPaths=coverage.xml sonar.python.xunit.skipDetails=true sonar.coverage.exclusions=testcase/**/*
Activate the Anaconda virtual environment
Note: It appears that nose can only run in the virtual environment, hence the need of the activation.conda init
Generate nosetests.xml and coverage.xml
coverage erase
nosetests --with-coverage --with-xunit coverage xml
Analyze the project
sonar-scanner
View the result
http://localhost:9000
Troubleshooting
https://github.com/sunmingtao/sample-code/issues/11https://github.com/sunmingtao/sample-code/issues/12
https://github.com/sunmingtao/sample-code/issues/13
https://github.com/sunmingtao/sample-code/issues/14
https://github.com/sunmingtao/sample-code/issues/15
https://github.com/sunmingtao/sample-code/issues/16
This is really an amazing post, thanks for sharing such a valuable information with us.
ReplyDeleteDevOps Training
DevOps Online Training
DevOps Training in Ameerpet
Thanks for sharing!! DevOps Training in Bangalore | Certification | Online Training Course institute | DevOps Training in Hyderabad | Certification | Online Training Course institute | DevOps Training in Coimbatore | Certification | Online Training Course institute | DevOps Online Training | Certification | Devops Training Online
ReplyDeleteThanks for sharing this wonderful content.its very useful to us.I feel really happy to have seen your webpage and look forward to so
ReplyDeletemany more entertaining times reading here.Great site and a great topic as well I really get amazed to read this.
oracle training in chennai
oracle training institute in chennai
oracle training in bangalore
oracle training in hyderabad
oracle training
hadoop training in chennai
hadoop training in bangalore